[SA-MP Server 0.3a RC7] PVar resetted too early at server restart
#1

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.
Reply
#2

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;
}
Reply
#3

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.
Reply
#4

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.
Reply
#5

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.
Reply
#6

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.
Reply
#7

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
Reply
#8

OnPlayerDisconnect is called on a gmx. The player is disconnecting from the gamemode.
Reply
#9

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)
Reply
#10

Maybe it's because of how much code I have in OnPlayerDisconnect, fair enough.
Reply
#11

GetPlayerPos doesn't work in OnPlayerDisconnect at gmx either
Reply
#12

So, when will this be fixed? Because this is an annoying bug.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)