/GiveCash Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /GiveCash Command (
/showthread.php?tid=523165)
/GiveCash Command -
hossamkandil - 01.07.2014
Hi Guys I Want To Make A /Givecash Command Where I Can Give My Money To Other Players But Unfortunately I Can't Find A Working One Where It Always Says [USAGE]: /givecash [playerid] [amount]
When I Do That It Keeps Sending This Same Message [USAGE]: /givecash [playerid] [amount]
Even The One From Samp WIKI Please Help Fast.
Re: /GiveCash Command -
kirostar - 01.07.2014
From Egypt too
أتفضل
Код:
CMD:givecash(playerid, params[])
{
new giveplayerid, amount, Message[128], pName16[MAX_PLAYER_NAME],pName17[MAX_PLAYER_NAME],Message1[128];
#define COLOR_RED 0xFF0000AA
#define COLOR_ORANGE 0xFF9500FF
if (sscanf(params, "ud", giveplayerid, amount)) SendClientMessage(playerid, COLOR_RED, "Usage: /givecash [playerid/partname] [amount]");
else if (!IsPlayerConnected(giveplayerid)) SendClientMessage(playerid, COLOR_RED, "Player Not Connected");
else if (giveplayerid == playerid) SendClientMessage(playerid, COLOR_RED, "You Cannot Send Money To Yourself!");
else if (amount > GetPlayerMoney(playerid)) SendClientMessage(playerid, COLOR_RED, "You Don't Have That Much!");
else if (amount > 500000) SendClientMessage(playerid, COLOR_RED, "You Cannot Send More Than $500000!");
else if (amount < 0) SendClientMessage(playerid, COLOR_RED,"Wrong Value!");
else
{
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
GetPlayerName(giveplayerid,pName1,MAX_PLAYER_NAME);
GivePlayerMoney(giveplayerid, amount);
GivePlayerMoney(playerid, -amount);
format(Message, sizeof(Message), "Received $%d From %s (%d)!",amount, pName, playerid);
SendClientMessage(giveplayerid,COLOR_ORANGE, Message);
format(Message1, sizeof(Message1), "Successfully Sent $%d To %s (%d)!",amount, pName1, giveplayerid);
SendClientMessage(playerid,COLOR_ORANGE, Message1);
}
return 1;
}
Re: /GiveCash Command -
itsCody - 01.07.2014
Cleaner command ^_^
pawn Код:
CMD:givecash(playerid, params[])
{
new ID, amount, string[128];
if(sscanf(params, "ui", ID, amount))
return SendClientMessage(playerid, -1, "Usage: /givecash [playerid] [amount]");
if(!IsPlayerConnected(ID))
return SendClientMessage(playerid, -1, "playerid not connected");
if(ID == playerid)
return SendClientMessage(playerid, -1, "unable to use command");
if(amount > GetPlayerMoney(playerid))
return SendClientMessage(playerid, -1, "invalid amount");
if(amount > 500000)
return SendClientMessage(playerid, -1, "max: 500k");
if(amount < 0)
return SendClientMessage(playerid, -1, "min: 1");
format(string, sizeof(string), "%s has given you $%i", PlayerName(playerid), amount);
SendClientMessage(ID, -1, string);
format(string, sizeof(string), "You sent $%i to %s!", amount, PlayerName(ID));
SendClientMessage(playerid, -1, string);
GivePlayerMoney(ID, amount);
GivePlayerMoney(playerid, -amount);
return 1;
}
stock PlayerName(playerid)
{
new name[24];
GetPlayerName(playerid, name, 24);
return name;
}