SA-MP Forums Archive
debugs - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: debugs (/showthread.php?tid=619405)



debugs - XBossX - 17.10.2016

Код:
[14:20:03] [kill] Alao killed DaniHD Sniper Rifle
[14:20:07] [debug] Run time error 4: "Array index out of bounds"
[14:20:07] [debug]  Attempted to read/write array element at negative index -1
[14:20:07] [debug] AMX backtrace:
[14:20:07] [debug] #0 0008bd7c in public OnPlayerSpawn (playerid=10) at E:\Samp-Files\aGamemodes\BB\gamemodes\BBTDM1-2.pwn:7967
Код:
    g_GotInvitedToDuel[playerid] = 0;
    g_HasInvitedToDuel[playerid] = 0;
    g_IsPlayerDueling[playerid]  = 0;
    if(g_DuelingID1 != INVALID_PLAYER_ID)
    {
       g_GotInvitedToDuel[g_DuelingID1] = 0; //7967 line
       g_HasInvitedToDuel[g_DuelingID1] = 0;
       g_IsPlayerDueling[g_DuelingID1]  = 0;
	}
    g_DuelInProgress = 0;
   	g_DuelingID1 = -1;
	g_DuelingID2 = -1;
does anybody have any idea whats wrong ?


Re: debugs - ThatFag - 17.10.2016

how you define
g_DuelingID1


Re: debugs - XBossX - 17.10.2016

Код:
stock
	g_GotInvitedToDuel[MAX_PLAYERS],
	g_HasInvitedToDuel[MAX_PLAYERS],
	g_IsPlayerDueling[MAX_PLAYERS],
	g_DuelCountDown[MAX_PLAYERS],
	g_Weapon,
	g_DuelTimer[MAX_PLAYERS],
	g_DuelInProgress,
	g_DuelingID1,
	g_DuelingID2;



Re: debugs - ThatFag - 17.10.2016

do it
Код:
new g_DuelingID1 = 1;
if i'd be you , i would be using Enums for these.


Re: debugs - Konstantinos - 17.10.2016

You reset to -1 but check if it is not equal to INVALID_PLAYER_ID. Change the check to:
pawn Код:
if(g_DuelingID1 != -1)