[SA-MP Server 0.3a RC7] PVar resetted too early at server restart -
Wanted1900 - 11.04.2010
I found an SA-MP bug. The PVars are resetted
before OnPlayerDisconnect is called, when you
restart the server. If you leave the server it works.
Take a look at this:
Код:
[17:52:50] [chat] [Wanted]: I am now restarting...
[17:52:52] RCON (In-Game): Player [Wanted] sent command: gmx
[17:52:52] MyVar: 0
[17:53:04] Number of vehicle models: 0
[17:53:13] [chat] [Wanted]: And now i am leaving the server.
[17:53:17] MyVar: 5
[17:53:17] [part] Wanted has left the server (2:1)
You see that the PVar: "MyVar" is resetted to zero if i restart the server, but not if i am leaving the server.
The code that i used is:
Код:
public OnPlayerConnect(playerid)
{
SetPVarInt(playerid, "MyVar", 5);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
printf("MyVar: %d", GetPVarInt(playerid, "MyVar"));
return 1;
}
Because of this bug, my stats are not saved, because the PVar which is checking if i'm logged in fails, because the PVar is resetted.
Sorry for my bad English.
Wanted.
Re: [SA-MP Server 0.3a RC7] PVar resetted too early at server restart -
Joe Staff - 11.04.2010
Well, you'll just have to work around it.
pawn Код:
public OnRconCommand(cmd[])
{
if(!strcmp(cmd,"GMX2",true))
{
for(new playerid;playerid<MAX_PLAYERS;playerid++)OnPlayerDisconnect(playerid,-1);
SendRconCommand("gmx");
}
return 1;
}
Re: [SA-MP Server 0.3a RC7] PVar resetted too early at server restart -
Zamaroht - 11.04.2010
Just tested it, confirming. I'm using windows server. I tested it doing gmx from ingame and from the console too, both times had the bug happening.
Re: [SA-MP Server 0.3a RC7] PVar resetted too early at server restart - WackoX - 12.04.2010
This is not only a PVar bug, i got this to.
When i restart my server with rcon gmx or GameModeExit(); it does load OnPlayerDisconnect, but the accounts are not getting saved?
Not a scritp problem because almost every gamemode has this.
Re: [SA-MP Server 0.3a RC7] PVar resetted too early at server restart -
Calgon - 12.04.2010
OnPlayerDisconnect isn't called on GMXes, I'm pretty sure this is in the list of bugs. I had to make a workaround for my server.
Re: [SA-MP Server 0.3a RC7] PVar resetted too early at server restart -
Wanted1900 - 12.04.2010
Quote:
Originally Posted by WackoX
This is not only a PVar bug, i got this to.
When i restart my server with rcon gmx or GameModeExit(); it does load OnPlayerDisconnect, but the accounts are not getting saved?
Not a scritp problem because almost every gamemode has this.
|
If i use normal variables (For example: new Logged[MAX_PLAYERS]) it
does save my account. But if i use PVars, they are not saved. In OnPlayerDisconnect the server is checking if they are logged in, and if they are, the accounts are saved.
Quote:
Originally Posted by FreddoX [BINMAN
]
OnPlayerDisconnect isn't called on GMXes, I'm pretty sure this is in the list of bugs. I had to make a workaround for my server.
|
OnPlayerDisconnect
IS called on GMXes.
Re: [SA-MP Server 0.3a RC7] PVar resetted too early at server restart -
Ibanez - 12.04.2010
Quote:
Originally Posted by Wanted1900
OnPlayerDisconnect IS called on GMXes.
|
No, it isnt... add
print("Howdy"); to OnPlayerDisconnect and then test it out by the server console, it isnt shown in the console.
Edit: But now i think of it... it is called during gmx because when i do gmx in my server i get the leave messages... so thats a weird one
Re: [SA-MP Server 0.3a RC7] PVar resetted too early at server restart -
Jay_ - 12.04.2010
OnPlayerDisconnect is called on a gmx. The player is disconnecting from the gamemode.
Re: [SA-MP Server 0.3a RC7] PVar resetted too early at server restart -
Wanted1900 - 12.04.2010
Quote:
Originally Posted by 6fears7
Quote:
Originally Posted by Wanted1900
OnPlayerDisconnect IS called on GMXes.
|
No, it isnt... add print("Howdy"); to OnPlayerDisconnect and then test it out by the server console, it isnt shown in the console.
|
Код:
[15:09:04] Incoming connection: ***
[15:09:04] [join] Wanted has joined the server (2:***)
Console input: gmx
[15:09:20] Howdy
[15:09:20] [npc:part] Bot2 has left the server (0:2)
[15:09:20] [npc:part] Bot1 has left the server (1:2)
Re: [SA-MP Server 0.3a RC7] PVar resetted too early at server restart -
Calgon - 12.04.2010
Maybe it's because of how much code I have in OnPlayerDisconnect, fair enough.
Re: [SA-MP Server 0.3a RC7] PVar resetted too early at server restart -
beckzy - 12.04.2010
GetPlayerPos doesn't work in OnPlayerDisconnect at gmx either
Re: [SA-MP Server 0.3a RC7] PVar resetted too early at server restart -
Wanted1900 - 14.04.2010
So, when will this be fixed? Because this is an annoying bug.