Dimmitry007 Posted March 12, 2015 Share Posted March 12, 2015 hello any body knows how to Make arrow on head ? like this http://i.imgur.com/6LnrMO8.png Link to comment
</Mr.Tn6eL> Posted March 12, 2015 Share Posted March 12, 2015 createMarker -- "Arrow" attachElements Link to comment
Dimmitry007 Posted March 13, 2015 Author Share Posted March 13, 2015 can you just give me full createmarker code for arrow just pleasw. Link to comment
LaCosTa Posted March 13, 2015 Share Posted March 13, 2015 createMarker ( x, y, z , "arrow", size , R , G , B ) it's simple try to follow wiki codes Link to comment
Dimmitry007 Posted March 14, 2015 Author Share Posted March 14, 2015 K it works thanks but it's not up in my head Link to comment
TAPL Posted March 14, 2015 Share Posted March 14, 2015 K it works thanks but it's not up in my head + 1 or + 2 to z. Link to comment
Dimmitry007 Posted March 14, 2015 Author Share Posted March 14, 2015 ok can some one test this i'm not in my home to test it will it work? please test it function arrow ( thePlayer ) getElementPosition ( thePlayer ) createMarker ( 0, 0, 0, "arrow", .75, 255, 0, 0, 175 ) attachElements ( arrow, thePlayer, 0, 0, 2 ) end end addCommandHandler ( "aduty", arrow ) Link to comment
Enargy, Posted March 14, 2015 Share Posted March 14, 2015 you added the getElementPosition, it is not necessary to use it if you gonna attach the marker to player. putting or not , it work perfectly but defining the position of an element is necessary do; x, y, z = getElementPosition(...) EDIT: you put an 'end' of more. Link to comment
Dimmitry007 Posted March 15, 2015 Author Share Posted March 15, 2015 okay i want to remove it from my head how i can do that? Link to comment
TAPL Posted March 15, 2015 Share Posted March 15, 2015 Make a variable for the marker and destroy it when you want to remove it. destroyElement Link to comment
Dimmitry007 Posted March 15, 2015 Author Share Posted March 15, 2015 like function arrow ( thePlayer ) local arrow = createMarker ( 0, 0, 0, "arrow", .75, 255, 0, 0, 175 ) local duty = getElementData(thePlayer, "duty") or 0 if duty == 0 then attachElements ( arrow, thePlayer, 0, 0, 2 ) else destroyElement ( arrow ) end end end addCommandHandler("aduty",arrow) Link to comment
Addlibs Posted March 15, 2015 Share Posted March 15, 2015 local arrow --define it local first, otherwise the variable will be lost as soon as the function is executed and reaches the end of it - it won't be there when you run the function again, thus you wouldn't be able to delete that marker. function arrowFunction ( thePlayer ) --conflict detected. Both the actual arrow and the function were stored under the same variable. local duty = getElementData(thePlayer, "duty") or 0 if duty == 0 then arrow = createMarker ( 0, 0, 0, "arrow", .75, 255, 0, 0, 175 ) attachElements ( arrow, thePlayer, 0, 0, 2 ) else destroyElement ( arrow ) end end addCommandHandler("aduty", arrowFunction) Link to comment
TAPL Posted March 15, 2015 Share Posted March 15, 2015 Actually you do need table instead of variable, if you wish to have more than one marker at more than one player head. Link to comment
Dimmitry007 Posted March 16, 2015 Author Share Posted March 16, 2015 Actually you do need table instead of variable, if you wish to have more than one marker at more than one player head. Didn't understand but yea i want the arrow for who use the command Link to comment
TAPL Posted March 16, 2015 Share Posted March 16, 2015 I don't know what the purpose of the element data, but i assume that you have some other code control the element data 'duty'. arrowTable = {} addCommandHandler("aduty", function(player) local duty = getElementData(player, "duty") or 0 if duty == 0 then if not isElement(arrowTable[player]) then arrowTable[player] = createMarker(0, 0, 0, "arrow", 0.75, 255, 0, 0, 175) end attachElements(arrowTable[player], player, 0, 0, 2) else if isElement(arrowTable[player]) then destroyElement(arrowTable[player]) arrowTable[player] = nil end end end) addEventHandler("onPlayerQuit", root, function() if isElement(arrowTable[player]) then destroyElement(arrowTable[player]) arrowTable[player] = nil end end) Link to comment
Dimmitry007 Posted March 16, 2015 Author Share Posted March 16, 2015 I don't know what the purpose of the element data, but i assume that you have some other code control the element data 'duty'. arrowTable = {} addCommandHandler("aduty", function(player) local duty = getElementData(player, "duty") or 0 if duty == 0 then if not isElement(arrowTable[player]) then arrowTable[player] = createMarker(0, 0, 0, "arrow", 0.75, 255, 0, 0, 175) end attachElements(arrowTable[player], player, 0, 0, 2) else if isElement(arrowTable[player]) then destroyElement(arrowTable[player]) arrowTable[player] = nil end end end) addEventHandler("onPlayerQuit", root, function() if isElement(arrowTable[player]) then destroyElement(arrowTable[player]) arrowTable[player] = nil end end) Yea i have another code for duty Link to comment
Dimmitry007 Posted March 16, 2015 Author Share Posted March 16, 2015 Ok i want it for admins only 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