SA-MP Forums Archive
the freaking /givemoney cmd :c - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: the freaking /givemoney cmd :c (/showthread.php?tid=593802)



the freaking /givemoney cmd :c - ahmedraed - 09.11.2015

Quote:

CMD:givemoney(playerid, params[])
{
new string[SOS];
new toplayerid, money, sendername[MAX_PLAYER_NAME], recievername[MAX_PLAYER_NAME];
if(sscanf(params,"ui", toplayerid, money)) return SendClientMessage(playerid, RED, "ERROR: /givemoney [Playerid] [Money]");
if(!IsPlayerConnected(toplayerid)) return SendClientMessage(playerid, RED, "ERROR: Player is not connected");
GetPlayerName(playerid, sendername, 24);
GetPlayerName(toplayerid, recievername, 24);
format(string, SOS, "You Have Sent %i $ To %s.", sendername);
SendClientMessage(playerid, GREEN, string);
format(string, SOS, "You Have Recieved %i $ From %s.", recievername);
SendClientMessage(toplayerid, GREEN, string);
GivePlayerMoney(playerid, -money);
GivePlayerMoney(toplayerid, money);
return 1;
}

this is the command but when i use it in game it says:
[10:38:15] You Have Sent 91 $ To .

[10:38:15] You Have Recieved 91 $ From .


Note:it ALWAYS says 91$ whatever if you typed any other amount and it doesn't show the name


Re: the freaking /givemoney cmd :c - Abagail - 09.11.2015

You are only passing the player names to the format function and not the amount of cash.
pawn Код:
CMD:givemoney(playerid, params[])
{
new string[SOS];
new toplayerid, money, sendername[MAX_PLAYER_NAME], recievername[MAX_PLAYER_NAME];
if(sscanf(params,"ui", toplayerid, money)) return SendClientMessage(playerid, RED, "ERROR: /givemoney [Playerid] [Money]");
if(!IsPlayerConnected(toplayerid)) return SendClientMessage(playerid, RED, "ERROR: Player is not connected");
GetPlayerName(playerid, sendername, 24);
GetPlayerName(toplayerid, recievername, 24);
format(string, SOS, "You Have Sent %i $ To %s.", money, sendername);
SendClientMessage(playerid, GREEN, string);
format(string, SOS, "You Have Recieved %i $ From %s.", money, recievername);
SendClientMessage(toplayerid, GREEN, string);
GivePlayerMoney(playerid, -money);
GivePlayerMoney(toplayerid, money);
return 1;
}



Re: the freaking /givemoney cmd :c - ahmedraed - 09.11.2015

Fuck lool was i that stupid?! xd +rep m8 thanks