[Help Some Thing Wrong]
#1

Hey Guys I Have Made A Admin System And I Added [padmin] But Any One Can Still Make There Self Admin Could You Help So People Can't Join My Game And Make There Self Admin. Here Is The Code-

Код:
	if(strcmp(cmd, "/makeadmin", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_RED, "USAGE: /makeadmin [playerid/PartOfName] [Admin Rank]");
				SendClientMessage(playerid, COLOR_YELLOW, "(0) Remove Admin Status");
				SendClientMessage(playerid, COLOR_YELLOW, "(1) 7");
				SendClientMessage(playerid, COLOR_YELLOW, "(2) 6");
				SendClientMessage(playerid, COLOR_YELLOW, "(3) 6");
				SendClientMessage(playerid, COLOR_YELLOW, "(4) 5");
				SendClientMessage(playerid, COLOR_YELLOW, "(1337) 4");
			    SendClientMessage(playerid, COLOR_YELLOW, "(1338) 3");
			    SendClientMessage(playerid, COLOR_YELLOW, "(1339) s mager");
			    SendClientMessage(playerid, COLOR_YELLOW, "(99999) Main admin");
				return 1;
			}
			new para1;
			new level;
			para1 = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			level = strval(tmp);
			if(PlayerInfo[playerid][pAdmin] >= 99999 || strcmp(sendername, "Jess_Milward", true) == 0)
			{
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
						GetPlayerName(para1, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						PlayerInfo[para1][pAdmin] = level;
						printf("{AA3333}AdmCmd{FFFF00}: %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);
					}
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
Reply
#2

Post the Whole command.
Reply
#3

Use IsPlayerAdmin?
Reply
#4

Quote:
Originally Posted by Avi57
Посмотреть сообщение
Post the Whole command.
that is whole command and where would i put isplayeradmin
Reply
#5

pawn Код:
if(strcmp(cmd, "/makeadmin", true) == 0)
{
            if(IsPlayerAdmin(playerid) return SendClientMessage(playerid, -1, "You need to Be Admin to use this command");
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_RED, "USAGE: /makeadmin [playerid/PartOfName] [Admin Rank]");
                SendClientMessage(playerid, COLOR_YELLOW, "(0) Remove Admin Status");
                SendClientMessage(playerid, COLOR_YELLOW, "(1) 7");
                SendClientMessage(playerid, COLOR_YELLOW, "(2) 6");
                SendClientMessage(playerid, COLOR_YELLOW, "(3) 6");
                SendClientMessage(playerid, COLOR_YELLOW, "(4) 5");
                SendClientMessage(playerid, COLOR_YELLOW, "(1337) 4");
                SendClientMessage(playerid, COLOR_YELLOW, "(1338) 3");
                SendClientMessage(playerid, COLOR_YELLOW, "(1339) s mager");
                SendClientMessage(playerid, COLOR_YELLOW, "(99999) Main admin");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if(PlayerInfo[playerid][pAdmin] >= 99999 || strcmp(sendername, "Jess_Milward", true) == 0)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[para1][pAdmin] = level;
                        printf("{AA3333}AdmCmd{FFFF00}: %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);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
Reply
#6

wont compile found tis error

C:\Users\liam\Desktop\MRPL New\gamemodes\mrpl.pwn(69643) : error 001: expected token: ")", but found "return"
Reply
#7

Missed a ) this code should work

pawn Код:
if(strcmp(cmd, "/makeadmin", true) == 0)
{
            if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You need to Be Admin to use this command");
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_RED, "USAGE: /makeadmin [playerid/PartOfName] [Admin Rank]");
                SendClientMessage(playerid, COLOR_YELLOW, "(0) Remove Admin Status");
                SendClientMessage(playerid, COLOR_YELLOW, "(1) 7");
                SendClientMessage(playerid, COLOR_YELLOW, "(2) 6");
                SendClientMessage(playerid, COLOR_YELLOW, "(3) 6");
                SendClientMessage(playerid, COLOR_YELLOW, "(4) 5");
                SendClientMessage(playerid, COLOR_YELLOW, "(1337) 4");
                SendClientMessage(playerid, COLOR_YELLOW, "(1338) 3");
                SendClientMessage(playerid, COLOR_YELLOW, "(1339) s mager");
                SendClientMessage(playerid, COLOR_YELLOW, "(99999) Main admin");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if(PlayerInfo[playerid][pAdmin] >= 99999 || strcmp(sendername, "Jess_Milward", true) == 0)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        PlayerInfo[para1][pAdmin] = level;
                        printf("{AA3333}AdmCmd{FFFF00}: %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);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)