SA-MP Forums Archive
does it work? - 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: does it work? (/showthread.php?tid=364134)



does it work? - dalkgamler - 29.07.2012

pawn Код:
#define TEAM
public OnPlayerUpdate(playerid)
{
    if defined TEAM
    {
        //something that i would add later
    }
}



Re: does it work? - Misiur - 29.07.2012

Nope, preprocessor is the one who checks defines:

pawn Код:
#define TEAM
public OnPlayerUpdate(playerid)
{
    #if defined TEAM
        //something that i would add later
    #endif
}
Remember that there is no variable local scope, you have to add own brackets to preserve it


AW: does it work? - dalkgamler - 29.07.2012

ok give me an example what you mean
do you mean this
pawn Код:
#define TEAM
public OnPlayerUpdate(playerid)
{
    #if defined TEAM
    if(GetPlayerTeam(playerid)==TEAM)
    {
            //something that i would add later
    }
    #else
    if(something)
    {

    }
    #endif
}



Re: does it work? - Misiur - 29.07.2012

Yup, this should work just nice


AW: does it work? - dalkgamler - 29.07.2012

thx very much


AW: does it work? - dalkgamler - 29.07.2012

ok now i have another problem
pawn Код:
029 Area_51_gates   68  "invalid expression, assumed zero"
029 Area_51_gates   68  "invalid expression, assumed zero"
pawn Код:
if(GetPlayerTeam(playerid)==TEAM||GetPlayerTeam(playerid)==TEAM2)



Re: does it work? - MegadreamsBE - 29.07.2012

Well you defined TEAM but it doesn't contain anything. So it can't be used in a IF.


AW: does it work? - dalkgamler - 29.07.2012

thank you very much +rep for you xD