Hadif Posted August 8, 2015 Share Posted August 8, 2015 Hello guys! I need to modify my script, I want to get times remaining. Example: If player get out from Tierra Robada and Bone County for 10 seconds, that player will be kill or vehicle will be explode. Any help will be appreciate! Script: addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource ( ) ), function ( ) startLocator ( ) end ) function theLocator ( ) local allLocations = { "Las Venturas", "San Fierro", "Whetstone", "Flint County", "Red County", "Los Santos" } local allPlayers = getElementsByType ( "player" ) local allVehicles = getElementsByType ( "vehicle" ) for index, thePlayer in ipairs ( allPlayers ) do local theLocation = getElementZoneName ( thePlayer, true ) for index, allLocations in ipairs ( allLocations ) do if ( theLocation == allLocations ) then killPed ( thePlayer ) end end end for index, theVehicle in ipairs ( allVehicles ) do local theLocation = getElementZoneName ( theVehicle, true ) for index, allLocations in ipairs ( allLocations ) do if ( theLocation == allLocations ) then blowVehicle ( theVehicle ) end end end end function startLocator ( ) setTimer ( theLocator, 50, 0 ) end Link to comment
GTX Posted August 8, 2015 Share Posted August 8, 2015 local deathTimer function theLocator ( ) local allLocations = { "Las Venturas", "San Fierro", "Whetstone", "Flint County", "Red County", "Los Santos" } local allPlayers = getElementsByType ( "player" ) local allVehicles = getElementsByType ( "vehicle" ) for index, thePlayer in ipairs ( allPlayers ) do local theLocation = getElementZoneName ( thePlayer, true ) for index, allLocations in ipairs ( allLocations ) do if ( theLocation == allLocations ) then if not isTimer(deathTimer) then deathTimer = setTimer(killPed, 10000, 1, thePlayer ) end else if isTimer(deathTimer) then killTimer(deathTimer) end end end end for index, theVehicle in ipairs ( allVehicles ) do local theLocation = getElementZoneName ( theVehicle, true ) for index, allLocations in ipairs ( allLocations ) do if ( theLocation == allLocations ) then if not isTimer(deathTimer) then deathTimer = setTimer(blowVehicle, 10000, 1, theVehicle ) end else if isTimer(deathTimer) then killTimer(deathTimer) end end end end end Link to comment
Hadif Posted August 8, 2015 Author Share Posted August 8, 2015 local deathTimer function theLocator ( ) local allLocations = { "Las Venturas", "San Fierro", "Whetstone", "Flint County", "Red County", "Los Santos" } local allPlayers = getElementsByType ( "player" ) local allVehicles = getElementsByType ( "vehicle" ) for index, thePlayer in ipairs ( allPlayers ) do local theLocation = getElementZoneName ( thePlayer, true ) for index, allLocations in ipairs ( allLocations ) do if ( theLocation == allLocations ) then if not isTimer(deathTimer) then deathTimer = setTimer(killPed, 10000, 1, thePlayer ) end else if isTimer(deathTimer) then killTimer(deathTimer) end end end end for index, theVehicle in ipairs ( allVehicles ) do local theLocation = getElementZoneName ( theVehicle, true ) for index, allLocations in ipairs ( allLocations ) do if ( theLocation == allLocations ) then if not isTimer(deathTimer) then deathTimer = setTimer(blowVehicle, 10000, 1, theVehicle ) end else if isTimer(deathTimer) then killTimer(deathTimer) end end end end end Not working... 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