boro Posted August 14, 2014 Share Posted August 14, 2014 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 ) Link to comment
Castillo Posted August 14, 2014 Share Posted August 14, 2014 What is this for? what is your goal? Link to comment
Mr_Moose Posted August 14, 2014 Share Posted August 14, 2014 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. Link to comment
boro Posted August 15, 2014 Author Share Posted August 15, 2014 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 ? Link to comment
Mr_Moose Posted August 15, 2014 Share Posted August 15, 2014 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. Link to comment
boro Posted August 15, 2014 Author Share Posted August 15, 2014 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 Link to comment
DiSaMe Posted August 15, 2014 Share Posted August 15, 2014 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. Link to comment
Mr_Moose Posted August 15, 2014 Share Posted August 15, 2014 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 functionI 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. 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