Reload script without losing players

Started by Nihongo^, Jul 30, 2023, 02:47 PM

Previous topic - Next topic

Nihongo^

Hy, every time I lose my players, whenever I restart my server from the control panel.

So I found this script in the forum, thinking it would help me to reload the script without losing players

But it gives me an error
case "reload":
if (highestRole.GetLevel() < 2) sendMessage(channels["staffchat"], "You do not have permission to use this command.");
else
  {
::onScriptUnload();
::ReloadScripts()
}
Fu error The index Disconnect SQL: does not exist



Xmair

You have a typo in your code. It is supposed to be DisconnectSQL, not DiscconectSQL

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

Nihongo^

Quote from: Xmair on Jul 30, 2023, 04:10 PMYou have a typo in your code. It is supposed to be DisconnectSQL, not DiscconectSQL
Thank you so much, it was a typo error

it reloaded the script, but some function not work like when i type /stats it said Kills doesn't exist any suggest ?


2b2ttianxiu

#4
The reason I don't use the "ReloadScript()" function is because I don't know if it calls functions that handle events (calling events such as onPlayerPart, onPlayerJoin, onPlayerRequestClass and onPlayerSpawn)

ToyDragon

Quote from: Nihongo^ on Jul 30, 2023, 02:47 PMHy, every time I lose my players, whenever I restart my server from the control panel.

So I found this script in the forum, thinking it would help me to reload the script without losing players

But it gives me an error
case "reload":
                            if (highestRole.GetLevel() < 2) sendMessage(channels["staffchat"], "You do not have permission to use this command.");
                            else
                             {
                            ::onScriptUnload();
                            ::ReloadScripts()
                            }   
Fu error The index Disconnect SQL: does not exist



Bro,I think is easy, just u need split ur script for example: main.nut & main2.nut ,and if u want to reload ur server just let the server dofile("main2.nut"); in fact our problem is that something can't do twice ,if do ,them will make error,so put that script in main.nut , just onServer first start to load that  and  put other thing in   main2.nut ,use dofile we can reload that main2.nut  script.

H.a.S.a.N

bro wrote in onscriptunload DiscconectSQL he should replace it with DisconnectSQL

its working fine with me