jpcsupplies / Economy_mod

Basic Economy System for Space Engineers
13 stars 12 forks source link

TODO: Extra checks in the pay command #19

Closed jpcsupplies closed 8 years ago

jpcsupplies commented 9 years ago

There is a section in the pay command that if a player who we want to pay has no balance record yet; is online, to create that record.. however ive not the faintest idea the best way to iterate over the other online players to pull out the relevant details...

Are you able to take a crack at that bit? Or at least point me in the right direction. See following section in code: //* if false, //* it needs to check if the other player is even online //* if true //* create one with default balance. //* flag hasaccount bool true

this should also knock out issue #10 too so its a two for 1 sale..

midspace commented 9 years ago

Can do.

This logic though is starting to impinge upon the code we need for server/client interaction.

jpcsupplies commented 9 years ago

Also forgot to add, ideally once a player is paid, they need to be notified somehow; so is there a way to send it to a particular player, (or their faction chat tab page from a mod yet) ? Short term probably just send to all.. but be tidier to let the recipent know somehow.

midspace commented 9 years ago

There isn't a command for sending a message to a specific player. MyAPIGateway.Utilities.SendMessage(...)will send a message to all players, but it will be sent from the player who ran it.

To send a message to a specific player, we'll need to get the server/client code running, because then we can pipe our custom message through to the targeted player, and broadcast a private message on their game using MyAPIGateway.Utilities.ShowMessage(...)

SaltPepp commented 9 years ago

Its going to be interesting how we tackle this. Will we need to create custom packets?

midspace commented 9 years ago

It's practically what we have in the Admin mod. The hardest part is testing it, because you need to publish it to Steam and run a game with two players.

jpcsupplies commented 9 years ago

ive got two pcs at home here side by side both with space engineers both with different steam accounts so the testing is possible, but that doesnt help you at your end :/

midspace commented 9 years ago

negative balances are still an issue. We need to block people sending more than they have. And stop Admins taking more than the other player has.

jpcsupplies commented 9 years ago

its coded so that admins can pay more than they have, or removed what they like as a management ability, in conjuction with /reset

assuming my logic carried over normal players wont be able to pay more than they have

midspace commented 9 years ago

We don't need to check if the target player is online, as SE will do that. It just dumps the message if the target player doesn't exist.

I've updated the logic that finds the target player, and added some additional checks to make sure it finds only 1 player. It can also do partial name matches, if the name is unique enough.

The rest of the pseudo code probably isn't required any more and could be removed if you are happy with the entire flow.

jpcsupplies commented 9 years ago

Sounds good, i think with your join / seen logic, it renders this entire issue moot now - so you should be able to close this then..

My worry was that if we tried to pay someone who was online, but didnt have a bank record yet; then the payment would fail because i had no way to grab a 3rd parties steam uid to create the record

midspace commented 8 years ago

Closing. :+1: