-.Paradox.- Posted June 23, 2013 Posted June 23, 2013 Hello, I want a little help, If a player get in team his nametagcolor and blipcolor change to team color like Example : If player was in Forever Team he's name and blip should be red. thanks for help
xXMADEXx Posted June 23, 2013 Posted June 23, 2013 Its in the playerblip resource. Make the r, g, b to getPlayerTeamColor ( getPlayerTeam ( playerElement ) )
PaiN^ Posted June 23, 2013 Posted June 23, 2013 setPlayerNametagColor getAttachedElements -- To get the blip getElementType -- To get the blip setBlipColor
-.Paradox.- Posted June 23, 2013 Author Posted June 23, 2013 Can you explain me please -- needs configurable blip colors, and team support root = getRootElement () color = { 0, 255, 0 } players = {} resourceRoot = getResourceRootElement ( getThisResource () ) function onResourceStart ( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do if ( players[player] ) then createBlipAttachedTo ( player, 0, 2, players[source][1], players[source][2], players[source][3] ) else createBlipAttachedTo ( player, 0, 2, color[1], color[2], color[3] ) end end end function onPlayerSpawn ( spawnpoint ) if ( players[source] ) then createBlipAttachedTo ( source, 0, 2, players[source][1], players[source][2], players[source][3] ) else createBlipAttachedTo ( source, 0, 2, color[1], color[2], color[3] ) end end function onPlayerQuit () destroyBlipsAttachedTo ( source ) end function onPlayerWasted ( totalammo, killer, killerweapon ) destroyBlipsAttachedTo ( source ) end function setBlipsColor ( source, commandName, r, g, b ) if ( tonumber ( b ) ) then color = { tonumber ( r ), tonumber ( g ), tonumber ( b ) } for id, player in ipairs( getElementsByType ( "player" ) ) do destroyBlipsAttachedTo ( player ) if ( players[player] ) then createBlipAttachedTo ( player, 0, 2, players[source][1], players[source][2], players[source][3] ) else createBlipAttachedTo ( player, 0, 2, color[1], color[2], color[3] ) end end end end function setBlipColor ( source, commandName, r, g, b ) if ( tonumber ( b ) ) then destroyBlipsAttachedTo ( source ) players[source] = { tonumber ( r ), tonumber ( g ), tonumber ( b ) } createBlipAttachedTo ( source, 0, 2, players[source][1], players[source][2], players[source][3] ) end end addCommandHandler ( "setblipscolor", setBlipsColor ) addCommandHandler ( "setblipcolor", setBlipColor ) addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) addEventHandler ( "onPlayerSpawn", root, onPlayerSpawn ) addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerWasted", root, onPlayerWasted ) function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end
xXMADEXx Posted June 23, 2013 Posted June 23, 2013 -- needs configurable blip colors, and team support root = getRootElement () color = { 0, 255, 0 } players = {} resourceRoot = getResourceRootElement ( getThisResource () ) function onResourceStart ( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do local r, g, b = getTeamColor ( getPlayerTeam ( player ) ) createBlipAttachedTo ( player, 0, 2, r, g, b ) end end function onPlayerSpawn ( spawnpoint ) local r, g, b = getTeamColor ( getPlayerTeam ( source ) ) createBlipAttachedTo ( source, 0, 2, r, g, b ) end function onPlayerQuit () destroyBlipsAttachedTo ( source ) end function onPlayerWasted ( totalammo, killer, killerweapon ) destroyBlipsAttachedTo ( source ) end function setBlipsColor ( source, commandName, r, g, b ) if ( tonumber ( b ) ) then for id, player in ipairs( getElementsByType ( "player" ) ) do destroyBlipsAttachedTo ( player ) createBlipAttachedTo ( player, 0, 2, r, g, b ) end end end function setBlipColor ( source, commandName, r, g, b ) if ( tonumber ( b ) ) then destroyBlipsAttachedTo ( source ) createBlipAttachedTo ( source, 0, 2, r, g, b ) end end addCommandHandler ( "setblipscolor", setBlipsColor ) addCommandHandler ( "setblipcolor", setBlipColor ) addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) addEventHandler ( "onPlayerSpawn", root, onPlayerSpawn ) addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerWasted", root, onPlayerWasted ) function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end
iMr.3a[Z]eF Posted June 23, 2013 Posted June 23, 2013 setPlayerNametagColor getAttachedElements -- To get the blip getElementType -- To get the blip setBlipColor setBlipColor is only if the blip icon = 0
iPrestege Posted June 25, 2013 Posted June 25, 2013 https://forum.multitheftauto.com/viewtopic.php?f=91&t=60715
-.Paradox.- Posted June 25, 2013 Author Posted June 25, 2013 But i know on a server it work perfectly when a player who in team like example test hes name color immidiately change too blue and he's blip too
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