justn Posted May 30, 2014 Share Posted May 30, 2014 Hi I'm working on a little script, and I have a problem with setElementVisibleTo No errors in debugscript addEvent("CreateCaptainMarker",true) addEventHandler("CreateCaptainMarker",getRootElement(), function(x,y,z) local playerName = getPlayerName(source) local playerFromName = getPlayerFromName(playerName) if playerName and playerFromName then CaptainMarker[source] = createMarker ( x, y, z, "cylinder", 5, 255, 51, 102, 85) CaptainAttachedBlip[source] = createBlipAttachedTo(CaptainMarker[source],9) setElementVisibleTo(CaptainMarker[source],playerFromName,true) setElementVisibleTo(CaptainMarker[source],root,false) setElementVisibleTo(CaptainAttachedBlip[source],playerFromName,true) setElementVisibleTo(CaptainAttachedBlip[source],root,false) end end ) Link to comment
Mr_Moose Posted May 30, 2014 Share Posted May 30, 2014 playerFromName is a part of root, this means that you first make the element visible to playerFromName and straight after that making the element invisible to all, including playerFromName. Also make sure that you run this script server side only. Try this: addEvent("CreateCaptainMarker",true) addEventHandler("CreateCaptainMarker",getRootElement(), function(x,y,z) local playerName = getPlayerName(source) local playerFromName = getPlayerFromName(playerName) if playerName and playerFromName then CaptainMarker[source] = createMarker ( x, y, z, "cylinder", 5, 255, 51, 102, 85) CaptainAttachedBlip[source] = createBlipAttachedTo(CaptainMarker[source],9) setElementVisibleTo(CaptainMarker[source],root,false) setElementVisibleTo(CaptainMarker[source],playerFromName,true) setElementVisibleTo(CaptainAttachedBlip[source],root,false) setElementVisibleTo(CaptainAttachedBlip[source],playerFromName,true) end end) Link to comment
Moderators IIYAMA Posted May 30, 2014 Moderators Share Posted May 30, 2014 Also blips will be visible to new players. Because root only included the players that are inside the server at that moment. 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