Jump to content

Blip Colours


Recommended Posts

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 )

Link to post

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 by Guest
Link to post

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.

Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...