Jump to content

Script restart


fastandbulbous

Recommended Posts

Hello everyone.

So I have a working script for race mode which I'll put below:

function enableCameraThoughCars () 
  setCameraClip (true,false) 
  outputChatBox ("hueta enabled",255,0,0,false) 
end 
addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()),enableCameraThoughCars) 

This script disables the camera collision function. But to make it work, I have to restart it through the admin panel every time new round starts. It doesn't really take that much effort, but out of curiosity, how can I make it restart automatically after I change a map or game mode? Please help.

Link to comment

Well, I tried this:

addEventHandler("onClientResourceStart", resourceRoot, 
function() 
    setCameraClip(false,false) 
end) 

And it worked normally... I didn't have troubles when new maps were starting..

What could it be?

resourceRoot is a variable representing the current resource ONLY. Right?

I didn't have to attach the event to root

Link to comment
Well, I tried this:
addEventHandler("onClientResourceStart", resourceRoot, 
function() 
    setCameraClip(false,false) 
end) 

And it worked normally... I didn't have troubles when new maps were starting..

What could it be?

resourceRoot is a variable representing the current resource ONLY. Right?

I didn't have to attach the event to root

They just don't know how it works. Whenever a resource starts the the event is triggered. I think they don't really care about script performance, they simply wanna make it work.

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...