ReloadScripts()

Started by Drake, Sep 12, 2015, 11:47 AM

Previous topic - Next topic

Drake

Hi there,

Is "ReloadScripts()" bugged? I am trying to use it but whenever I try to execute that function, the scripts get reloaded and the server works completely fine but the bot in the IRC channel doesn't disconnects by itself and "ping timeout" after sometime or disconnects if I close the server.
This used to happen in the previous version too.



KAKAN

oh no

Xmair

#2
Hope this works
else if ( cmd == "reloadscripts")
{
DisconnectBots(); //Or whatever you use to disconnect yours bots.
ReloadScripts();
}
Not tested.

Credits to Boystang!

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

KAKAN

Then don't activate again :P
else if ( cmd == "reloadscripts")
{
DisconnectBots(); //Or whatever you use to disconnect yours bots.
ReloadScripts();
ActivateEcho(); //But i like the reload system which stormeus made
}
oh no

Xmair

#4
@KAKAN , Please see my post, I edited it 15 hours later and you posted this after 13 hours of my post edited for just nothing.
You don't need to re-activate the echo if you have a line of activating the echo because "ReloadScripts();" calls the event onScriptload.
else if ( cmd == "reloadscripts" )
{
onScriptUnload();//Maybe it will work to call the onScriptUnload event. Make sure you have a disconnect bots line at your onScriptUnload event.
ReloadScripts();//Calls the onScriptLoad event.
}

Credits to Boystang!

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

KAKAN

Oops sorry, but try this:-
http://vcmp.liberty-unleashed.co.uk/forum/index.php?topic=2379.0
That's the best one I have ever seen
oh no

Drake

Quote from: Xmair on Sep 13, 2015, 08:31 AM@KAKAN , Please see my post, I edited it 15 hours later and you posted this after 13 hours of my post edited for just nothing.
You don't need to re-activate the echo if you have a line of activating the echo because "ReloadScripts();" calls the event onScriptload.
else if ( cmd == "reloadscripts" )
{
onScriptUnload();//Maybe it will work to call the onScriptUnload event. Make sure you have a disconnect bots line at your onScriptUnload event.
ReloadScripts();//Calls the onScriptLoad event.
}

Did you even test it? Even though I didn't test it, I can clearly say it won't work.

See, if that function is executed, first the bots will get disconnected and then how will it execute the next function if the bots are already disconnected?
ReloadScripts should do that itself and that's the bug.

Thijn

Quote from: Drake on Sep 13, 2015, 10:27 AM
Quote from: Xmair on Sep 13, 2015, 08:31 AM@KAKAN , Please see my post, I edited it 15 hours later and you posted this after 13 hours of my post edited for just nothing.
You don't need to re-activate the echo if you have a line of activating the echo because "ReloadScripts();" calls the event onScriptload.
else if ( cmd == "reloadscripts" )
{
onScriptUnload();//Maybe it will work to call the onScriptUnload event. Make sure you have a disconnect bots line at your onScriptUnload event.
ReloadScripts();//Calls the onScriptLoad event.
}

Did you even test it? Even though I didn't test it, I can clearly say it won't work.

See, if that function is executed, first the bots will get disconnected and then how will it execute the next function if the bots are already disconnected?
ReloadScripts should do that itself and that's the bug.
I can clearly say it will. onScriptUnload() is just a internal function. It wont actually do anything to the squirrel plugin.
Whether your IRC bots are online or not doesn't matter. Squirrel doesn't need IRC bots to work.

EK.IceFlake

Quote from: Thijn on Sep 13, 2015, 10:37 AMSquirrel doesn't need IRC bots to work.
Exactly. I laughed a bit at that part.

Drake

#9
Quote from: Thijn on Sep 13, 2015, 10:37 AM
Quote from: Drake on Sep 13, 2015, 10:27 AM
Quote from: Xmair on Sep 13, 2015, 08:31 AM@KAKAN , Please see my post, I edited it 15 hours later and you posted this after 13 hours of my post edited for just nothing.
You don't need to re-activate the echo if you have a line of activating the echo because "ReloadScripts();" calls the event onScriptload.
else if ( cmd == "reloadscripts" )
{
onScriptUnload();//Maybe it will work to call the onScriptUnload event. Make sure you have a disconnect bots line at your onScriptUnload event.
ReloadScripts();//Calls the onScriptLoad event.
}

Did you even test it? Even though I didn't test it, I can clearly say it won't work.

See, if that function is executed, first the bots will get disconnected and then how will it execute the next function if the bots are already disconnected?
ReloadScripts should do that itself and that's the bug.
I can clearly say it will. onScriptUnload() is just a internal function. It wont actually do anything to the squirrel plugin.
Whether your IRC bots are online or not doesn't matter. Squirrel doesn't need IRC bots to work.
I never said that squirrel needs IRC bots.
You're right but I was talking from the point of IRC. If we disconnect the bots from the IRC already then it wont execute the next function which is "ReloadScripts()".
As of you said that it will work from the server. I tried but it wont work properly, the script gets extremely buggy.

Thijn

#10
Of course it will execute the next function. What makes you believe it wont? Like I said, IRC has nothing to do with it. The reloadscripts command you want on IRC will execute fine if there's no IRC bot online.

Drake

Quote from: Thijn on Sep 13, 2015, 12:43 PMOf course it will execute the next function. What makes you believe it wont? Like I said, IRC has nothing to do with it. The reloadscripts command you want on IRC will execute fine if there's no IRC bot online.
So, I had a wrong idea about IRC bots and all but anyway it doesn't work.
Either the server crashes or the script becomes buggy.

KAKAN

Yea, the server crashes!
For that, u need to use this:-
    else if ( cmd ==  FBS_PREFIX + "r" )
    {
        if ( level < 6 ) EchoMessage(">> Error- You don't have access to it." );
    else
    {
 foreach( playerid, val in playerson )
                {
                     local plr = FindPlayer( playerid );
                    if ( plr ) onPlayerPart( plr, 0 );
                }
    EMessage(">>  Scripts Reloaded" );
NewTimer("Scriptsr",2000,1);
    }
    }

Then this:-
function Reload( )
{
    foreach( playerid, val in playerson )
        {
            local plr = FindPlayer( playerid );
            if ( plr )
                  {
NewTimer("Join",3000, 1, plr);
                  }
        }
}

function Scriptsr()
{
DisconnectBots();
   ReloadScripts();
}

function Join( plr )
{
                    onPlayerJoin( plr );
                    if( plr.IsSpawned ) onPlayerSpawn( plr );
}

Put this on your onscriptload event:-
Reload();
It just works fine for me

Hope you convert this snip according to your use
Credits:- @Dany , @Stormeus
oh no

Drake

Instead of doing all these, I made a function with all the dofile's and called it in a cmd and it works very fine unless we want to reload the main.nut.
Anyway thanks everyone.

Locking this topic.