Cadu12 Posted March 9, 2011 Posted March 9, 2011 I have one problem, when map started and doesnt set to all players colors There is script: addEvent("onMapStarting", true) function MapStarted() for id, player in ipairs(getElementsByType("player")) do playerTeam = getPlayerTeam" class="kw2">getPlayerTeam(player) local attachedElements = getAttachedElements(player) if attachedElements and #attachedElements > 0 and playerTeam then for k,v in ipairs(attachedElements) do if getElementType(v) == "blip" then local r,g,b = getTeamColor(playerTeam) setBlipColor(v, r, g, b, 255) setBlipSize ( v, 4 ) -- THIS IS ONLY FOR TEST! end end end end end addEventHandler("onMapStarting", getRootElement(), MapStarted)
InDev Posted March 9, 2011 Posted March 9, 2011 Hi, I think your problem is here: if attachedElements and #attachedElements > 0 and playerTeam then Is it possible that players, at the map starting, have no blip or no team ? try to output a message if the test return false addEvent("onMapStarting", true) function MapStarted() for id, player in ipairs(getElementsByType("player")) do playerTeam = getPlayerTeam" class="kw2">getPlayerTeam(player) local attachedElements = getAttachedElements(player) if attachedElements and #attachedElements > 0 and playerTeam then outputChatBox( "Player "..getPlayerName( player ).." have attached elements and team ! " ) for k,v in ipairs(attachedElements) do if getElementType(v) == "blip" then local r,g,b = getTeamColor(playerTeam) setBlipColor(v, r, g, b, 255) setBlipSize ( v, 4 ) -- THIS IS ONLY FOR TEST! end end else outputChatBox( "Player "..getPlayerName( player ).." have no attached elements or no team ! " ) end end end addEventHandler("onMapStarting", getRootElement(), MapStarted)
Cadu12 Posted March 9, 2011 Author Posted March 9, 2011 (edited) Oh works it, but setBlipSize and setBlipColor doesnt work Edit: Fixed, thank you for helping Edited March 9, 2011 by Guest
InDev Posted March 9, 2011 Posted March 9, 2011 Have you tested if all works until the setBlipSize and setBlipColor function, does the team have a color ? Because I don't know why this is not working...
Cadu12 Posted March 9, 2011 Author Posted March 9, 2011 It works, i used setTimer, thank you for the helping.
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