26.02.2013, 20:17
Get ZCMD + Sscanf and you will have
pawn Код:
CMD:givecash(playerid, params[])
{
new playerb, amount;
if(sscanf(params, "ui", playerb, amount)) return SendClientMessage(playerid,-1, "USAGE: /givecash [playerid] [amount]");
if(amount <= 0) return SendClientMessage(playerid, -1, "Invalid money amount.");
if(playerid == playerb) return SendClientMessage(playerid, -1, "You can't pay money to yourself.");
if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, -1, "You are too far away from that player.");
if(GetPlayerMoney(playerid) < amount) return SendClientMessage(playerid, -1, "You don't have that much on you right now.");
GivePlayerMoney(playerid, -amount);
GivePlayerMoney(playerb, amount);
return 1;
}
stock IsPlayerNearPlayer(playerid, targetid, Float:radius)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(targetid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, radius ,x, y, z))
{
return 1;
}
return 0;
}