29.09.2018, 06:49
PHP код:
CMD:givecash(playerid, params[])
{
new targetid, amount, name[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME], string[128], string1[128];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(targetid, tname, sizeof(tname));
if (sscanf(params, "ud", targetid, amount)) SendClientMessage(playerid, -1, "SERVER(S): /givecash <playerid/name> <amount>");
else if(!IsPlayerConnected(targetid) || targetid == playerid) return SendClientMessage(playerid, -1, "SERVER{ff0000}(E){FFFFFF}: Target ID is offline/yourself.");
else if (amount > GetPlayerMoney(playerid)) SendClientMessage(playerid, -1, "SERVER{ff0000}(E){FFFFFF}: You don't have enough money to send.");
else if (amount > 100000) SendClientMessage(playerid, -1, "SERVER{ff0000}(E){FFFFFF}: You can't send more than $100,000 at once!");
else if (amount < 1) SendClientMessage(playerid, -1, "SERVER{ff0000}(E){FFFFFF}: Your amount value should be between 1 to 100,000.");
else
{
GivePlayerMoney(targetid, amount);
GivePlayerMoney(playerid, -amount);
format(string, sizeof(string), "~g~+%d$", amount);
GameTextForPlayer(playerid, string, 3000, 1);
format(string, sizeof(string), "- {FFF2E7}%s(%d) has sent you '%d$'.", name, playerid, amount);
SendClientMessage(targetid, -1, string);
format(string, sizeof(string), "~r~-%d$", amount);
GameTextForPlayer(playerid, string, 3000, 1);
format(string1, sizeof(string1), "- {FFF2E7}You've sent '%d$' to %s(%d)", amount, tname, targetid);
SendClientMessage(playerid, -1, string1);
}
return 1;
}
- You've sent Peyote (0) 1$.
- Peyote (0) has sent you 100$.
Log (from ID 0):
- Airmesh(1) has sent you 1$.
- You've sent Peyote(1) 1$.
ID is showing correctly but name is having problems from ID 0.