16.01.2013, 12:43
pawn Код:
CMD:hit(playerid, params[])
{
new amount,stringx[128],tname[MAX_PLAYER_NAME];
if(sscanf(params, "ud", ID, amount)) return SendClientMessage(playerid, RED, "[USAGE]: /hit [name/id] [amount]");
if(amount < 10000) return SendClientMessage(playerid, COLOR_AQUA, "The hit must be atleast worth $10,000.");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, RED, "Player not found.");
if(ID == playerid) return SendClientMessage(playerid, COLOR_AQUA, "You cannot place a hit on yourself.");
if(GetPlayerCash(playerid) < amount) return SendClientMessage(playerid, RED, "Insufficient funds.");
if(HasHit[ID] > 0) return SendClientMessage(playerid, COLOR_AQUA, "That player already has a hit contract placed on them.");
{
HasHit[ID] = amount;
HasPlacedHit[ID] = playerid;
GetPlayerName(ID,tname,MAX_PLAYER_NAME);
format(fstr, sizeof(fstr), "You have placed a hit on %s [%d] for $%d.", GetName(ID), ID, amount);
SendClientMessage(playerid, COLOR_AQUA, fstr);
format(stringx,sizeof(stringx),"HIT PLACED ON %s FOR $%d",tname,amount);
GameTextForPlayer(playerid,stringx, 5000, 5);
format(stringx,sizeof(stringx),"Hit placed on you by: %s",GetName(playerid));
GameTextForPlayer(ID,stringx, 5000, 5);
format(fstr2, sizeof(fstr2), "[HIT]: %s [%d] has placed a hit contract on %s [%d] for $%d.", GetName(playerid), playerid, GetName(ID), ID, amount);
SendClientMessageToAll(COLOR_AQUA, fstr2);
SendClientMessage(ID, COLOR_AQUA, "You now have a hit contract!");
}
return true;
}