10/08/2021 19:32 
	
	
	
		Boa noite.
Estou com alguns problemas de lentidão no servidor, quando começa a bater bastante players.
Acionei o CrashDetect para tentar detectar algum problema e o seguinte me chamou atenção:
[18:18:53] [debug] #0 0001b564 in public FIXES_OnGameModeInit () at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\sscanf2.inc:199
[18:18:53] [debug] #1 00005220 in public OnGameModeInit () at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\fixes.inc:8068
[18:18:56] [debug] AMX backtrace:
[18:18:56] [debug] #0 00012674 in CPSERVICE_getdist (playerid=111, Float:x2=-1830.03796, Float:y2=2484.25391, Float:z2=77.59250) at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\cpstream.inc:114
[18:18:56] [debug] #1 00011ec8 in public CPSERVICE_Handler () at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\cpstream.inc:86
[18:18:57] [debug] Long callback execution detected (hang or performance issue)
[18:18:57] [debug] AMX backtrace:
[18:18:57] [debug] #0 00011d80 in public CPSERVICE_Handler () at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\cpstream.inc:84
[18:18:57] [debug] Long callback execution detected (hang or performance issue)
[18:18:57] [debug] AMX backtrace:
[18:18:57] [debug] #0 00011d90 in public CPSERVICE_Handler () at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\cpstream.inc:84
[18:18:58] [debug] Long callback execution detected (hang or performance issue)
[18:18:58] [debug] AMX backtrace:
[18:18:58] [debug] #0 00011d34 in public CPSERVICE_Handler () at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\cpstream.inc:83
[18:18:58] [debug] Long callback execution detected (hang or performance issue)
	
	
	
	
Estou com alguns problemas de lentidão no servidor, quando começa a bater bastante players.
Acionei o CrashDetect para tentar detectar algum problema e o seguinte me chamou atenção:
[18:18:53] [debug] #0 0001b564 in public FIXES_OnGameModeInit () at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\sscanf2.inc:199
[18:18:53] [debug] #1 00005220 in public OnGameModeInit () at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\fixes.inc:8068
Código:
public OnGameModeInit()
{
        if (!SSCANF_gInit)
        {
            new
                name[MAX_PLAYER_NAME + 1];
            SSCANF_Init(GetMaxPlayers(), INVALID_PLAYER_ID, MAX_PLAYER_NAME);
            SSCANF_gInit = true;
            // Check if there are any players that aren't initialized.
            for (new i = 0; i < MAX_PLAYERS; i ++) // LINHA DE ERRO 199
            {
                if (IsPlayerConnected(i) && !SSCANF_IsConnected(i))
                {
                    GetPlayerName(i, name, sizeof(name));
                    SSCANF_Join(i, name, IsPlayerNPC(i));
                }
            }
        }
        #if defined SSCANF_OnGameModeInit
            SSCANF_OnGameModeInit();
        #endif
        return 1;
}[18:18:56] [debug] AMX backtrace:
[18:18:56] [debug] #0 00012674 in CPSERVICE_getdist (playerid=111, Float:x2=-1830.03796, Float:y2=2484.25391, Float:z2=77.59250) at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\cpstream.inc:114
[18:18:56] [debug] #1 00011ec8 in public CPSERVICE_Handler () at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\cpstream.inc:86
[18:18:57] [debug] Long callback execution detected (hang or performance issue)
[18:18:57] [debug] AMX backtrace:
[18:18:57] [debug] #0 00011d80 in public CPSERVICE_Handler () at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\cpstream.inc:84
[18:18:57] [debug] Long callback execution detected (hang or performance issue)
[18:18:57] [debug] AMX backtrace:
[18:18:57] [debug] #0 00011d90 in public CPSERVICE_Handler () at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\cpstream.inc:84
[18:18:58] [debug] Long callback execution detected (hang or performance issue)
[18:18:58] [debug] AMX backtrace:
[18:18:58] [debug] #0 00011d34 in public CPSERVICE_Handler () at C:\Users\Thiago\Desktop\GameMod\Gamemode\pawno\include\cpstream.inc:83
[18:18:58] [debug] Long callback execution detected (hang or performance issue)
Código:
public CPSERVICE_Handler()
{
    for(new i; i<MAX_PLAYERS; i++){
        new Float:prevdist = 100000.000;
        new prevcp;
        for(new cpid=1; cpid < MAX_CHECKPOINTS; cpid++){ // LINHA DE ERRO 83
            if(UsedCPSlot[cpid]) { // LINHA DE ERRO 84
                new Float:dist;
                dist = CPSERVICE_getdist(i,Checkpoints[cpid][cpX],Checkpoints[cpid][cpY],Checkpoints[cpid][cpZ]); // LINHA DE ERRO 86
                if(dist < prevdist){
                    prevdist = dist;
                     prevcp = cpid;
                }
            }
        }
        new cpid=prevcp;
        if(CPSERVICE_getdist(i,Checkpoints[cpid][cpX],Checkpoints[cpid][cpY],Checkpoints[cpid][cpZ]) < Checkpoints[cpid][cpsd]) {
            if(CPSERVICE_actualcp[i] != cpid){
                SetPlayerCheckpoint(i,Checkpoints[cpid][cpX],Checkpoints[cpid][cpY],Checkpoints[cpid][cpZ],Checkpoints[cpid][cpsz]);
                CPSERVICE_actualcp[i] = cpid;
            }
        } else {
            if(CPSERVICE_actualcp[i] != 0){
                CPSERVICE_actualcp[i] = 0;
                DisablePlayerCheckpoint(i);
            }
        }
    }
    return 1;
}
 
	   
	



 
