Jacob Lenn Posted July 31, 2013 Posted July 31, 2013 Hello i wanna create blips with color like palyer's nametag color. And i wanna make police invisible. I made some codes but it didn't work anyway and i'm pretty sure that i'm making it in bad way.
Rockero Posted August 1, 2013 Posted August 1, 2013 Hello i wanna create blips with color like palyer's nametag color. And i wanna make police invisible. I made some codes but it didn't work anyway and i'm pretty sure that i'm making it in bad way. If u need help u have to post u code... Maybe u can find something usefull in the "search" Good luck.
Jacob Lenn Posted August 1, 2013 Author Posted August 1, 2013 I made this local blip = { } addEventHandler ( "onPlayerSpawn", root, function ( ) if ( not isElement ( blip [ source ] ) ) then blip [ source ] = createBlipAttachedTo ( source ) end local theTeam = getPlayerTeam ( source ) if ( not theTeam ) then return end local r, g, b = getTeamColor ( theTeam ) setPlayerNametagColor ( source, r, g, b ) setBlipColor ( blip [ source ], r, g, b, 255 ) end ) addEventHandler ( "onResourceStart", resourceRoot, function () for k, v in ipairs ( getElementsByType("player") ) do if ( not isElement ( blip [ v ] ) ) then blip [ v ] = createBlipAttachedTo ( v ) end local theTeam = getPlayerTeam ( v ) if (not theTeam) then return end local r, g, b = getTeamColor ( theTeam ) setPlayerNametagColor ( v, r, g, b ) setBlipColor ( blip [ v ], r, g, b, 255 ) end ) addEventHandler ( "onPlayerQuit", root, function ( ) if isElement ( blip [ source ] ) then destroyElement ( blip [ source ] ) end end ) But it doesnt work for me.
xXMADEXx Posted August 1, 2013 Posted August 1, 2013 ( ( Not Tested ) ) local blip = { } addEventHandler ( "onPlayerSpawn", root, function ( ) if ( not isElement ( blip [ source ] ) ) then blip [ source ] = createBlipAttachedTo ( source ) end local theTeam = getPlayerTeam ( source ) if ( not theTeam ) then return end if ( getTeamName ( theTeam ) == "Police" ) then return end local r, g, b = getTeamColor ( theTeam ) setPlayerNametagColor ( source, r, g, b ) setBlipColor ( blip [ source ], r, g, b, 255 ) end ) addEventHandler ( "onResourceStart", resourceRoot, function () for k, v in ipairs ( getElementsByType("player") ) do if ( not isElement ( blip [ v ] ) ) then blip [ v ] = createBlipAttachedTo ( v ) end local theTeam = getPlayerTeam ( v ) if (not theTeam) then return end if ( getTeamName ( theTeam ) == "Police" ) then return end local r, g, b = getTeamColor ( theTeam ) setPlayerNametagColor ( v, r, g, b ) setBlipColor ( blip [ v ], r, g, b, 255 ) end end ) function destroyPlayerBlip( ) if isElement ( blip [ source ] ) then destroyElement ( blip [ source ] ) end end addEventHandler ( "onPlayerQuit", root, destroyPlayerBlip ) addEventHandler ( "onPlayerWasted", root, destroyPlayerBlip ) addEventHand setTimer ( function ( ) for i,v in ipairs ( getElementsByType ( "player" ) ) do if isElement ( blip [ v ] ) then destroyElement ( blip [ v ] ) end local theTeam = getPlayerTeam ( v ) if (not theTeam) then return end if ( getTeamName ( theTeam ) == "Police" ) then return end local r, g, b = getTeamColor ( theTeam ) setPlayerNametagColor ( v, r, g, b ) setBlipColor ( blip [ v ], r, g, b, 255 ) end end, 30000, 0 )
Jacob Lenn Posted August 1, 2013 Author Posted August 1, 2013 I'm not sure why in every 30 seconds u destroy blip.
-.Paradox.- Posted August 1, 2013 Posted August 1, 2013 local blip = { } addEvent ( "onPlayerTeamChanged", true ) addEventHandler ( "onPlayerTeamChanged", root, function ( theTeam ) if ( not theTeam ) then return end if ( not isElement ( blip [ source ] ) ) then blip [ source ] = createBlipAttachedTo ( source ) end local r, g, b = getTeamColor ( theTeam ) setPlayerNametagColor ( source, r, g, b ) setBlipColor ( blip [ source ], r, g, b, 255 ) end ) addEventHandler ( "onPlayerQuit", root, function ( ) if isElement ( blip [ source ] ) then destroyElement ( blip [ source ] ) end end )
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