Dice Posted March 17, 2013 Posted March 17, 2013 function triggerBlow( thePlayer, matchingDimension ) if thePlayer then if isElementWithinColShape ( thePlayer, dragarr ) then triggerClientEvent ( root ,"killIntruder", thePlayer ) end end end addEventHandler ( "onColShapeHit", root, triggerBlow ) setTimer ( triggerBlow, 1000, 0 ) Why doesn't this check every second? by the way the client event just creates a projectile, what I want to do is , while that person is in that colshape trigger the client event. As of now all it is doing is shooting one missile, but I need to fire as long as I am in there.
manve1 Posted March 17, 2013 Posted March 17, 2013 function triggerBlow( thePlayer, matchingDimension ) setTimer( function( ) if thePlayer then if isElementWithinColShape ( thePlayer, dragarr ) then triggerClientEvent ( root ,"killIntruder", thePlayer ) end end end, 1000, 0 ) end addEventHandler ( "onColShapeHit", root, triggerBlow ) try this. Looking for tutorials or information? check out: www.simpleask.co.uk
Dice Posted March 17, 2013 Author Posted March 17, 2013 Would that be safe? because everytime a person walks in it will set a timer? Nevermind, I had to put the timer in a variable, everything is good now.
manve1 Posted March 17, 2013 Posted March 17, 2013 you can use killTimer to get rid of a timer, and the code i gave you after massive amounts of people walk in the col shape, it will create that many timers, so it might create lag. Looking for tutorials or information? check out: www.simpleask.co.uk
Dice Posted March 17, 2013 Author Posted March 17, 2013 I can use isTimer to prevent that lag, but your code works thanks for the help =)
manve1 Posted March 17, 2013 Posted March 17, 2013 isTimer gets a specific timer, example of how to get rid of a timer: time = 30 timer = setTimer( function() time = time - 1 outputChatBox( time, root, 255, 255, 255 ) if ( time == 0 ) then killTimer( timer ) end end, 1000, 0 ) You're welcome after all. Looking for tutorials or information? check out: www.simpleask.co.uk
Dice Posted March 17, 2013 Author Posted March 17, 2013 Yes... I know........that is why i said i will put it in a variabelw and use istimer to check it if it created to prevent that lag
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