Need help with admin system
#1

hey guys i need help with my admin system, i got the admin Names and stuff ( but im not sure if their right )

but i made this:
Код:
	if(strcmp(cmdtext, "/givemegun", true) == 0) {
	if (PlayerInfo[playerid][pAdmin]> 1)//if(!IsPlayerAdmin(playerid))
	{
	SendClientMessage(playerid,0xFF0000AA,"You are not authoritized to use this command.");
	return 1;
	}
it dosent give me any error but if i use it IG without being an admin it works any ideas how i can make it that it wont (im not the best scripter but im learning so would be nice if i get help)

The Admin Names:
Код:
if (strcmp(cmdtext, "/admins", true) == 0)
	{
	if(IsPlayerConnected(playerid))
	{
		SendClientMessage(playerid, COLOR_ORANGE, " ");
  		SendClientMessage(playerid, COLOR_ORANGE, "-| ADMINS |-");
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if(PlayerInfo[i][pAdmin] >= 1 && PlayerInfo[i][pAdmin] < 1341)
				{
				new admtext[64];
				new sendername[MAX_PLAYER_NAME];
				new string[256];
			 	if(PlayerInfo[i][pAdmin] == 1) { admtext = "Level-1 Trial Administrator"; }
  				else if(PlayerInfo[i][pAdmin] == 2) { admtext = "Level-2 Administrator"; }
    			else if(PlayerInfo[i][pAdmin] == 3) { admtext = "Level-3 Master Administrator"; }
    			else if(PlayerInfo[i][pAdmin] == 4) { admtext = "Level-4 Lead Moderator"; }
    			else if(PlayerInfo[i][pAdmin] == 5) { admtext = "Level-5 Master Moderator"; }
				else if(PlayerInfo[i][pAdmin] == 6) { admtext = "Level-6 Head Administrator"; }
				else if(PlayerInfo[i][pAdmin] == 7)	{ admtext = "Level-7 Co-Owner"; }
				else if(PlayerInfo[i][pAdmin] == 8) { admtext = "level-8 Owner"; }
				else { admtext = "Gamemoderator"; }
				GetPlayerName(i, sendername, sizeof(sendername));
				format(string, 256, "%s ( %s )", sendername, admtext);
				SendClientMessage(playerid, COLOR_GREEN, string);
				}
			}
		}
	}
	return 1;
	}
im tihnking that it should be in /makeadmin or somethin but im not sure so im looking to get help from here ((Have been looking in ****** alot so yeah please help me)) Thank you for the time
Reply
#2

Код:
	if(strcmp(cmdtext, "/givemegun", true) == 0) {
	if (PlayerInfo[playerid][pAdmin]> 1)//if(!IsPlayerAdmin(playerid))
	{
	SendClientMessage(playerid,0xFF0000AA,"You are not authoritized to use this command.");
	return 1;
	}
From what I understand, you want to know why this works without being an admin. You have simply placed in the wrong operator, at:
Код:
if (PlayerInfo[playerid][pAdmin]> 1)
This '>' should be changed to '<' as your current one requires the player to be OVER admin level 1 to send the message saying they are not authorised. Swapping it with '<' will mean that if they are LOWER than admin level 1 (i.e 0 or below) then it will return with the message.
Reply
#3

Thanks worked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)