SA-MP Forums Archive
Scripting help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Scripting help. (/showthread.php?tid=409371)



Scripting help. - Adrick - 21.01.2013

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.


Re: Scripting help. - Infinity90 - 21.01.2013

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));



Re: Scripting help. - Adrick - 21.01.2013

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.


Re: Scripting help. - Infinity90 - 21.01.2013

Well you only need the stock, place it at the bottem


Re: Scripting help. - Djole1337 - 21.01.2013

Learn to use switch();

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



Re: Scripting help. - Adrick - 21.01.2013

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