CMD:donate(playerid, params[]) { if(IsPlayerConnected(playerid)) { new moneys, string[256]; tmp = strtok(params, idx); if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /donate [amount]"); if(PlayerInfo[playerid][pLocal] == 106) return SendClientMessage(playerid, COLOR_GREY, "You can't use this comand right here."); moneys = strval(tmp); if(moneys < 0 || moneys > 1000000) return SendClientMessage(playerid, COLOR_GREY, "You can't donate less than $1.000 or more than $1.000.000!"); if(GetPlayerMoney(playerid) < moneys) return SendClientMessage(playerid, COLOR_GREY, "Transaction amount is invalid."); GivePlayerMoney(playerid, -moneys); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s donated %s!",sendername, FormatMoney(moneys)); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); PayLog(string); format(string, sizeof(string), "~w~Thank you for your donation of~n~~r~~h~%s~w~, ~b~~h~%s ~w~!",sendername, FormatMoney(moneys)); GameTextForPlayer(playerid, string, 3000, 5); format(string, sizeof(string), "* %s donated %s to The Mayor.",sendername, FormatMoney(moneys)); SendFamilyMessage(7, COLOR_YAKUZA, string); } return 1; }
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /donate [amount]");
CMD:donate(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new moneys, string[256];
if(sscanf(params,"i",moneys)) return SendClientMessage(playerid, -1, "USAGE: /donate [amount]");
if(PlayerInfo[playerid][pLocal] == 106) return SendClientMessage(playerid, COLOR_GREY, "You can't use this comand right here.");
if(moneys < 0 || moneys > 1000000) return SendClientMessage(playerid, COLOR_GREY, "You can't donate less than $1.000 or more than $1.000.000!");
if(GetPlayerMoney(playerid) < moneys) return SendClientMessage(playerid, COLOR_GREY, "Transaction amount is invalid.");
GivePlayerMoney(playerid, -moneys);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s donated %s!",sendername, FormatMoney(moneys));
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
PayLog(string);
format(string, sizeof(string), "~w~Thank you for your donation of~n~~r~~h~%s~w~, ~b~~h~%s ~w~!",sendername, FormatMoney(moneys));
GameTextForPlayer(playerid, string, 3000, 5);
format(string, sizeof(string), "* %s donated %s to The Mayor.",sendername, FormatMoney(moneys));
SendFamilyMessage(7, COLOR_YAKUZA, string);
}
return 1;
}
#include <sscanf2>
try using sscanf
pawn Код:
|
if(sscanf(params,"i",moneys)) return SendClientMessage(playerid, -1, "USAGE: /donate [amount]");
if(!sscanf(params,"i",moneys)) return SendClientMessage(playerid, -1, "USAGE: /donate [amount]");
use that cmd but replace
pawn Код:
pawn Код:
|
if(sscanf(params,"i",moneys)) return SendClientMessage(playerid, -1, "USAGE: /donate [amount]");