SA-MP Forums Archive
Were to put this? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Were to put this? (/showthread.php?tid=247781)



Were to put this? - Antonio144 - 10.04.2011

HI. Need Help

I don't know were to put this:
PHP код:
            if(GetPlayerWantedLevel(playerid) == && GetPlayerWantedLevel(playerid) == 2)
            {
                
SetPlayerColor(playeridBOJA_ZUTA);
            }
            else if(
GetPlayerWantedLevel(playerid) == 3)
            {
                
SetPlayerColor(playeridBOJA_NARANDASTA);
            }
            else if(
GetPlayerWantedLevel(playerid) == && GetPlayerWantedLevel(playerid) == 5)
            {
                
SetPlayerColor(playeridBOJA_CRVENA);
            }
            else if(
GetPlayerWantedLevel(playerid) >= )
            {
                
SetPlayerColor(playeridBOJA_CRNA);
            } 
Anybody know were?

Thanks!!


Re: Were to put this? - aircombat - 10.04.2011

well dude we don't know what u want to do that code and u shouldnt just copy and paste u should start by learning basics with http://wiki.sa-mp.com


Re: Were to put this? - Mean - 10.04.2011

This is a TOTAL copy, but, if you really want it to update all the time, put it under OnPlayerUpdate( playerid ).

I am assuming you are using a GodFather edit.


Re: Were to put this? - Antonio144 - 10.04.2011

@aircombat I want it to change player color if he has wanted level. I know the basics

@Mean NO its not a copy I wrote it I just don't know were to put it and i'm not using godfather edit
and btw thanks it worked!

ps. godfather sucks


Re: Were to put this? - Babul - 10.04.2011

this action can never get triggered, coz GetPlayerWantedLevel will return either 1 OR 2. so the logical AND ( && ) is making it impossible:
Код:
            if(GetPlayerWantedLevel(playerid) == 1 && GetPlayerWantedLevel(playerid) == 2)
a small fix, the logical OR ( || ) will do the trick:
Код:
            if(GetPlayerWantedLevel(playerid) == 1 || GetPlayerWantedLevel(playerid) == 2)
hm... and i guess this is supposed to be in the OnPlayerSpawn(playerid); coz its the only callback i can imagine where you need to set a players color... ah, since there are wanted levels, there are crimes to commit - seek all callbacks where a player can "gain" some wanted levels... like in the OnPlayerDeath() after setting the WantedLevel for the killerid, in a Command like /rob /rape /infect, or even the OnPlayerStateChange() in some certain vehiclemodel ids...