Noki Posted December 19, 2014 Share Posted December 19, 2014 local blip = {} function destroyBlipsAttachedTo( player ) -- Keep this just in case local attached = getAttachedElements( player ) if ( attached ) then for k, element in pairs ( attached ) do if getElementType( element ) == "blip" then destroyElement( element ) end end end end function applyBlips() for k, player in pairs ( getElementsByType( "player" ) ) do tR, tG, tB = getTeamColor( getPlayerTeam( player ) ) tR = tonumber( tR ) tR = tonumber( tG ) tR = tonumber( tB ) if not blip[player] then blip[player] = createBlipAttachedTo( player, 0, 2, tR, tG, tB, 255 ) else setBlipColor( blip[player], tR, tG, tB, 255 ) end end end addEventHandler( "onResourceStart", resourceRoot, applyBlips ) setTimer( applyBlips, 500, 0 ) function createBlips() if ( source ) then player = source end tR, tG, tB = getTeamColor( getPlayerTeam( player ) ) tR = tonumber( tR ) tR = tonumber( tG ) tR = tonumber( tB ) if not blip[player] then blip[player] = createBlipAttachedTo( player, 0, 2, tR, tG, tB, 255 ) else setBlipColor( blip[player], tR, tG, tB, 255 ) end end addEventHandler( "onPlayerSpawn", root, createBlips ) function destroyBlip() if ( source ) then player = source end if ( blip[player] and isElement( blip[player] ) ) then destroyElement( blip[player] ) blip[player] = nil end end addEventHandler( "onPlayerQuit", root, destroyBlip ) addEventHandler( "onPlayerWasted", root, destroyBlip ) Hello, For some reason, when my team is a greyscale colour (white, black, grey, silver etc) the blip displays correctly. But when my team is a colourful colour (like red, blue or green etc) the player blips display wrong. I'm not sure why it's doing this. My debug is completely clear and I honestly don't know what I'm doing wrong. The colour changes on team change (the 500ms timer and all) but the colour is incorrect. When I switch to a team (RGB: 255, 255, 0) it wouldn't display yellow, but green for some reason. Changing to a (RGB: 255, 0, 0) team makes my blip change to black. I don't have any conflicting resources (playerblips or customblips). Any help would be appreciated. Link to comment
johny46 Posted December 19, 2014 Share Posted December 19, 2014 Have a look at lines 18. and 19. And then 34. and 35. too. Link to comment
Noki Posted December 19, 2014 Author Share Posted December 19, 2014 Oh my god... I just... I spent hours trying to fix it... Haha, thank you anyway man. Link to comment
Castillo Posted December 19, 2014 Share Posted December 19, 2014 You must remove these lines, since getTeamColor already returns numbers, so there's no need to convert numbers to numbers. Link to comment
johny46 Posted December 19, 2014 Share Posted December 19, 2014 You must remove these lines. I wouldn't say he absolutely has to remove these, but indeed, these are a bit pointless. Link to comment
Noki Posted December 20, 2014 Author Share Posted December 20, 2014 I put them in there before when the function always returned 0. The tonumber seemed to fix it then. But I removed them and it works fine now. Thank you once again. Link to comment
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