Ulysses
General => Developers Corner => Topic started by: nathan736 on January 28, 2013, 09:07:30 PM
-
if ( CLIENT ) then
function didwecrash()
if (not wedidcrashdamit) then
timer.stop( "didwecrash" )
timer.Destroy( "didwecrash" )
end
if (not timer.IsTimer("didwecrash")) then
wedidcrashdamit = true
timer.Create("didwecrash", 20, 1,function()
if (not wedidcrashdamit == nil) and wedidcrashdamit then
RunConsoleCommand("connect 50.31.65.166:27015")
end
end)
end
end
hook.Add("Think",didwecrash,wecrashed)
local function RecvMyUmsg( data )
wedidcrashdamit = data:ReadBool()
end
usermessage.Hook( "didwecrash", RecvMyUmsg );
end
if ( SERVER ) then
function sdidwecrash()
if (not timer.IsTimer("sendcrashinfop")) then
timer.Create("sendcrashinfop", 5, 0,function()
umsg.Start( "didwecrash" );
umsg.Bool( false );
umsg.End();
end)
end
end
hook.Add("Think",sdidwecrash,swecrashed)
end
my objective here is to make the client rejoin the server if the server crashes or lags big time
-
I might be wrong here.. but I think that clientside scriptings stop when the client disconnects.
I don't think this is possible.
-
so the client disconnects if the server lags hard core... dam it did garry change something i saw a server do it in gmod 12 or something
-
It might be possible, I'm not sure how you'd go about doing it, but it would have to be entirely client-side code. If the server crashes or gets severely lagged, it's not going to have any time to politely inform the clients that it crashed.
-
if ( CLIENT ) then
print("||retry system loaded!||")
function didwecrash() -- client auto ran crash checker
if (not timer.IsTimer("didwecrash")) then
wedidcrashdamit = true
timer.Create("didwecrash", 20, 1,function()
if (not wedidcrashdamit == nil) and wedidcrashdamit then
print("we should be rejoing now")
RunConsoleCommand("connect 50.31.65.166:27015")
end
end)
timer.start("didwecrash")
end
if (not wedidcrashdamit) then
timer.stop( "didwecrash" )
timer.Destroy( "didwecrash" )
timer.Create("didwecrash",20,1,function() -- creates a timer that restarts if true
print("we should be rejoing now")
RunConsoleCommand("connect 50.31.65.166:27015")
end)
timer.start("didwecrash")
end
end
hook.Add("Think",didwecrash,wecrashed)
local function RecvMyUmsg( data )
wedidcrashdamit = data:ReadBool()
end
usermessage.Hook( "didwecrash", RecvMyUmsg );
end
if ( SERVER ) then
function sdidwecrash()
if (not timer.IsTimer("sendcrashinfop")) then
timer.simple("sendcrashinfop", 10, 0,function()
umsg.Start( "didwecrash" )
umsg.Bool( false )
umsg.End()
end)
end
timer.start("sendcrashinfop")
end
end
hook.Add("Think",sdidwecrash,swecrashed)
this clearly does not work i think timers are synced with the server :/
-
this clearly does not work i think timers are synced with the server :/
99% sure of this;
clientside scriptings stop when the client disconnects.
Can you imagine the horrors of some not-so-nice server host causing you to do things once you connected to another server?
I can. *shiver*
-
EDIT : wowowo back up the client disconnects if the server lags ? im confuzled
is think hook synced as well ?
-
If a server lags for long enough, and the client's frame "keep alive" packets never get acknowledged from the server, yes, the client will disconnect.
I've not played GM13 enough to have seen it, but in GM<12 it was a little red text at top right of screen with something like 'connection issue: <and ip I think>'.
As for the think hook, i don't know if it's synced or not, but I would imagine some hooks are.
-
I've not played GM13 enough to have seen it, but in GM<12 it was a little red text at top right of screen with something like 'connection issue: <and ip I think>'.
It's the same in GM13.