Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Nihongo^ on Sep 01, 2023, 06:37 PM

Title: reload script didn't save the data after rejoin
Post by: Nihongo^ on Sep 01, 2023, 06:37 PM
Hi, i just tried this function to reload my script https://forum.vc-mp.org/index.php?topic=9251.msg53101#msg53101

but the problem is its wont save the data after the player rejoin
In this pic i killed my self after reload the script but it didn't save the data "death" in the database
 
(https://i.postimg.cc/m2wXyR4j/Untitled.png)

P.S I only add onPlayerCommand, getOnlinePlayers,getPlayer(object)  and ignore the rest

"In main.nut"

Title: Re: reload script didn't save the data after rejoin
Post by: Nihongo^ on Sep 03, 2023, 07:59 AM
???
Title: Re: reload script didn't save the data after rejoin
Post by: Mohamed Boubekri on Sep 03, 2023, 01:39 PM
You need to explain more about your problem, and show us your onplayerdeath & onplayerpart functions.
Title: Re: reload script didn't save the data after rejoin
Post by: 2b2ttianxiu on Oct 01, 2023, 12:45 PM
u can try use me reload script code(not raw reload)
Title: Re: reload script didn't save the data after rejoin
Post by: VEGETAZ on Dec 02, 2023, 10:55 PM
I do Not recommand to use that function. It will cause bug.
Manually restarting would be best.
ps. Are you Japanese?
Title: Re: reload script didn't save the data after rejoin
Post by: 2b2ttianxiu on Jan 30, 2024, 11:17 AM
I have question. Do you change your content?

if maybe
please take your code to me
i need check it
Title: Re: reload script didn't save the data after rejoin
Post by: PSL on Feb 17, 2024, 06:45 AM
I'll try to fix his instructions, see if I can help you. I added the onPlayerPart event to simulate the player quitting.
if (cmd == "reload") {
    local loaded = []
    foreach (v in getOnlinePlayers())
   {
        if (getPlayer(v.ID) != null && getPlayer(v.ID).Spawned)
        {
                 loaded.append(getPlayer(v.ID))
        }
    }
    for(local i=0;i<100;i++)
    {
        local plr=FindPlayer(i);
        if(plr)
        {
            onPlayerPart(plr,1);
        }
    }
    onServerStop();
    dofile("main.nut") // your main script.
    onScriptLoad()
    foreach (b in getOnlinePlayers()) {
        onPlayerJoin(getPlayer(b.ID))
    }
    foreach (plr in loaded) {
        onPlayerRequestClass(plr, plr.Class, plr.Team, plr.Skin)
        if (plr.IsSpawned) onPlayerSpawn(plr)
    }
    AnnounceAll("Reloaded.", 0)
    return 1;
}