new moneyfirst[MAX_PLAYERS];
stock SetPlayerMoney(playerid,moneyafter) {
moneyfirst[playerid]=moneyafter;
GivePlayerMoney(playerid,moneyafter-GetPlayerMoney(playerid));
}
|
Make a function for SetPlayerMoney:
PHP код:
Then make the command with: targetid & amount. |
cmd:dosomething(playerid)
{
command lines and stuff here...
something to get and store the victim's ID current money here...
ResetPlayerMoney(ID);
return 1;
}
cmd:undosomething(playerid)
{
command lines and stuff here...
something to give the stored money from the other command back to the victim's ID here...
return 1;
}
new storedcash[MAX_PLAYERS];
cmd:dosomething(playerid)
{
command lines and stuff here...
something to get and store the victim's ID current money here...
GetPlayerCash(playerid, storedcash[playerid]); playerid or whatever you want.
ResetPlayerMoney(playerid);
return 1;
}
cmd:undosomething(playerid)
{
command lines and stuff here...
something to give the stored money from the other command back to the victim's ID here...
GivePlayerCash(playerid, storedcash[playerid]); //playerid or whatever it is.
return 1;
}
|
Код:
new storedcash[MAX_PLAYERS];
cmd:dosomething(playerid)
{
command lines and stuff here...
something to get and store the victim's ID current money here...
GetPlayerCash(playerid, storedcash[playerid]); playerid or whatever you want.
ResetPlayerMoney(playerid);
return 1;
}
cmd:undosomething(playerid)
{
command lines and stuff here...
something to give the stored money from the other command back to the victim's ID here...
GivePlayerCash(playerid, storedcash[playerid]); //playerid or whatever it is.
return 1;
}
|
new OldMoney[MAX_PLAYERS];
CMD:reset(playerid, params[])
{
//code
OldMoney[playerid] = GetPlayerMoney(playerid);
ResetPlayerMoney(playerid);
return 1;
}
CMD:giveback(playerid, params[])
{
GivePlayerMoney(playerid, OldMoney[playerid]);
return 1;
}
|
PHP код:
|