Scripting help please
#9

Quote:
Originally Posted by ******
Посмотреть сообщение
That is a VERY good point!



You could also do:

pawn Код:
switch(PlayerInfo[playerid][pAdmin])
{
    case 0:
    {
        // Do nothing.
    }
    case 1:
    {
        format(string,sizeof(string),"(( {FFFFFF}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
    }
    case 2:
    {
        format(string,sizeof(string),"(( {FFD400}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
    }
    case 3:
    {
        format(string,sizeof(string),"(( {800080}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
    }
    case 4:
    {
        format(string,sizeof(string),"(( {FFD400}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
    }
    case 5:
    {
        format(string,sizeof(string),"(( {00FF00}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
    }
    case 6:
    {
        format(string,sizeof(string),"(( {0000FF}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
    }
    default: // 7 .. cellmax:
    {
        format(string,sizeof(string),"(( {FF0000}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
    }
}
Assuming you know the admin level will never go negative (easy enough in a given script). Or just use an array.

Edit: As a side note, you can write this:

pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 6)
As:

pawn Код:
if (1 <= PlayerInfo[playerid][pAdmin] <= 6)
In PAWN.
I just learned two new things haha! Thanks for telling me this and I guess the topic creater has his help too!

Best regards,
Jesse
Reply


Messages In This Thread
Scripting help please - by LoganStone - 14.01.2013, 22:12
Respuesta: Scripting help please - by Fabio11 - 14.01.2013, 22:32
Re: Scripting help please - by CoaPsyFactor - 14.01.2013, 22:42
Re: Scripting help please - by LoganStone - 14.01.2013, 22:43
Re: Scripting help please - by CoaPsyFactor - 14.01.2013, 22:44
Re: Scripting help please - by jessejanssen - 14.01.2013, 23:42
Re: Scripting help please - by CoaPsyFactor - 15.01.2013, 00:28
Re: Scripting help please - by jessejanssen - 15.01.2013, 11:50
Re: Scripting help please - by jessejanssen - 15.01.2013, 12:56

Forum Jump:


Users browsing this thread: 2 Guest(s)