Makeadmin - Makehelper
#1

Hi, I'm lvl 99999 on my server but when I try to /makeadmin or /makehelper it says " You are not authorized to use that command" I don't know why it says that even though if(PlayerInfo[playerid][pAdmin] >= 99999) Please help

Code /makeadmin

Код:
	if(strcmp(cmd, "/makeadmin", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(makeadminon[playerid] == 0)
			{
				SendClientMessage(playerid, COLOR_WHITE, " You are not authorized to use that command");
				return 1;
			}
			if(PlayerInfo[playerid][pAdmin] >= 99999)
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level]");
					return 1;
				}
				new para1;
				new level;
				para1 = ReturnUser(tmp);
				tmp = strtok(cmdtext, idx);
				level = strvalEx(tmp);
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
						GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						PlayerInfo[para1][pAdmin] = level;
						printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
						format(string, sizeof(string), "   You have been promoted to a level %d admin by %s", level, sendername);
						SendClientMessage(para1, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "   You have promoted %s to a level %d admin.", giveplayer,level);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					}
				}
			}
		}
		return 1;
	}
makehelper

Код:
    if(strcmp(cmd, "/makehelper", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerInfo[playerid][pHelper] >= 2 || PlayerInfo[playerid][pAdmin] >= 99999)
	        {
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehelper [playerid/PartOfName] [level(1-2)]");
					return 1;
				}
				new para1;
				new level;
				para1 = ReturnUser(tmp);
				tmp = strtok(cmdtext, idx);
				level = strval(tmp);
				if(IsPlayerConnected(para1))
	   			{
       				if(para1 != INVALID_PLAYER_ID)
       				{
						GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						PlayerInfo[para1][pHelper] = level;
						printf("AdmCmd: %s has made %s a level %d helper", sendername, giveplayer, level);
						format(string, sizeof(string), "   You have been promoted to a level %d helper by %s", level, sendername);
						SendClientMessage(para1, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "   You have promoted %s to a level %d helper.", giveplayer,level);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "You are authorized to use this command.");
			}
		}
		return 1;
	}
Reply
#2

Did you make this or is it from a Filterscript?
Reply
#3

Neither, someone else made it.
Reply
#4

pawn Код:
if(makeadminon[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_WHITE, " You are not authorized to use that command");
                return 1;
            }
Remove this, its useless, why check for this if it checks for admin?

New makeadmin

pawn Код:
if(strcmp(cmd, "/makeadmin", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strvalEx(tmp);
            if(IsPlayerConnected(para1))
            {
                if(PlayerInfo[playerid][pAdmin] >= 99999)
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[para1][pAdmin] = level;
                        printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
                        format(string, sizeof(string), "   You have been promoted to a level %d admin by %s", level, sendername);
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "   You have promoted %s to a level %d admin.", giveplayer,level);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    }
                }
            }
        }
        return 1;
    }
New makehelper

pawn Код:
if(strcmp(cmd, "/makehelper", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {

            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makehelper [playerid/PartOfName] [level(1-2)]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if(IsPlayerConnected(para1))
            {
                if(PlayerInfo[playerid][pHelper] >= 2 || PlayerInfo[playerid][pAdmin] >= 99999)
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[para1][pHelper] = level;
                        printf("AdmCmd: %s has made %s a level %d helper", sendername, giveplayer, level);
                        format(string, sizeof(string), "   You have been promoted to a level %d helper by %s", level, sendername);
                        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "   You have promoted %s to a level %d helper.", giveplayer,level);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "You are authorized to use this command.");
            }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)