19.03.2012, 21:20
Hello,i've maked this givemoney command but i have some problems.
1) If i send money to any id EXCEPT 0,the money will be sent only at id 0 and NOT at any others id specificied.Ex: /gm 1 1000 - 1000$ to id 1,nothing,it sends to id 0,always.
2) The money doesn't go down if u send it.
Thanks for help
pawn Код:
CMD:gm(playerid, params[])
{
new targetid,id, ammount;
new n[MAX_PLAYER_NAME];
new on[MAX_PLAYER_NAME];
GetPlayerName(targetid,n,sizeof(n));
GetPlayerName(id,on,sizeof(on));
if(sscanf(params,"ui", targetid, ammount)) return SendClientMessage(playerid, yellow,"/givemoney [PlayerID] [Ammount]");
if(IsSpawned[id] == 0) return SendClientMessage(playerid,0xFF0000FF,"You can't use this command when you are dead or spawning.");
if(IsRobbing[id] == 1) return SendClientMessage(playerid,0xFF0000FF,"You can't send money while robbing.");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "Invalid Player ID.");
if(targetid == id) return SendClientMessage(playerid,red, "You can't sent money to yourself.");
GivePlayerMoney(targetid, ammount);
new string[128];
format(string,sizeof(string),"You sent %i$ to %s (%d)",ammount,n,targetid);
SendClientMessage(id,red,string);
new gtsent[128];
format(gtsent,sizeof(gtsent),"%i$ sent to %s (%d)",ammount,n,targetid);
GameTextForPlayer(playerid,gtsent,3000,3);
new string2[128];
format(string2,sizeof(string2),"%s (%d) has sent you %i$)",on,id,ammount);
SendClientMessage(targetid,red,string2);
new gtrec[128];
format(gtrec,sizeof(gtrec),"Received %i$ from %s (%d)",ammount,on,id);
GameTextForPlayer(playerid,gtrec,3000,3);
return 1;
}
2) The money doesn't go down if u send it.
Thanks for help
![Smiley](images/smilies/smile.png)