15.07.2010, 21:13
Hey guys, Whats wrong with my /pay commanD?
I also want that you can't give yourself money :P
I thought it was like:
if(ID == playerid) return SendClientMessage(giveplayerid,COLOR_YELLOW,"You can't give yourself money!");
Thanks
pawn Код:
if (strcmp(cmd, "/pay", true) == 0)
{
new giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
giveplayerid = strval(tmp);
new cashamount = strval(tmp2);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /pay [playerid] [amount]");
if(!strlen(tmp2)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /pay [playerid] [amount]");
if(GetPlayerMoney(playerid) < cashamount) SendClientMessage(playerid, COLOR_RED, "Not enough money");
{
GivePlayerMoney(giveplayerid,cashamount);
GivePlayerMoney(playerid,-cashamount);
GetPlayerName(giveplayerid,playername,sizeof(playername));
format(string,sizeof(string),"You sended %s %d money",playername,cashamount);
SendClientMessage(playerid,COLOR_YELLOW,string);
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"%s has given you %d money.",playername,cashamount);
SendClientMessage(giveplayerid,COLOR_YELLOW,string);
}
return 1;
}
I thought it was like:
if(ID == playerid) return SendClientMessage(giveplayerid,COLOR_YELLOW,"You can't give yourself money!");
Thanks