JohnDoe91286 Posted July 22, 2009 Posted July 22, 2009 I am trying to get the players blips on the minimap to change colour depending on which team they are.Why dosn't the code below work? function setBlipColor () local playerTeam = getPlayerTeam ( source ) if ( playerTeam == Police ) then setPlayerBlipColor ( 0, 0, 255 ) end addEventHandler ( "onPlayerSpawn, getRootElement(), setBlipColor )
DakiLLa Posted July 22, 2009 Posted July 22, 2009 (edited) What does the third line mean? in your case it means nothing. I think you wanted to check team name, then you should use 'getTeamName' The next code should works: function setPlayerBlipColor() local playerTeam = getPlayerTeam ( source ) if playerTeam then local teamName = getTeamName( playerTeam ) if teamName == "Police" then setPlayerBlipColor ( source, 0, 0, 255 ) --you missed 'source' in your code here, ive added it end end end addEventHandler ( "onPlayerSpawn", getRootElement(), setPlayerBlipColor ) Edited July 22, 2009 by Guest
Lordy Posted July 22, 2009 Posted July 22, 2009 Hmm.. No DaK, it wouldn't work. Firstly you define a function setPlayerBlipColor and then call it in the same function.. There's no setPlayerBlipColor function hardcoded in MTA, so you'd have to getAttachedElements, a loop and getElementType and then finally setBlipColor. And Callum's example is even more terrible.. You overwrite setBlipColour function and then call a nil value. Debugscript would have helped you, so please use it.
DakiLLa Posted July 22, 2009 Posted July 22, 2009 pft, i just copied his code, changed something in one place, but forgot to change it in another...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now