SA-MP Forums Archive
Debug - 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: Debug (/showthread.php?tid=583044)



Debug - ZaBraNjeNi - 25.07.2015

If I type /kill I get this errors:
Code:
[13:28:18] [debug] Run time error 4: "Array index out of bounds"
[13:28:18] [debug]  Accessing element at index 65535 past array upper bound 199
[13:28:18] [debug] AMX backtrace:
[13:28:18] [debug] #0 00062a48 in public L_AFK_OPD (playerid=0, killerid=65535, reason=255) at C:\Documents and Settings\Nikola\Desktop\mode\gamemodes\mode.pwn:8829
[13:28:18] [debug] #1 native CallLocalFunction () from sampsvr-port_9856
[13:28:18] [debug] #2 00010ca8 in public FC_OnPlayerDeath (playerid=0, killerid=65535, reason=255) at C:\Documents and Settings\Nikola\Desktop\mode\pawno\include\AutoAFK.inc:110
[13:28:18] [debug] #3 native CallLocalFunction () from sampsvr-port_9856
[13:28:18] [debug] #4 000022fc in public OnPlayerDeath (playerid=0, killerid=65535, reason=255) at C:\Documents and Settings\Nikola\Desktop\mode\pawno\include\fuckcleo_-_include.inc:157
Line of errors:
1.
Code:
KillingSpree[killerid]++;
2.
Code:
CallLocalFunction("L_AFK_OPD", "iii", playerid, killerid, reason);
3.
Code:
return ( FC_OPD ) ? CallLocalFunction( "FC_OnPlayerDeath", "ddd", playerid, killerid, reason ) : 1;



Re: Debug - JaydenJason - 25.07.2015

Check if the killerid is a valid id

Code:
if(killerid != INVALID_PLAYER_ID)
{
    KillingSpree[killerid] ++;
}



AW: Debug - Mencent - 25.07.2015

Hello!

PHP Code:
if(killerid != INVALID_PLAYER_ID)
{
    
KillingSpree[killerid] ++;

PHP Code:
if(killerid != INVALID_PLAYER_ID)
{
    
CallLocalFunction("L_AFK_OPD","iii",playerid,killerid,reason);

PHP Code:
if(killerid != INVALID_PLAYER_ID)
{
    return (
FC_OPD) ? (CallLocalFunction("FC_OnPlayerDeath","iii",playerid,killerid,reason)) : (1);

- Mencent


Re: Debug - ZaBraNjeNi - 25.07.2015

Here's it:
Code:
 if(killerid != INVALID_PLAYER_ID && IsPlayerConnected(killerid))



AW: Debug - Mencent - 25.07.2015

Then you have to give us the whole code so that we can see a lot of more code.


- Mencent


Re: Debug - ZaBraNjeNi - 25.07.2015

Code:
public OnPlayerDeath(playerid, killerid, reason){

        SendDeathMessage(killerid, playerid, reason);
        if(DM_InDM[playerid] >= 1) RemoveL_eTD(playerid);
 	if(killerid != INVALID_PLAYER_ID && IsPlayerConnected(killerid))
 	{
		if(!IsPlayerInAnyVehicle(killerid))
		{
			if(DM_InDM[killerid] >= 1 && DM_InDM[playerid] >= 1)
			{
				//some codes
			}
		}	
	}
	if(SPInstunt[playerid] == 1) SPInstunt[playerid] = 0;
        if(Joined[playerid] == true)
        {
           //some codes
	}
       //killing spreee
       KillingSpree[playerid] = 0;
       KillingSpree[killerid]++;



Re: Debug - xVIP3Rx - 25.07.2015

Check if "killerid != INVALID_PLAYER_ID" before doing anything with it on your kill command.


Re: Debug - ZaBraNjeNi - 25.07.2015

Quote:
Originally Posted by xVIP3Rx
View Post
Check if "killerid != INVALID_PLAYER_ID" before doing anything with it on your kill command.
Same.


Re: Debug - xVIP3Rx - 25.07.2015

Show me your "/kill command"