Anubhav Posted June 27, 2014 Posted June 27, 2014 Hi guyz, Today I made a blip system which added blips on players. In the mini-map it doesn't show the blip. BUt on the large map it shows. What is the problem?
xXMADEXx Posted June 27, 2014 Posted June 27, 2014 Your blip distance is probably to low. Check createBlip and look at the visible distance parameter.
Anubhav Posted June 27, 2014 Author Posted June 27, 2014 I am using createBlipAttached to and i have set the visible value to 65535 and still its not showing. A very near player is not coming in it! is radar bugged?
Anubhav Posted June 27, 2014 Author Posted June 27, 2014 function destroyAllBlips(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 function createBlips() destroyAllBlips(root) local players = getElementsByType ( "player" ) for k,v in ipairs(players) do local r,g,b,a = getTeamColor(getPlayerTeam(v)) createBlipAttachedTo(v,0,2,r,g,b,a,0,99999.0) end end setTimer(createBlips,500,0) function destroyer( thePlayer ) destroyAllBlips( thePlayer ) end addEventHandler("onPlayerQuit",root,destroyer)
Anubhav Posted June 28, 2014 Author Posted June 28, 2014 Any help please? I realy need to do this fast.
Stranger Posted June 28, 2014 Posted June 28, 2014 try this: blips = { } function createBlips() local players = getElementsByType ( "player" ) for k,v in ipairs(players) do if isElement (blips[v]) then destroyElement (blips[v]) blips[v] = nil end local r,g,b,a = getTeamColor(getPlayerTeam(v)) blips[v] = createBlipAttachedTo(v,0,2,r,g,b,a,0,99999.0, root) end end setTimer(createBlips,500,0) function destroyer() if isElement (blips[source]) then destroyElement (blips[source]) blips[source] = nil end end addEventHandler("onPlayerQuit",root,destroyer)
codeluaeveryday Posted June 28, 2014 Posted June 28, 2014 WTF, why are you spamming the createBlips function? That's one way to bring the servers performance down. function destroyAllBlips(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 function createBlips() destroyAllBlips(root) local players = getElementsByType ( "player" ) for k,v in ipairs(players) do local r,g,b,a = getTeamColor(getPlayerTeam(v)) createBlipAttachedTo(v,0,2,r,g,b,a,0,99999.0) end end setTimer(createBlips,500,0) function destroyer( thePlayer ) destroyAllBlips( thePlayer ) end addEventHandler("onPlayerQuit",root,destroyer)
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