DazzaJay Posted September 24, 2008 Share Posted September 24, 2008 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
Cazomino05 Posted September 24, 2008 Share Posted September 24, 2008 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
DazzaJay Posted September 24, 2008 Author Share Posted September 24, 2008 our server has collision off, but it seems to apply it AFTER race start. so cars have collision Before the green light, which is when Spawn Stacking can hurt cars. Thanks for that tho, im sure that all the info i need to make this work properly. Link to comment
Mr.Hankey Posted September 24, 2008 Share Posted September 24, 2008 i recommend using setVehicleDamageProof it's much more effective and easier than setting the health to 100 every few miliseconds Link to comment
DazzaJay Posted September 24, 2008 Author Share Posted September 24, 2008 Oh Wha, i havnt even heard of that one Thanks, iil look into it. 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