-.Paradox.- Posted July 23, 2013 Share Posted July 23, 2013 Hello all, I want a little script, if player was in team Test he's nametagcolor and blip must be same as team color, i want to make a script like that. Well, i tried this using this but need some functions, r, g, b = getTeamColor(teamElement) setPlayerNametagColor(playerElement, r, g ,b) Can somebody help me with a code or someting elser thanks Link to comment
Martyz Posted July 23, 2013 Share Posted July 23, 2013 didn't test, but should work: blip = {} function spawn(posX, posY, posZ, spawnRotation, theTeam, theSkin, theInterior, theDimension) if(not isElement(blip[getPlayerName(source)])) then blip[getPlayerName(source)] = createBlipAttachedTo(source) end if(getTeamName(theTeam) == 'test') then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(source, r, g, b) setBlipColor(blip[getPlayerName(source)], r, g, b, 255) end end addEventHandler('onPlayerSpawn', getRootElement(), spawn) this is server-side script ! Link to comment
Jaysds1 Posted July 23, 2013 Share Posted July 23, 2013 (edited) What if the player changes their name? The table wont free it until the resource is restarted/stopped. Anyways, try this: local blip = {} addEventHandler('onPlayerSpawn',root, function(_, _, _, _, theTeam) if (not isElement(blip[source])) then blip[source] = createBlipAttachedTo(source) end if(getTeamName(theTeam) == 'test') then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(source, r, g, b) setBlipColor(blip[source], r, g, b, 255) end end) setTimer(function() for source,b in pairs(blip)do if not isElement(source) then destroyElement(b) blip[source] = false end end end,10000,0) Edited July 23, 2013 by Guest Link to comment
Martyz Posted July 23, 2013 Share Posted July 23, 2013 are you destroying blue color? Link to comment
Jaysds1 Posted July 23, 2013 Share Posted July 23, 2013 Nah, I've set a timer for it to run every 10secs to see if every player is still in the server so there's no lose ends of the script. Link to comment
-.Paradox.- Posted July 23, 2013 Author Share Posted July 23, 2013 Not only for Test team i want it for every team because i have 4 and i want when player login he's nametagcolor and blip be the same as Team color. Link to comment
Jaysds1 Posted July 23, 2013 Share Posted July 23, 2013 ok, try this: local blip = {} addEventHandler('onPlayerSpawn',root, function(_, _, _, _, theTeam) 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) setTimer(function() for source,b in pairs(blip)do if not isElement(source) then destroyElement(b) blip[source] = false end end end,10000,0) Link to comment
-.Paradox.- Posted July 23, 2013 Author Share Posted July 23, 2013 Thanks for youre help.....i will try Link to comment
-.Paradox.- Posted July 24, 2013 Author Share Posted July 24, 2013 Wont work i tried debugscript 3 it show nothing. Link to comment
iMr.3a[Z]eF Posted July 24, 2013 Share Posted July 24, 2013 ok, try this:local blip = {} addEventHandler('onPlayerSpawn',root, function(_, _, _, _, theTeam) 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) setTimer(function() for source,b in pairs(blip)do if not isElement(source) then destroyElement(b) blip[source] = false end end end,10000,0) Where is the 2nd argument of the function createBlipAttachedTo. Link to comment
Martyz Posted July 24, 2013 Share Posted July 24, 2013 ok, try this:<...> Where is the 2nd argument of the function createBlipAttachedTo. only 1 argument is required, others are optional Nah, I've set a timer for it to run every 10secs to see if every player is still in the server so there's no lose ends of the script. You can use onPlayerQuit for that, you dont need timer. Link to comment
-.Paradox.- Posted July 24, 2013 Author Share Posted July 24, 2013 Won't work help guys. Link to comment
Castillo Posted July 24, 2013 Share Posted July 24, 2013 local blip = { } addEventHandler ( "onPlayerLogin", 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 ( "onPlayerQuit", root, function ( ) if isElement ( blip [ source ] ) then destroyElement ( blip [ source ] ) end end ) Link to comment
-.Paradox.- Posted July 24, 2013 Author Share Posted July 24, 2013 Won't work too, i tried debugscript 3 it show only some errors from exp_system. http://postimg.org/image/u01fhle5d/ Link to comment
Castillo Posted July 24, 2013 Share Posted July 24, 2013 local blip = { } addEventHandler ( "onPlayerLogin", root, function ( ) if ( not isElement ( blip [ source ] ) ) then blip [ source ] = createBlipAttachedTo ( source ) end local theTeam = getPlayerTeam ( source ) if ( not theTeam ) then outputChatBox ( "YOU HAVE NO TEAM", source ) return 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 ) Try that and see what it says when you login. Link to comment
-.Paradox.- Posted July 24, 2013 Author Share Posted July 24, 2013 It write you have no team http://postimg.org/image/mbsh5bug1/ and i have that bug in flag scoreboard Link to comment
Castillo Posted July 24, 2013 Share Posted July 24, 2013 You should combine the blip script with your team loader system. Link to comment
-.Paradox.- Posted July 24, 2013 Author Share Posted July 24, 2013 I can't understand. I'm using autoteams. I will send you code of it in Private message. Link to comment
Castillo Posted July 24, 2013 Share Posted July 24, 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 ) Link to comment
-.Paradox.- Posted July 24, 2013 Author Share Posted July 24, 2013 Working perfect Thank you, youre the best :D 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