scaryface87 Posted May 16, 2015 Author Share Posted May 16, 2015 Hi sorry to bumb but i dont get how to get a text showing in the chatbox if u enter the marker i tried this below but i cant seem to get the marker! function kickit() outputChatBox("Working!") end addEventHandler("onMarkerHit", markers[source],kickit) Link to comment
Walid Posted May 16, 2015 Share Posted May 16, 2015 Try this function kickit(hitElement, matchingDimension) if matchingDimension and isElement(hitElement) and getElementType(hitElement) == "player" then outputChatBox("Working!",hitElement) end end addEventHandler("onMarkerHit", markers[source],kickit) -- it must be inside the function Link to comment
scaryface87 Posted May 16, 2015 Author Share Posted May 16, 2015 Ok i tried to add the eventhandler in here ; function attchMarkerToAllVehicle () for i, vehicle in pairs(getElementsByType("vehicle")) do if not markers[vehicle] then local marker = createMarker( 0,0,0,"arrow",0.5,224,255,255,170) attachElements ( marker, vehicle, -1.5, 0, 1 ) markers[vehicle] = marker addEventHandler("onMarkerHit", markers[source],kickit) -- it must be inside the function end end end setTimer(attchMarkerToAllVehicle,1000,0) but it isnt doing something Link to comment
Walid Posted May 16, 2015 Share Posted May 16, 2015 (edited) it must be like this addEventHandler("onMarkerHit", markers[vehicle],kickit) or addEventHandler("onMarkerHit", marker ,kickit) Edited May 16, 2015 by Guest Link to comment
scaryface87 Posted May 16, 2015 Author Share Posted May 16, 2015 Doesnt seem to work also Link to comment
Walid Posted May 16, 2015 Share Posted May 16, 2015 Doesnt seem to work also what did you try it both working fine i gave you two examples Link to comment
scaryface87 Posted May 16, 2015 Author Share Posted May 16, 2015 My whole code u mean? here it is local markers = {} function attchMarkerToAllVehicle () for i, vehicle in pairs(getElementsByType("vehicle")) do if not markers[vehicle] then local marker = createMarker( 0,0,0,"arrow",0.5,224,255,255,170) attachElements ( marker, vehicle, -1.5, 0, 1 ) markers[vehicle] = marker addEventHandler("onMarkerHit", markers[vehicle],kickit) end end end setTimer(attchMarkerToAllVehicle,1000,0) function destroyMarker() if getElementType(source) == "vehicle" then if markers[source] and isElement(markers[source]) then destroyElement (markers[source]) end end end addEventHandler("onElementDestroy", getRootElement(),destroyMarker) function onResourceStart ( ) local players = getElementsByType ( "player" ) -- Store all the players in the server into a table for key, player in ipairs ( players ) do -- for all the players in the table setPlayerNametagShowing ( player, false ) -- turn off their nametag end end addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) function onPlayerJoin ( ) -- Whoever joins the server should also have their nametags deactivated setPlayerNametagShowing ( source, false ) end addEventHandler ( "onPlayerJoin", root, onPlayerJoin ) function kickit(hitElement, matchingDimension) -- if matchingDimension and isElement(hitElement) and getElementType(hitElement) == "player" then outputChatBox("Working!",hitElement) end Link to comment
Walid Posted May 16, 2015 Share Posted May 16, 2015 man why you edit my code copy and past local markers = {} function attchMarkerToAllVehicle () for i, vehicle in pairs(getElementsByType("vehicle")) do if not markers[vehicle] then local marker = createMarker( 0,0,0,"arrow",0.5,224,255,255,170) attachElements ( marker, vehicle, -1.5, 0, 1 ) markers[vehicle] = marker addEventHandler("onMarkerHit", markers[vehicle],kickit) end end end setTimer(attchMarkerToAllVehicle,1000,0) function destroyMarker() if getElementType(source) == "vehicle" then if markers[source] and isElement(markers[source]) then destroyElement (markers[source]) removeEventHandler("onMarkerHit", markers[source],kickit) end end end addEventHandler("onElementDestroy", getRootElement(),destroyMarker) function onResourceStart ( ) local players = getElementsByType ( "player" ) -- Store all the players in the server into a table for key, player in ipairs ( players ) do -- for all the players in the table setPlayerNametagShowing ( player, false ) -- turn off their nametag end end addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) function onPlayerJoin ( ) setPlayerNametagShowing ( source, false ) end addEventHandler ( "onPlayerJoin", root, onPlayerJoin ) function kickit(hitElement, matchingDimension) if matchingDimension and isElement(hitElement) and getElementType(hitElement) == "player" then outputChatBox("Working!",hitElement) end Link to comment
scaryface87 Posted May 16, 2015 Author Share Posted May 16, 2015 still not working after copy paste , some of my other scripts poped in too , i only removed the if matchingDimension to check if it was working then but now i tried to copy EXACTLY what you said now but it still didnt work Link to comment
Walid Posted May 16, 2015 Share Posted May 16, 2015 still not working after copy paste , some of my other scripts poped in too , i only removed the if matchingDimension to check if it was working then but now i tried to copy EXACTLY what you said now but it still didnt work debugscript ?? Link to comment
scaryface87 Posted May 16, 2015 Author Share Posted May 16, 2015 Nothing in debugscript Found out the arrow was glitching. its working with a cylinder marker , Thank you for your time!!! Link to comment
Walid Posted May 16, 2015 Share Posted May 16, 2015 Nothing in debugscriptFound out the arrow was glitching. its working with a cylinder marker , Thank you for your time!!! you are welcome 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