Jump to content

On Recource start of ANY recource.


DazzaJay

Recommended Posts

Realy quick question..

im trying to make a script for my server to combat spawn stacking in race gamemode.

Basically, as you all know If the map has less spawnpoints than players, some cars get stacked on others, causing rippin damage to the stacked cars, and quite often deaths on start of map. and because most maps have only 32 spawns cos they were made with old race map editor. i have come to a great idea.

at the start of any map i want to run a timer, that will keep cars at 100% health for a total of 15 seconds at start of race. (using a stopwatch i found that the first 10 seconds is loading the map and the count, then another 5 seconds after map starts of invincibility) this will make sure that if spawn stacking occours no damage will be done to the cars involved.

So basically, all i really need to know is for a scrit, what the "onrecourcestart" or whatever command is, that is triggered on ALL recource loads. (as this will be the lazyest way of doing the script as in my server when its running the only recources that start / stop are the maps)

Link to comment

function SuperCars() 
        local vehicles = getElementsByType("vehicle") 
        for k,v in ipairs(vehicles) do 
                setElementHealth ( v, 1000 ) 
        end 
end 
function StartTimer() 
        setTimer ( SuperCars, 100, 150 ) 
end 
addEventHandler("onGamemodeMapStart", getRootElement(), StartTimer) 

Excuse the dodgy indentation can't do much about it atm

Another way of doing it would be to disable Collisions, but the wiki says it has unwanted side effects at the moment so i am not sure what those are

Or Disable damage client side when onVehicleDamage is triggered then remove the event handler for it after 15 seconds... preference really

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...