Scripting help please
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
jessejanssen you were so close - the description of why "else"should be used was spot on, then you used "switch" and got it all wrong! The original code had ">=", yours is equivalent to "==".
I'm not going to argue or anything but as you can see his code:
pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 1) format(string,sizeof(string),"(( {FFFFFF}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
if(PlayerInfo[playerid][pAdmin] >= 2) format(string,sizeof(string),"(( {FFD400}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
if(PlayerInfo[playerid][pAdmin] >= 3) format(string,sizeof(string),"(( {800080}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
if(PlayerInfo[playerid][pAdmin] >= 4) format(string,sizeof(string),"(( {FFD400}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
if(PlayerInfo[playerid][pAdmin] >= 5) format(string,sizeof(string),"(( {00FF00}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
if(PlayerInfo[playerid][pAdmin] >= 6) format(string,sizeof(string),"(( {0000FF}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
if(PlayerInfo[playerid][pAdmin] >= 7) format(string,sizeof(string),"(( {FF0000}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
It will also do things when numbers are equal, just in a code using way. I see how you mean the bigger then point but for example if PlayerInfo[playerid][pAdmin] == 1 ( Or higher. ) it sets the name color to {FFFFFF} but if it gets == 2 ( Or higher ) it will set it to {FFD400} what will cause the first if statement ( if(PlayerInfo[playerid][pAdmin] >= 1 ) will only be usefully applied when it is actually exactly 1. And so you can continue with all the else if statements, there is however indeed a mistake in my code, but I'd fix it like this:
pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 6)
    {
    switch(PlayerInfo[playerid][pAdmin])
        {
        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);
            }
        }
    }
else if(PlayerInfo[playerid][pAdmin] >= 7)
    {
    format(string,sizeof(string),"(( {FF0000}%s {FFFFFF} %s: %s ))", RPN(playerid), params);
    }
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: 1 Guest(s)