Why wont this extremely simple code work ?
#1

I made this very simple code;
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(GetPlayerSkin(playerid)== 287 || 73 || 191 )
    {
        SetPlayerTeam(playerid,1);//team usa
        SetPlayerColor(playerid,COLOR_LIGHTBLUE);
    }
    if(GetPlayerSkin(playerid)== 179 ||142 ||121 )
    {
        SetPlayerTeam(playerid,2);// team iraq
        SetPlayerColor(playerid,COLOR_RED);
    }
    return 1;
}
For some reason a player always is team 2 . I dont understand why onplayerspawn wont check skins for team 1.
Reply
#2

Just look at the SA-MP-WIKI how to use || operator

pawn Код:
public OnPlayerSpawn(playerid)
{
    new
        skin = GetPlayerSkin(playerid);

    if(skin == 287 || skin == 73 || skin == 191 )
    {
        SetPlayerTeam(playerid,1);//team usa
        SetPlayerColor(playerid,COLOR_LIGHTBLUE);
    }
    if(skin == 179 || skin == 142 || skin == 121 )
    {
        SetPlayerTeam(playerid,2);// team iraq
        SetPlayerColor(playerid,COLOR_RED);
    }
    return 1;
}
Reply
#3

ah stupid mistake! that should do it thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)