I have followed the tutorial at wiki.sa-mp.com, and I have used ReturnUser, IsNumeric and strtok (although I may have used them incorrectly)
However, Pawno just wants to shut down when I compile.
Also, how do I set the commands to be available to use at the levels I require?
Here I'll make a quicker n' easier way..
All you have to do is make it save now.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], tmp[256], moneys, idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/nominate", true) == 0) if(Admin[playerid] > 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "[ ! ] USAGE: /nominate (playerid) (amount)");
return 1;
}
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "[ ! ] USAGE: /nominate (playerid) (amount)");
return 1;
}
moneys = strval(tmp);
if (IsPlayerConnected(giveplayerid))
{
if(moneys > Admin[playerid]) return scm(playerid,cr,"[ ! ] You cannot make someone a higher admin level than you!");
if(Admin[giveplayerid] > Admin[playerid]) return scm(playerid,cr,"[ ! ] You cannot nominate players who are a higher admin level than you!");
if(moneys == Admin[playerid]) return scm(playerid,cr,"[ ! ] You cannot nominate an admin to your admin level!");
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
Admin[giveplayerid] = moneys;
Save(giveplayerid);
PlayerPlaySound(giveplayerid, 1083, 0.0, 0.0, 0.0);
format(string, sizeof(string), "[ ! ] You have nominated %s to level '%d' admin", giveplayer, moneys);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "[ ! ] You have been nominated to level '%d' admin by %s.", moneys, sendername);
SendClientMessage(giveplayerid, COLOR_GREEN, string);
}
else {
format(string, sizeof(string), "[ ! ] %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
return 0;
}