Scripting help.
#1

Hey guys, I have started on my roleplay script. This will be my second release. I just can't figure out how to make an admin system. I have made register/login dialog saying the fallowing: pPass, pCash, pAdmin, pKills, pDeaths. Now I'm wondering how to make 10 Admin levels. Also to where when they type /a It says their admin rank not just Admin. Same with /o Thanks if you guys can help me. Really appreciate it.
Reply
#2

Example:
pawn Код:
stock AdminRank(playerid)
{
    if(pInfo[PlayerInfo][pAdmin] >= 1)
    {
        new arank[32];
        if(PlayerInfo[playerid][Rank] == 1) format(pdrank, sizeof(pdrank), "Level 1");
        else if(PlayerInfo[playerid][pAdmin] == 2) format(pdrank, sizeof(pdrank), "Level 2");
        else if(PlayerInfo[playerid][pAdmin] == 3) format(pdrank, sizeof(pdrank), "Level 3");
        else if(PlayerInfo[playerid][pAdmin] == 4) format(pdrank, sizeof(pdrank), "Level 4");
        else if(PlayerInfo[playerid][pAdmin] == 5) format(pdrank, sizeof(pdrank), "Level 5");
        else if(PlayerInfo[playerid][pAdmin] == 6) format(pdrank, sizeof(pdrank), "Level 6");
        else if(PlayerInfo[playerid][pAdmin] == 7) format(pdrank, sizeof(pdrank), "Level 7");
        else if(PlayerInfo[playerid][pAdmin] == 8) format(pdrank, sizeof(pdrank), "Level 8");
        else if(PlayerInfo[playerid][pAdmin] == 9) format(pdrank, sizeof(pdrank), "Level 9");
        else if(PlayerInfo[playerid][pAdmin] == 10) format(pdrank, sizeof(pdrank), "Level 10");
    }
    return arank;
}
// USAGE
new str[128];
format(str,sizeof(str),"My Rank: %s",AdminRank(playerid));
Reply
#3

Quote:
Originally Posted by Infinity90
Посмотреть сообщение
Example:
pawn Код:
stock AdminRank(playerid)
{
    if(pInfo[PlayerInfo][pAdmin] >= 1)
    {
        new arank[32];
        if(PlayerInfo[playerid][Rank] == 1) format(pdrank, sizeof(pdrank), "Level 1");
        else if(PlayerInfo[playerid][pAdmin] == 2) format(pdrank, sizeof(pdrank), "Level 2");
        else if(PlayerInfo[playerid][pAdmin] == 3) format(pdrank, sizeof(pdrank), "Level 3");
        else if(PlayerInfo[playerid][pAdmin] == 4) format(pdrank, sizeof(pdrank), "Level 4");
        else if(PlayerInfo[playerid][pAdmin] == 5) format(pdrank, sizeof(pdrank), "Level 5");
        else if(PlayerInfo[playerid][pAdmin] == 6) format(pdrank, sizeof(pdrank), "Level 6");
        else if(PlayerInfo[playerid][pAdmin] == 7) format(pdrank, sizeof(pdrank), "Level 7");
        else if(PlayerInfo[playerid][pAdmin] == 8) format(pdrank, sizeof(pdrank), "Level 8");
        else if(PlayerInfo[playerid][pAdmin] == 9) format(pdrank, sizeof(pdrank), "Level 9");
        else if(PlayerInfo[playerid][pAdmin] == 10) format(pdrank, sizeof(pdrank), "Level 10");
    }
    return arank;
}
// USAGE
new str[128];
format(str,sizeof(str),"My Rank: %s",AdminRank(playerid));
Where do i place this in the script? Sorry for being so nubish. Just trying to learn.
Reply
#4

Well you only need the stock, place it at the bottem
Reply
#5

Learn to use switch();

pawn Код:
switch(PlayerInfo[playerid][Rank])
{
    case 1: format blaba...
    case 2: format blabla...
}
Reply
#6

Quote:
Originally Posted by Infinity90
Посмотреть сообщение
Well you only need the stock, place it at the bottem
Nevermind, I'm dumb lol. Thanks alot for the help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)