PDA

View Full Version : Error with ID 301+ (server force acc to registration)


Stereotype
23/10/2013, 05:48 PM
Hi, i have big problem with my script.

Please, don't say me that my max_players is not on 500, because it is, it is everywhere on 500 (in gamemode, junkbuster, server.cfg...).

The problem is next: Server works perfect, without lags, but when id 301 and + (300 works great = thats 301 players online, 0+300) tries to connect, script automaticly set user variable gPlayerAccount[playerid] = 0; (not found acc) and send user to a registration process.

Also, server gives random colors to nicknames on TAB for ID 301+. (exc: purple, blue, red, green...)

I have no idea what's going on, I tried 100 things to solve this annoying problem! :@

Please, help if you know ! Thanks!

Jay_
23/10/2013, 06:05 PM
The most likely cause of this issue is a buffer over/underflow in your script. For example, You may have an array with an index size defined at 300, and are trying to set the value of an index larger than 300 (i.e. representing the player's ID) to a value.

new bool:is_player_logged_in[300];

public OnPlayerConnect(playerid)
{
// If player connects with an ID larger or equal to 300 an overflow will occur
is_player_logged_in[ playerid ] = false;
}

The best way to trace buffer overflows is to look up the crash detect plugin. You can set an option in your server.cfg called die_on_error which the plugin will recognise. This will cause the server to exit when a runtime error or buffer overflow like this occurs. Whilst this approach may at first be extreme for a server that has 300 players connected to it, it's an effective method of eventually digging out all potential overflow issues. Alternatively, you could run unit tests or use resources like NPCs to simulate players.

Stereotype
23/10/2013, 06:22 PM
new bool:is_player_logged_in[300];

public OnPlayerConnect(playerid)
{
// If player connects with an ID larger or equal to 300 an overflow will occur
is_player_logged_in[ playerid ] = false;
}

I don't have anything simular like that in my script, i have gActivePlayers[playerid]++; in onplayerconnect, but that's defined like new gActivePlayers[MAX_PLAYERS];

:S

Konstantinos
23/10/2013, 06:57 PM
Even so you should load crashdetect plugin because it's very useful and it might give something related to your problem.

It can be found: https://github.com/Zeex/samp-plugin-crashdetect/releases/tag/v4.12

Stereotype
24/10/2013, 03:02 PM
it still can't work .. Everything is okay but if there is some problems around login or saving .. If there is some problem it woldn't save lower player id's accont

Akira297
24/10/2013, 03:08 PM
Is your database allowing more than a 300 player entry? You are pointing out that it forces people to re-registrar.

Stereotype
24/10/2013, 03:53 PM
read the second started theme..