SA-MP Forums Archive
error 029: invalid expression, assumed zero - 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: error 029: invalid expression, assumed zero (/showthread.php?tid=423316)



error 029: invalid expression, assumed zero - N0FeaR - 17.03.2013

Can you guys see whats wrong here?

Код:
C:\Users\N0FeaR\Desktop\Gangwar\gamemodes\LSGTDM.pwn(192) : error 029: invalid expression, assumed zero

pawn Код:
}

SetPlayerTeamFromClass(playerid, classid)
{
    if (0<=classid<=3)
    {
        gTeam[playerid] = TEAM_GROVE;
    }
    else
    {
        gTeam[playerid] = TEAM_COPS;
    }
    line 192 else
    {
        gTeam[playerid] = TEAM_VAGOS;
    }
}



AW: error 029: invalid expression, assumed zero - Nero_3D - 17.03.2013

You cant put two else behind each other, how should that work ?


Re: AW: error 029: invalid expression, assumed zero - N0FeaR - 17.03.2013

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
You cant put two else behind each other, how should that work ?
That's true... so how should i do it?


Re: error 029: invalid expression, assumed zero - master2466 - 17.03.2013

Make it else if and then else.. I think


AW: error 029: invalid expression, assumed zero - Nero_3D - 17.03.2013

You need to use an else if between
pawn Код:
if(classid <= 3) {
    // classes from 0 - 3
} else if(classid <= 7) {
    // classes from 4 - 7
} else {
    // all other classes
}



Re: error 029: invalid expression, assumed zero - Patrick - 17.03.2013

Too late. but by the way here's some simple example that they way i do mine.

pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
    if(classid >= /*Grove classid here*/)
    {
        gTeam[playerid] = TEAM_GROVE;
    }
    if(classid >= /*Cop classid here*/)
    {
        gTeam[playerid] = TEAM_COPS;
    }
    if(classid >= /*Vagos classid here*/)
    {
        gTeam[playerid] = TEAM_VAGOS;
    }
}
PS: you can do Nero_3D or my ones. but it depends on you.


Re: error 029: invalid expression, assumed zero - N0FeaR - 17.03.2013

Thank you =)