[POMOC]CRASH


Započeo xLanmi, Mart 27, 2016, 18:10:20 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim:Steel Series ili kako ja to volim da kazem:Moj edit UP-a Posto je dosta editovan
Detaljno objasnjenje problema:Ovako,imamm jedan problem kada pored neke mape prodjem prodje malo vremena dobijem crash,znaci tako pored spawna ili kad se killam ono cmd:kill pa kad umrem odma crash izaslo mi je u crashdetect samo ovo jedanput.
Sta mi je ispisalo:
[08:27:59] [debug] Run time error 4: "Array index out of bounds"
[08:27:59] [debug]  Accessing element at index 65535 past array upper bound 149
[08:27:59] [debug] AMX backtrace:
[08:27:59] [debug] #0 00375430 in ?? (65535) from SPuerto.amx
[08:27:59] [debug] #1 001c7868 in public OnPlayerDeath (0, 65535, 54) from SPuerto.amx
[08:29:43] [part] Lanmi has left the server (0:0)

Dole cu vam ostaviti to onplayerdeath
Deo skripte:
public OnPlayerDeath(playerid, killerid, reason)
{
    antifakekill[playerid] ++;
    SetTimerEx("antifakekill2", 1000,false,"i",playerid);
	RemovePlayerAttachedObject(playerid,0);
	RemovePlayerAttachedObject(playerid,1);
	RemovePlayerAttachedObject(playerid,2);
	RemovePlayerAttachedObject(playerid,3);
	RemovePlayerAttachedObject(playerid,4);
	RemovePlayerAttachedObject(playerid,5);
	RemovePlayerAttachedObject(playerid,6);
	RemovePlayerAttachedObject(playerid,7);
	RemovePlayerAttachedObject(playerid,8);
	RemovePlayerAttachedObject(playerid,9);
    SetPlayerArmour(playerid, 0);
    DisablePlayerCheckpoint(playerid);
	PosaoGPS[playerid] = 0;
    if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
    PlayerInfo[killerid][pUbistava]++; PlayerInfo[playerid][pSmrti]++;
    ResetPlayerWeapons(playerid); ResetujVar(playerid);
    }
    ////////////////////////////////////////////////////////////
    if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
	if(IgracPolicajac(killerid))
	{
		PlayerInfo[killerid][pTrazeniLevel] = 0;
		SetPlayerWantedLevel(killerid,0);
		SetPlayerColor(killerid,0xFFFFFF00);
 	}
 	if(IgracPolicajac(killerid))
	{
		PlayerInfo[killerid][pTrazeniLevel] = 0;
		SetPlayerWantedLevel(killerid,0);
		SetPlayerColor(killerid,0xFFFFFF00);
 	}
    }
	////////////////////////////////////////////////////////////
	if(!IgracPolicajac(killerid) && IsPlayerConnected(playerid))
	{
	if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
		PostaviWanted(killerid, "Ubistvo", "Nepoznat");
	}
    }
	////////////////////////////////////////////////////////////
	if(GetPlayerWantedLevel(killerid) > 6)
	{
		SetPlayerWantedLevel(killerid, 6);
		PlayerInfo[killerid][pTrazeniLevel] = 6;
	}
	////////////////////////////////////////////////////////////
	if(GetPlayerWantedLevel(playerid) > 0)
	{
	    new string[256];
		g_NovacMinus(playerid, GetPlayerWantedLevel(playerid)*3000);
		SCMF(playerid, -1, ""ZUTA"[INFO] "CRVENA"Izgubili ste %d$ zbog umiranja sa wanted level-om "ZUTA"%d!", GetPlayerWantedLevel(playerid)*3000, GetPlayerWantedLevel(playerid));
		SetPlayerWantedLevel(playerid, 0); PlayerInfo[playerid][pTrazeniLevel] = 0;
	    format(string,sizeof(string),""ORANGE"(SF) "SIVA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
		AdminHelper(-1,string);
		format(string,sizeof(string),""ORANGE"(SF) "SIVA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
		ChatPD(-1, string);
		SetPlayerColor(playerid, BELA2);
    }
    ////////////////////////////////////////////////////////////
	if(IsPlayerConnected(killerid) && GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
	{
	    new string[256];
		format(string,sizeof(string), ""ORANGE"[RE Anti DB] "SIVA"Igrac %s (ID:%d) je uradio Drive By nad igracem %s (ID:%d)!", GetName(killerid), killerid, GetName(playerid), playerid);
	    AdminHelper(-1, string);
	    SetPlayerColor(killerid, COLOR_RED);
	}
	////////////////////////////////////////////////////////////
	if(IsPlayerConnected(killerid) && PlayerInfo[playerid][pLevel] >= 1)
	{
	    new string[256];
		format(string,sizeof(string), ""ORANGE"[RE AK] "SIVA"Igrac %s (ID:%d) je ubio igraca %s (ID:%d)", GetName(killerid), killerid, GetName(playerid), playerid);
		AdminHelper(-1, string);
		if(PlayerInfo[killerid][pLider] >= 2 || PlayerInfo[killerid][pClan] >= 2)
		{
		SetPlayerColor(killerid, COLOR_RED);
		}
		else if(PlayerInfo[killerid][pLider] == 1 || PlayerInfo[killerid][pClan] == 1)
		{
		SetPlayerColor(killerid, BELA2);
		}
		else if(PlayerInfo[killerid][pLider] == 10 || PlayerInfo[killerid][pClan] == 10)
		{
		SetPlayerColor(killerid, BELA2);
		}
		else if(PlayerInfo[playerid][pAdmin] > 0 || PlayerInfo[playerid][pAdmin] < 6)
		{
		SetPlayerColor(killerid, BELA2);
		}
	}
	////////////////////////////////////////////////////////////
	if(gPlayerUsingLoopingAnim[playerid])
	{
		gPlayerUsingLoopingAnim[playerid] = 0;
	}
	////////////////////////////////////////////////////////////
    return 1;
}

Sta mi preporucujete,znaci kod vecina mapa se to desava.
Slika nesto://
One And Only
Old Member
Since AVGUST 2013. :)
GAME OVER - SCRIPTING
SINCE 2009 - 2025

Ovako, to sto za spawn kresuje moze biti do bilo kojeg objekta... a ovo pod onplayerdeath ovako dodaj:
public OnPlayerDeath(playerid, killerid, reason)
{
    antifakekill[playerid] ++;
    SetTimerEx("antifakekill2", 1000,false,"i",playerid);
	for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
        {
            if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
        }
    SetPlayerArmour(playerid, 0);
    DisablePlayerCheckpoint(playerid);
	PosaoGPS[playerid] = 0;
    if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
    PlayerInfo[killerid][pUbistava]++; PlayerInfo[playerid][pSmrti]++;
    ResetPlayerWeapons(playerid); ResetujVar(playerid);
    }
    ////////////////////////////////////////////////////////////
    if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
	if(IgracPolicajac(killerid))
	{
		PlayerInfo[killerid][pTrazeniLevel] = 0;
		SetPlayerWantedLevel(killerid,0);
		SetPlayerColor(killerid,0xFFFFFF00);
 	}
 	if(IgracPolicajac(killerid))
	{
		PlayerInfo[killerid][pTrazeniLevel] = 0;
		SetPlayerWantedLevel(killerid,0);
		SetPlayerColor(killerid,0xFFFFFF00);
 	}
    }
	////////////////////////////////////////////////////////////
	if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
		if(IsPlayerConnected(playerid))
		{
			PostaviWanted(killerid, "Ubistvo", "Nepoznat");
		}
    }
	////////////////////////////////////////////////////////////
	if(killerid != INVALID_PLAYER_ID) 
	{
		if(GetPlayerWantedLevel(killerid) > 6)
		{
			SetPlayerWantedLevel(killerid, 6);
			PlayerInfo[killerid][pTrazeniLevel] = 6;
		}
	}
	////////////////////////////////////////////////////////////
	if(GetPlayerWantedLevel(playerid) > 0)
	{
	    new string[256];
		g_NovacMinus(playerid, GetPlayerWantedLevel(playerid)*3000);
		SCMF(playerid, -1, ""ZUTA"[INFO] "CRVENA"Izgubili ste %d$ zbog umiranja sa wanted level-om "ZUTA"%d!", GetPlayerWantedLevel(playerid)*3000, GetPlayerWantedLevel(playerid));
		SetPlayerWantedLevel(playerid, 0); PlayerInfo[playerid][pTrazeniLevel] = 0;
	    format(string,sizeof(string),""ORANGE"(SF) "SIVA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
		AdminHelper(-1,string);
		format(string,sizeof(string),""ORANGE"(SF) "SIVA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
		ChatPD(-1, string);
		SetPlayerColor(playerid, BELA2);
    }
    ////////////////////////////////////////////////////////////
	if(IsPlayerConnected(killerid) && GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
	{
	    new string[256];
		format(string,sizeof(string), ""ORANGE"[RE Anti DB] "SIVA"Igrac %s (ID:%d) je uradio Drive By nad igracem %s (ID:%d)!", GetName(killerid), killerid, GetName(playerid), playerid);
	    AdminHelper(-1, string);
	    SetPlayerColor(killerid, COLOR_RED);
	}
	////////////////////////////////////////////////////////////
	if(IsPlayerConnected(killerid) && PlayerInfo[playerid][pLevel] >= 1)
	{
	    new string[256];
		format(string,sizeof(string), ""ORANGE"[RE AK] "SIVA"Igrac %s (ID:%d) je ubio igraca %s (ID:%d)", GetName(killerid), killerid, GetName(playerid), playerid);
		AdminHelper(-1, string);
		if(PlayerInfo[killerid][pLider] >= 2 || PlayerInfo[killerid][pClan] >= 2)
		{
		SetPlayerColor(killerid, COLOR_RED);
		}
		else if(PlayerInfo[killerid][pLider] == 1 || PlayerInfo[killerid][pClan] == 1)
		{
		SetPlayerColor(killerid, BELA2);
		}
		else if(PlayerInfo[killerid][pLider] == 10 || PlayerInfo[killerid][pClan] == 10)
		{
		SetPlayerColor(killerid, BELA2);
		}
		else if(PlayerInfo[playerid][pAdmin] > 0 || PlayerInfo[playerid][pAdmin] < 6)
		{
		SetPlayerColor(killerid, BELA2);
		}
	}
	////////////////////////////////////////////////////////////
	if(gPlayerUsingLoopingAnim[playerid])
	{
		gPlayerUsingLoopingAnim[playerid] = 0;
	}
	////////////////////////////////////////////////////////////
    return 1;
}


1.) Moguc crash zato sto si koristio RemovePlayerAttachedObject a nisi provjerio dali ima cakacen objekt tu
2.) Ako koristis killerid u variabli svojoj, ne smijes prvo to zvati, nego prvo dali je killerid sve osim INVADLI_PLAYER_ID...

My Bike KTM 450 SXF 2008