Imposter Posted July 12, 2012 Share Posted July 12, 2012 Can someone help me out with this? cant get it to work!! addEvent("onMapStarting") minTime = 10*1000 maxTime = 15*1000 function killHim () if thePlayer then if theIdleTime > minTime then if theIdleTime > maxTime then if theSpeed < 5 then blowVehicle( theVehicle ) else outputChatBox( getPlayerName(getRootElement()) .. " has beed killed for camping!" ) end end else outputChatBox( "If you do not move in 5 seconds, you will be killed!", thePlayer ) end end end function onMapLoad () loadTimer = setTimer ( startTimer, 15000, 0 ) end addEventHandler ( "onMapStarting", getRootElement(), onMapLoad ) function startTimer () thePlayer = getRootElement() theVehicle = getPedOccupiedVehicle ( thePlayer ) theIdleTime = getPlayerIdleTime( thePlayer ) theSpeed = getElementVelocity ( theVehicle ) checkTimer = setTimer ( killHim, 100, 0 ) end Link to comment
Castillo Posted July 12, 2012 Share Posted July 12, 2012 I see many errors there: function startTimer () thePlayer = getRootElement() theVehicle = getPedOccupiedVehicle ( thePlayer ) theIdleTime = getPlayerIdleTime( thePlayer ) theSpeed = getElementVelocity ( theVehicle ) checkTimer = setTimer ( killHim, 100, 0 ) end You can't get the vehicle from root element. Link to comment
Imposter Posted July 12, 2012 Author Share Posted July 12, 2012 I see many errors there: function startTimer () thePlayer = getRootElement() theVehicle = getPedOccupiedVehicle ( thePlayer ) theIdleTime = getPlayerIdleTime( thePlayer ) theSpeed = getElementVelocity ( theVehicle ) checkTimer = setTimer ( killHim, 100, 0 ) end You can't get the vehicle from root element. i thought that would be a problem, and im still getting a bunch of warnings in the console, do you thnk i should change the handler? it keeps giving warnings for getPedOccupiedVehicle, getPlayerIdleTime( thePlayer ), getElementVelocity ( theVehicle ) Link to comment
Castillo Posted July 12, 2012 Share Posted July 12, 2012 You should loop all players inside 'startTimer ( )' function. 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