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"
???
You need to explain more about your problem, and show us your onplayerdeath & onplayerpart functions.
u can try use me reload script code(not raw reload)
I do Not recommand to use that function. It will cause bug.
Manually restarting would be best.
ps. Are you Japanese?
I have question. Do you change your content?
if maybe
please take your code to me
i need check it
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;
}