Very strange dialog problem
#1

Hello. I'm having an issue with MySQL or easyDialog (can't really get to know which one is causing it).

So basically, I'm starting my samp server, logging in and my login or register dialog shows, everything's ok. I can login, but when I quit the game and try to login again, the dialog won't appear anymore. For that to work, I will have to close samp-server.exe and start it again, otherwise won't work. Here's a few errors / warnings server_log shows.. It's really strange.

PHP код:
[02:42:48] [debugRun time error 4"Array index out of bounds"
[02:42:48] [debug]  Accessing element at index 65535 past array upper bound 999
[02:42:48] [debugAMX backtrace:
[
02:42:48] [debug#0 0004b5e0 in ?? (0x00000000) from deathmatch.amx
[02:42:48] [debug#1 0006a4f0 in public WC_OnPlayerConnect (0x00000000) from deathmatch.amx
[02:42:48] [debug#2 00032dc0 in public _y_utils_OnPlayerConnect (0x00000000) from deathmatch.amx
[02:42:48] [debug#3 0000e2bc in public IPL_OnPlayerConnect (0x00000000) from deathmatch.amx
[02:42:48] [debug#4 00007cbc in public SSCANF_OnPlayerConnect (0x00000000) from deathmatch.amx
[02:42:48] [debug#5 000014f0 in ?? (0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, ... <1073741813 arguments>) from deathmatch.amx
[02:42:48] [debug#6 0000f504 in public OnPlayerConnect (0x00000000) from deathmatch.amx 
OnPlayerConnect:

pawn Код:
public OnPlayerConnect(playerid)
{
    ResetDuelInfo(playerid);

    PlayerInfo[playerid][Admin] = 0;
    PlayerInfo[playerid][Money] = 0;
    PlayerInfo[playerid][Kills] = 0;
    PlayerInfo[playerid][Deaths] = 0;
    PlayerInfo[playerid][Skin] = 0;
    PlayerInfo[playerid][MutedTime] = 0;
    PlayerInfo[playerid][JailedTime] = 0;

    new query[1500];
    GetPlayerName(playerid, Name[playerid], 24);
    GetPlayerIp(playerid, IP[playerid], 16);
    mysql_format(Database, query, sizeof(query),"SELECT `Password`, `ID` FROM `players` WHERE `Username` = '%e' LIMIT 1", Name[playerid]);
    mysql_tquery(Database, query, "OnAccountCheck", "i", playerid);

    new array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    mysql_format(Database, query, sizeof(query), "SELECT * FROM `players` WHERE `IP` LIKE '%e%'", IP[playerid]);
    mysql_pquery(Database, query, "CheckIP", "dad", playerid, array, sizeof(array));
    return 1;
}
Reply
#2

Compiling with -d3 flag will log the line.

The run time error is in a non-public function with one parameter (playerid) which is `ResetDuelInfo` function. It also confirms it because it stops the code execution (account check).
Reply
#3

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
Compiling with -d3 flag will log the line.

The run time error is in a non-public function with one parameter (playerid) which is `ResetDuelInfo` function. It also confirms it because it stops the code execution (account check).
So what should I do about it?

EDIT:

I just took my duel system out of the gamemode and as you said ResetDuelInfo was causing it.. Here's the code for that:

PHP код:
stock ResetDuelInfo(playerid)
{
    for(new 
03i++)
    {
        
DuelInfo[playerid][Weapon][i] = 0;
    }
    for(new 
04i++)
    {
        
DuelerID[DuelInfo[playerid][Team][i]] = NONE;
        
DuelInfo[playerid][Team][i] = NONE;
        
DuelInfo[playerid][StatusTeam][i] = 0;
    }
    for(new 
04i++)
    {
        
DuelerID[DuelInfo[playerid][Enemy][i]] = NONE;
        
DuelInfo[playerid][Enemy][i] = NONE;
        
DuelInfo[playerid][StatusEnemy][i] = 0;
    }
    
DuelInfo[playerid][Team][0] = playerid;
    
DuelInfo[playerid][StatusTeam][0] = 2;
    
DuelInfo[playerid][Map] = 0;
    
DuelInfo[playerid][Health] = 100;
    
DuelInfo[playerid][Armour] = 0;
    
DuelInfo[playerid][LineUP] = 0;
    
DuelerID[playerid] = NONE;
    
DuelTotalEnemy[playerid] = 0;
    
DuelTotalTeammate[playerid] = 0;
    return 
1;

Reply
#4

PHP код:
DuelerID[DuelInfo[playerid][Team][i]] = NONE
How much is MAX_TEAMS?
Maybe NONE is 65535?
Reply
#5

Quote:
Originally Posted by v1k1nG
Посмотреть сообщение
PHP код:
DuelerID[DuelInfo[playerid][Team][i]] = NONE
How much is MAX_TEAMS?
Maybe NONE is 65535?
That's not defined, btw I didn't make this duel system myself, someone else made it.

So, I just realised. I put ResetDuelInfo at the end of OnPlayerConnect, and now everything works, the dialog shows even after i re-log, but the error is still there..

PHP код:
[14:58:34] [joinwillbedie has joined the server (0:127.0.0.1)
[
14:58:34] [debugRun time error 4"Array index out of bounds"
[14:58:34] [debug]  Accessing element at index 65535 past array upper bound 999
[14:58:34] [debugAMX backtrace:
[
14:58:34] [debug#0 0004b5e0 in ?? (0x00000000) from deathmatch.amx
[14:58:34] [debug#1 0006a784 in public WC_OnPlayerConnect (0x00000000) from deathmatch.amx
[14:58:34] [debug#2 00032dc0 in public _y_utils_OnPlayerConnect (0x00000000) from deathmatch.amx
[14:58:34] [debug#3 0000e2bc in public IPL_OnPlayerConnect (0x00000000) from deathmatch.amx
[14:58:34] [debug#4 00007cbc in public SSCANF_OnPlayerConnect (0x00000000) from deathmatch.amx
[14:58:34] [debug#5 000014f0 in ?? (0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, ... <1073741813 arguments>) from deathmatch.amx
[14:58:34] [debug#6 0000f504 in public OnPlayerConnect (0x00000000) from deathmatch.amx 
Reply
#6

https://sampwiki.blast.hk/wiki/Limits

MAX_PLAYERS is 1000,
PHP код:
DuelerID[DuelInfo[playerid][Team][i]] = NONE
is giving NONE index which may be the cause.
Check NONE value
Reply
#7

Quote:
Originally Posted by v1k1nG
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/Limits

MAX_PLAYERS is 1000,
PHP код:
DuelerID[DuelInfo[playerid][Team][i]] = NONE
is giving NONE index which may be the cause.
Check NONE value
I changed every NONE to INVALID_PLAYER_ID
Reply
#8

Does it allow up to 4v4 duels? What if it is a 1v1? The last three indexes will be NONE and access invalid index.
pawn Код:
for(new i = 0; i < 4; i++)
{
    if (DuelInfo[playerid][...][i] != NONE)
    {
        DuelerID[DuelInfo[playerid][...][i]] = NONE;
        DuelInfo[playerid][...][i] = NONE;
        DuelInfo[playerid][Status...][i] = 0;
    }
}
which ... is "Team" and "Enemy".

Resetting the duel variables and then their participants variables separated is better because I believe you call `ResetDuelInfo` function for all participants and if it allows 4v4, then it will reset the teams many times instead of only one.
Reply
#9

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
Does it allow up to 4v4 duels? What if it is a 1v1? The last three indexes will be NONE and access invalid index.
pawn Код:
for(new i = 0; i < 4; i++)
{
    if (DuelInfo[playerid][...][i] != NONE)
    {
        DuelerID[DuelInfo[playerid][...][i]] = NONE;
        DuelInfo[playerid][...][i] = NONE;
        DuelInfo[playerid][Status...][i] = 0;
    }
}
which ... is "Team" and "Enemy".

Resetting the duel variables and then their participants variables separated is better because I believe you call `ResetDuelInfo` function for all participants and if it allows 4v4, then it will reset the teams many times instead of only one.
Yeah as I said I didn't make this system, so I might just take it out... But still I need it.
Reply
#10

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
Compiling with -d3 flag will log the line.
^^
If you didn't get what he meant:
Create pawn.cfg into your pawno directory and put -d3 on it, recompile the script, run it, and it will give you the exactly lines where it crash.

Thank me later.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)