does it work?
#1

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

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
Reply
#3

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
}
Reply
#4

Yup, this should work just nice
Reply
#5

thx very much
Reply
#6

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)
Reply
#7

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

thank you very much +rep for you xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)