Answer please!!
#1

I'am scripting my own gamemode for the server i will create but i still didn't get the answer to my question.

I have 8 admin levels

(1) Server Moderator
(2) Junior Administrator
(3) Senior Administrator
(4) Head Administrator
(5) Community Manager
(6) Executive Director
(7) Community Co-Owner
( Community Owner

So, my /makeadmin command is

Код:
CMD:makeadmin(playerid, params[]) {

    if(pInfo[playerid][Admin] < 4)
        return SendClientMessage(playerid, GREY, "You are not authorized to use that command.");

    new
        targetid,
        AdminLevel
    ;

    if(sscanf(params, "ui", targetid, AdminLevel))
        return SendClientMessage(playerid, GREY, "USAGE: /makeadmin (playerid) (level)");

    if(!IsPlayerConnected(targetid))
        return SendClientMessage(playerid, GREY, "ERROR: player is not conencted.");

    if(AdminLevel > 8)
        return SendClientMessage(playerid, GREY, "LEVELS available: 1 to 8.");

    new
        tname[MAX_PLAYER_NAME],
        pname[MAX_PLAYER_NAME]
    ;

    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(targetid, tname, sizeof(tname));

    new
        str[101]
    ;

    format(str, sizeof(str), "Administrator %s has set your admin level to %d, %s", pname, AdminLevel, (AdminLevel > pInfo[playerid][Admin]) ? ("congratulations on your promotion!") : ("improve yourself where possible!"));
    SendClientMessage(targetid, RED, str);
    format(str, sizeof(str), "You have set %s\'s admin level to %d", tname, AdminLevel);
    SendClientMessage(playerid, RED, str);

    pInfo[targetid][Admin] = AdminLevel;
    return true;
}
So only Admin Level 5 or above are only allowed to use /makeadmin, then how can i make Admin Level 6 avoid making someone admin level 7, how to avoid Admin Level 7 to make someone Admin Level 8.

And how can i allow Admin Level 4 to use /makeadmin, because when doing "< 4" It only allows Admin Level 5s to execute the command.
Reply
#2

Try this
Код:
if(pInfo[playerid][Admin] == 5 && AdminLevel > 5) // code
if(pInfo[playerid][Admin] == 6 && AdminLevel > 6) // code
if(pInfo[playerid][Admin] == 7 && AdminLevel > 7) // code
Reply
#3

Quote:
Originally Posted by Godey
Посмотреть сообщение
Try this
Код:
if(pInfo[playerid][Admin] == 5 && AdminLevel > 5) // code
if(pInfo[playerid][Admin] == 6 && AdminLevel > 6) // code
if(pInfo[playerid][Admin] == 7 && AdminLevel > 7) // code
Explain each line please, Thank in advance bro!!
Reply
#4

Guided:
Код:
if(pInfo[playerid][Admin] == 5 && AdminLevel > 5) // if the player is level 5 and he's trying to set above his level
{
    SendClientMessage(playerid, COLOR_RED, "You can't the player's level above your level!"); // warns the admin if he does that     
}
if(pInfo[playerid][Admin] == 6 && AdminLevel > 6) // if the player is level 6 and he's trying to set above his level
{
    SendClientMessage(playerid, COLOR_RED, "You can't the player's level above your level!"); // same    
}
if(pInfo[playerid][Admin] == 7 && AdminLevel > 7) // if the player is level 7 and he's trying to set above his level
{
    SendClientMessage(playerid, COLOR_RED, "You can't the player's level above your level!"); // same        
}
No idea where to put this?
Put it before these lines
Код:
new
        tname[MAX_PLAYER_NAME],
        pname[MAX_PLAYER_NAME]
    ;
All the best
Reply
#5

Can i do this?

Код:
if(pInfo[playerid][Admin] == 5 && AdminLevel > 5)
        return SendClintMessage(playerid, GREY, "You cannot promote someone above your rank.");
Reply
#6

Yes you can!
This will also work:
Код:
if(pInfo[playerid][Admin] == 5 && AdminLevel > 5) return SendClintMessage(playerid, GREY, "You cannot promote someone above your rank.");
Just take care of indentation!
Reply
#7

How can i stop someone from promoting himself and promoting/demoting a higher ranker than him/her.
Reply
#8

Checker for self-promoting/demoting:
Код:
if(playerid == targetid) // Checks if the playerid and targetid(the person to get promoted) is equal.
     return SendClintMessage(playerid, GREY, "You can't promote/demote yourself!");
Checker for promote/demote:
I've already told you for promoting
and for demoting? it's the same!
the only difference is /demoteadmin with same if() { } checker
Reply
#9

Sorry for requesting help all the time, i just don't know how to script well.

If only Admin Level 4 and above can /makehelper someone, and the ranks are 1 - 5. I made someone Helper Level 5.

How can both Helper Level 5 and Admin Level 4 execute the command, two different ranks in the same command.
Reply
#10

Quote:

Sorry for requesting help all the time, i just don't know how to script well.

That is what the "Scripting Help" section is made for
Well since you agreed the fact that you are a trainee, I will explain it

Код:
if(pInfo[playerid][Admin] < 4)
In this line of your command, you are checking that is your level less than 4.. if true it will send a message, if it's false then the command will work!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)