Why wont this extremely simple code 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: Why wont this extremely simple code work ? (
/showthread.php?tid=490049)
Why wont this extremely simple code work ? -
AIped - 25.01.2014
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.
Re: Why wont this extremely simple code work ? - Patrick - 25.01.2014
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;
}
Re: Why wont this extremely simple code work ? -
AIped - 25.01.2014
ah stupid mistake! that should do it thanks