Admin Script
#1

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?
Reply
#2

Here I'll make a quicker n' easier way..

Top of script:

Код:
new Admin[MAX_PLAYERS];
now in any command add this:

Код:
if(Admin[playerid] < LEVELWANTED) return 0; // checks if players admin lvl is under the amount wanted else it says its not a command (so normal players dont figure out about it ;P
All you have to do is make it save now.

Extra: /nominate command

Код:
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;
}
Change as needed.
Reply
#3

Thanks, but it still wants to shut down when I compile it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)