Jump to content

question


boro

Recommended Posts

Posted

Hi all is good idea add fadecamera to render function ? isnt it lagged ?

like this

function testFunction () 
      fadeCamera ( false, 1.0, 0, 0, 0 )  
end 
addEventHandler ( "onClientRender", root, testFunction ) 

Posted

It's a bad idea, fadeCamera has it's own rendering system, you already specify details such as time to fade, what color to fade to and in/out in the function arguments. Putting it in onClientRender would be like calling a timer from another infinite timer, a huge waste of performance and your server might crash due to stack overflow in worst case scenario.

Posted

Ok this is bad idea dut when i hange this script to

function testFunction () 
if fadeCamera ( false, 1.0, 0, 0, 0 ) then 
else 
      fadeCamera ( false, 1.0, 0, 0, 0 ) 
end 
end 
addEventHandler ( "onClientRender", root, testFunction ) 

its good for good server? or is it laged function for server ?

Posted

That would be even worse, it's also incorrect according to the syntax. Try just running this:

fadeCamera ( false, 10, 0, 0, 0 ) 

And observe the result from within your server.

Posted

it dont work because i used compiled script from comunity and this script contain fadeCamera ( true, 1.0, 0, 0, 0 ) when is player spawned,, but i need fadeCamera ( false, 1.0, 0, 0, 0 ) when is player spawned and this work only with onClientRender funtion

Posted

First of all, it won't crash anything, second, it won't cause the stack overflow, and third, it doesn't have to do anything with server apart from file contents being read and sent to client. Last, but not least, while it's much more inefficient than it could be done, the code is still far from making noticeable performance decrease on its own.

The problem is the way the camera fading is controlled. It's not a good thing to reverse the effect of fadeCamera(true) with fadeCamera(false). Instead, you should simply not call fadeCamera(true). Since this particular case is related to compiled script, the closest thing would be replacing fadeCamera function in that resource with the one that doesn't do anything.

function fadeCamera() end 

You can add this script into that resource (preferably before other files in meta.xml, though that might not be necessary, depending on what compiled scripts do inside). Then, whenever that resource calls fadeCamera, it will call this empty function rather than the real one, which will prevent the resource from fading camera in/out.

Posted
it dont work because i used compiled script from comunity and this script contain fadeCamera ( true, 1.0, 0, 0, 0 ) when is player spawned,, but i need fadeCamera ( false, 1.0, 0, 0, 0 ) when is player spawned and this work only with onClientRender function
I see, you where looking for a way to disable calls to fadeCamera from a compiled resource, next time you might describe that in the main post to get the help you're looking for.

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