Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Drake on Sep 12, 2015, 11:47 AM

Title: ReloadScripts()
Post by: Drake on Sep 12, 2015, 11:47 AM
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.


Title: Re: ReloadScripts()
Post by: KAKAN on Sep 12, 2015, 12:00 PM
Ya, same problem
Title: Re: ReloadScripts()
Post by: Xmair on Sep 12, 2015, 05:44 PM
Hope this works
else if ( cmd == "reloadscripts")
{
DisconnectBots(); //Or whatever you use to disconnect yours bots.
ReloadScripts();
}
Not tested.
Title: Re: ReloadScripts()
Post by: KAKAN on Sep 13, 2015, 06:14 AM
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
}
Title: Re: ReloadScripts()
Post by: 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.
}
Title: Re: ReloadScripts()
Post by: KAKAN on Sep 13, 2015, 08:45 AM
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
Title: Re: ReloadScripts()
Post by: 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.
Title: Re: ReloadScripts()
Post by: 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.
Title: Re: ReloadScripts()
Post by: EK.IceFlake on Sep 13, 2015, 11:46 AM
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.
Title: Re: ReloadScripts()
Post by: Drake on Sep 13, 2015, 12:29 PM
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.
Title: Re: ReloadScripts()
Post by: Thijn on Sep 13, 2015, 12:43 PM
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.
Title: Re: ReloadScripts()
Post by: Drake on Sep 13, 2015, 12:48 PM
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.
Title: Re: ReloadScripts()
Post by: KAKAN on Sep 13, 2015, 01:44 PM
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
Title: Re: ReloadScripts()
Post by: Drake on Sep 13, 2015, 04:21 PM
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.