TheMaysTRo Posted July 27, 2014 Share Posted July 27, 2014 Hello . i created a marker on client side and i want to use "onClientMarkerHit" on the pay marker only not on the whole server markers but its not working like "onMakrerHit" on the server side. local paymarker = setTimer (createMarker,1800000,0, 2620.49609375,-1750.9696044922,1464.6059570313 ,"cylinder",3,0,255,0,180) addEventHandler( "onClientMarkerHit", getRootElement(), payme ) Link to comment
esporta05 Posted July 27, 2014 Share Posted July 27, 2014 (edited) You are supposed to use source to detect which marker you hit. This if statement supposed to detect the marker that you hit: if source == paymarker So your full function should be like this function payme() if (source == pay marker) then --The script that is going to run when the player hits to the marker end end Edited July 27, 2014 by Guest Link to comment
Et-win Posted July 27, 2014 Share Posted July 27, 2014 local marker1 = createMarker(stuff) function test1() if (source == marker1) then outputChatBox("Marker1 hitted!") end end addEventHandler("onClientMarkerHit, getRootElement(), test1) Like that you can do it. Link to comment
TheMaysTRo Posted July 27, 2014 Author Share Posted July 27, 2014 local marker1 = createMarker(stuff) function test1() if (source == marker1) then outputChatBox("Marker1 hitted!") end end addEventHandler("onClientMarkerHit, getRootElement(), test1) Like that you can do it. not working. function payme() if (source == paymarker) then outputChatBox ("Type /iwonthewar get your prize ",255,0,0,false) addCommandHandler("iwonthewar",money) end end addEventHandler( "onClientMarkerHit", getRootElement(),payme ) Link to comment
esporta05 Posted July 27, 2014 Share Posted July 27, 2014 (edited) Hit detection supposed to work just fine. There should be a problem with your money giving script. Also u don't need to define a command for calling money function. You can call the function without adding a event handler. Simply call it with "money()". Make your players feel comfortable if (source == paymarker) then -- since you are calling the function directly you wont need to output that message money() end Btw prefer to use lua bb code rather than Code bb code. Edited July 28, 2014 by Guest Link to comment
Et-win Posted July 27, 2014 Share Posted July 27, 2014 'paymarker' is a timer, won't work indeed. You need to give up a marker. Use the timer like this: setTimer(function () marker1 = createMarker(stuff) end, time, times) Link to comment
TheMaysTRo Posted July 28, 2014 Author Share Posted July 28, 2014 'paymarker' is a timer, won't work indeed. You need to give up a marker.Use the timer like this: setTimer(function () marker1 = createMarker(stuff) end, time, times) setTimer(function lol() paymarker = createMarker(2620.49609375,-1750.9696044922,1464.6059570313 ,"cylinder",3,0,255,0,180) end, 10000, 0) that's not working Link to comment
Anubhav Posted July 28, 2014 Share Posted July 28, 2014 remove lol. Keep it as function() setTimer(function() paymarker = createMarker(2620.49609375,-1750.9696044922,1464.6059570313 ,"cylinder",3,0,255,0,180) end, 10000, 0) Link to comment
TheMaysTRo Posted July 28, 2014 Author Share Posted July 28, 2014 remove lol. Keep it as function() setTimer(function() paymarker = createMarker(2620.49609375,-1750.9696044922,1464.6059570313 ,"cylinder",3,0,255,0,180) end, 10000, 0) thanks alot it worked .thanks to all who helped me. 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