34 posts
Posted 28 April 2012 - 11:13 PM
Hey guys im practicing with CC on a server but everytime i comeback into the server my startup program is terminated and all my computers are broken.
Is there any code that wont let the users terminate the program?
Thanks in advance
514 posts
Location
Over there
Posted 28 April 2012 - 11:24 PM
There are at least two or more threads about this topic, you should search before you ask.
The code I usually use is:
--Put this in front of your code
oldpullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw
--Your code
--Put this after your code
os.pullEvent = oldpullEvent
The backing up of os.pullEvent is optional but recommended if youa re not hacking a public computer at spawn. :)/>/>
34 posts
Posted 28 April 2012 - 11:39 PM
Haha next time i will, tnx alot but can you explain what its meaning?
I'd like t nkow what i write
514 posts
Location
Over there
Posted 29 April 2012 - 12:19 AM
I'm actually not really sure, but I know it works.
I think there was an explanation and several other ways in another thread, but I couldn't find it.
718 posts
Location
Hawaii
Posted 29 April 2012 - 12:50 AM
I'm actually not really sure, but I know it works.
I think there was an explanation and several other ways in another thread, but I couldn't find it.
The only difference between os.pullEvent and os.pullEventRaw is that os.pullEvent has the terminate event.
function os.pullEventRaw( _sFilter )
return coroutine.yield( _sFilter )
end
function os.pullEvent( _sFilter )
local event, p1, p2, p3, p4, p5 = os.pullEventRaw( _sFilter )
if event == "terminate" then
print( "Terminated" )
error()
end
return event, p1, p2, p3, p4, p5
end