Problem with one Command - 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: Problem with one Command (
/showthread.php?tid=347782)
Problem with one Command -
Yordan_Kronos - 03.06.2012
Hello i have one problem with my command "givemoney" .When i use this command money become 0.
Example : i have 2000 $ but i wanna have 15000$ and use /givemoney ID 15000 .. and my money become 0 .. This is bug. This is Command script
Код:
CMD:givemoney(playerid, params[])
{
new id, cash, sendername[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], string[128];
if(PlayerInfo[playerid][pAdmin] < 1337) return SCM(playerid, COLOR_GREY,"You are not authorized to use this command");
if(sscanf(params,"ui", id, cash)) return SCM(playerid, COLOR_GREY,"USAGE: /givemoney [playerid/partofname] [ammount]");
if(!IsPlayerConnected(id)) return SCM(playerid, COLOR_GREY,"Invalid player ID");
else
{
GivePlayerCash(id, cash);
GetPlayerName(playerid,sendername,sizeof(sendername));
GetPlayerName(id,name,sizeof(name));
format(string,sizeof(string),"%s has given %s money to %d", sendername, name, cash);
ABroadCast(COLOR_YELLOW,string,1);
format(string,sizeof(string),"You have recieved %d money from admin %s", cash, sendername);
SendClientMessage(id, COLOR_YELLOW, string);
}
return 1;
}
Re: Problem with one Command -
Edward156 - 03.06.2012
pawn Код:
CMD:givemoney(playerid,params[])
{
if(PlayerInfo[playerid][pAdmin] < 1337) return SCM(playerid, COLOR_GREY,"You are not authorized to use this command");
new pname[24], cash, targetid, string[128];
if(sscanf(params,"ui",targetid, cash)) return SendClientMessage(playerid,-1,"USAGE: /givemoney [id] [amount]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Invalid player.");
GetPlayerName(targetid, pname, 24);
GivePlayerMoney(targetid, cash);
format(string, 128, "You have received $%d rrom admin %s!", cash ,playerid);
SendClientMessage(targetid,COLOR_GREEN,string);
return 1;
}
Re: Problem with one Command -
Yordan_Kronos - 03.06.2012
Works,Thanks