22.04.2010, 21:08
Hey sa-mp forum,
I have a working dcmd /givecash command and I wish to add GetDistanceBetweenPlayers so that players may only send and recieve money if they are close enough to each other. Also, I would like to add to it something like: If player is too faraway, then sendclientmessage "You are too faraway".
This is the dcmd:
Any ideas of what I can do?
Thanks,
borg245
I have a working dcmd /givecash command and I wish to add GetDistanceBetweenPlayers so that players may only send and recieve money if they are close enough to each other. Also, I would like to add to it something like: If player is too faraway, then sendclientmessage "You are too faraway".
This is the dcmd:
Код:
dcmd_givecash(playerid, params[]) { new giveplayerid, amount; if(sscanf(params, "dd", giveplayerid, amount)) SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /givecash [playerid] [amount]"); else if(!IsPlayerConnected(giveplayerid)) SendClientMessage(playerid, 0xFF0000FF, "* Invalid player ID!"); else if(amount > GetPlayerMoney(playerid)) SendClientMessage(playerid, 0xFF0000FF, "* Invalid amount!"); else { new playername[24], string[80]; GetPlayerName(giveplayerid, playername, 24); format(string, 80, "* You sent $%d to %s (ID %d)", amount, playername, giveplayerid); SendClientMessage(playerid, 0x00FF00FF, string); GetPlayerName(playerid, playername, 24); format(string, 80, "* You revceived $%d from %s (ID %d)", amount, playername, playerid); SendClientMessage(giveplayerid, 0x00FF00FF, string); GivePlayerMoney(giveplayerid, amount); GivePlayerMoney(playerid, 0 - amount); } return true; }
Thanks,
borg245