11.12.2009, 19:32
Quote:
Originally Posted by mprofitt
pawn Код:
|
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(givecash, 8, cmdtext);
return 0;
}
dcmd_givecash(playerid, params[])
{
new string[256];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
new
giveplayerid,
amount;
if (sscanf(params, "ud", giveplayerid, amount))return SendClientMessage(playerid, 0xFF9900AA, "Usage: /givecash [playerid/partname] [amount]");
else if (giveplayerid == INVALID_PLAYER_ID)return SendClientMessage(playerid, 0xFF9900AA, "Player Not Found");
else if (amount > GetPlayerMoney(playerid))return SendClientMessage(playerid, 0xFF9900AA, "You Don't Have Enough Money!");
else if (giveplayerid == playerid)return SendClientMessage(playerid,0xFF9900AA,"You Can't Give Money To Yourself!");
else
{
GivePlayerMoney(giveplayerid, amount);
GameTextForPlayer(giveplayerid,"~g~Money Recived",3000,5);
format(string, sizeof(string), "You Recived $%d From Player %s(%d)",amount,playername,giveplayerid);
SendClientMessage(giveplayerid,0x33CCFFAA,string);
GivePlayerMoney(playerid, 0 - amount);
GameTextForPlayer(playerid,"~y~Money Sent",3000,5);
format(string, sizeof(string), "You Have Sent $%d To Player %s(%d)",amount,playername,playerid);
SendClientMessage(playerid,0x33CCFFAA,string);
}
return 1;
}
Cheers.