My server is Automatic close!WHY!! Help Please !!!
#1

Hello, i have a problem with my server is automatic close and idk why i tried in test server it's automatic close too then i installed crashdetect and i got that
Код:
[08:12:13] [debug] Run time error 4: "Array index out of bounds"
[08:12:13] [debug]  Attempted to read/write array element at index 65535 in array of size 500
[08:12:13] [debug] AMX backtrace:
[08:12:13] [debug] #0 00005888 in ?? (65535) from SPTDM3E.amx
[08:12:13] [debug] #1 0035ea88 in public OnPlayerDeath (0, 65535, 255) from SPTDM3E.amx
[08:12:13] [death] (Vic)_For_test died 255
[08:12:24] [chat] [(Vic)_For_test]: d
[08:13:46] [debug] Server crashed while executing SPTDM3E.amx
[08:13:46] [debug] AMX backtrace:
[08:13:46] [debug] #0 native SendClientMessageToAll () from sampsvr-port_2522
[08:13:46] [debug] #1 00477ae8 in public cmd_beach (0, 6886496) from SPTDM3E.amx
[08:13:46] [debug] #2 native CallLocalFunction () from sampsvr-port_2522
[08:13:46] [debug] #3 00007af8 in public OnPlayerCommandText (0, 6886468) from SPTDM3E.amx
[08:13:46] [debug] Native backtrace:
[08:13:46] [debug] #0 e64659f0 in _Z13GetStackTraceRSt6vectorI10StackFrameSaIS0_EEPv () from plugins/crashdetect.so
[08:13:46] [debug] #1 e645ea62 in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[08:13:46] [debug] #2 e645f764 in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[08:13:46] [debug] #3 e64616b4 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[08:13:46] [debug] #4 e646531d in ?? () from plugins/crashdetect.so
[08:13:46] [debug] #5 e67bb410 in __kernel_rt_sigreturn () from linux-gate.so.1
[08:13:46] [debug] #6 e64d2508 in _IO_vfprintf () from /lib32/libc.so.6
[08:13:46] [debug] #7 e64f27a2 in vsprintf () from /lib32/libc.so.6
[08:13:46] [debug] #8 080ac427 in ?? () from ./sampsvr-port_2522
[08:13:46] [debug] #9 080d7ad1 in ?? () from ./sampsvr-port_2522
[08:13:46] [debug] #10 080954a4 in ?? () from ./sampsvr-port_2522
[08:13:46] [debug] #11 e64604d3 in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[08:13:46] [debug] #12 00000001 in ?? () from �gx�Hex��e�e�e�e+�e�e�x�
please all help me! Thank You
Reply
#2

post your onplayerdeath & command beach
Reply
#3

here's OnplayerDeath:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    Delete3DTextLabel(mylabel[playerid]);
	new msg[128],reasonMsg[32], pname[MAX_PLAYER_NAME], string[128], deathreason[20];
	SendDeathMessage(killerid,playerid,reason);
	GameTextForPlayer(playerid, "only noobs die XD", 4000, 6);
	GetPlayerName(playerid, pname, sizeof(pname));
	GetWeaponName(reason, deathreason, 20);
	new pstring[128]; //player message
	new killer[MAX_PLAYER_NAME];
	GetPlayerName(killerid, killer, sizeof(killer));

	if(InDM[playerid]==1) InDM[playerid]=0;
	SetPlayerWorldBounds(playerid,20000.0000,-20000.0000,20000.0000,-20000.0000); //Reset world to player
Reply
#4

The first runtime error "Array index out of bounds" is because you didn't check if killerid is connected / invalid player under OnPlayerDeath. The second one, is from "beach" command in your gamemode, show us the code of that command if you don't mind.

Edit: too late.
Reply
#5

check if(playerid !=INVALID_PLAYER_ID && killerid !=INVALID_PLAYER_ID)
Reply
#6

This is the invalid player:
Код:
if(killerid!=INVALID_PLAYER_ID)
	{
		switch (reason)
		{
			case 0: { reasonMsg = "Unarmed"; }
			case 1: { reasonMsg = "Brass Knuckles"; }
			case 2: { reasonMsg = "Golf Club"; }
			case 3: { reasonMsg = "Night Stick"; }
			case 4: { reasonMsg = "Knife"; }
			case 5: { reasonMsg = "Baseball Bat"; }
			case 6: { reasonMsg = "Shovel"; }
			case 7: { reasonMsg = "Pool Cue"; }
			case 8: { reasonMsg = "Katana"; }
			case 9: { reasonMsg = "Chainsaw"; }
			case 10: { reasonMsg = "Dildo"; }
			case 11: { reasonMsg = "Dildo"; }
			case 12: { reasonMsg = "Vibrator"; }
			case 13: { reasonMsg = "Vibrator"; }
			case 14: { reasonMsg = "Flowers"; }
			case 15: { reasonMsg = "Cane"; }
			case 22: { reasonMsg = "Pistol"; }
			case 23: { reasonMsg = "Silenced Pistol"; }
			case 24: { reasonMsg = "Desert Eagle"; }
			case 25: { reasonMsg = "Shotgun"; }
			case 26: { reasonMsg = "Sawn-off Shotgun"; }
			case 27: { reasonMsg = "Combat Shotgun"; }
			case 28: { reasonMsg = "MAC-10"; }
			case 29: { reasonMsg = "MP5"; }
			case 30: { reasonMsg = "AK-47"; }
			case 31:
			{
				if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
				{
					switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
					{
						case 447: { reasonMsg = "Sea Sparrow Machine Gun"; }
						default: { reasonMsg = "M4"; }
					}
				}
				else
				{
					reasonMsg = "M4";
				}
			}
			case 32: { reasonMsg = "TEC-9"; }
			case 33: { reasonMsg = "Rifle"; }
			case 34: { reasonMsg = "Sniper Rifle"; }
			case 37: { reasonMsg = "Fire"; }
			case 38:
			{
				if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
				{
					switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
					{
						case 425: { reasonMsg = "Hunter Machine Gun"; }
						default: { reasonMsg = "Minigun"; }
					}
				}
				else { reasonMsg = "Minigun"; }
			}
			case 41: { reasonMsg = "Spraycan"; }
			case 42: { reasonMsg = "Fire Extinguisher"; }
			case 49: { reasonMsg = "Vehicle Collision"; }
			case 50:
			{
				if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
				{
					switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
					{
						case 417, 425, 447, 465, 469, 487, 488, 497, 501, 548, 563: { reasonMsg = "Helicopter Blades"; }
						default: { reasonMsg = "Vehicle Collision"; }
					}
				}
				else { reasonMsg = "Vehicle Collision"; }
			}
			case 51:
			{
				if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
				{
					switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
					{
						case 425: { reasonMsg = "Hunter Rockets"; }
						case 432: { reasonMsg = "Rhino Turret"; }
						case 520: { reasonMsg = "Hydra Rockets"; }
						default: { reasonMsg = "Explosion"; }
					}
				}
				else { reasonMsg = "Explosion"; }
			}
			default: { reasonMsg = "Unknown"; }
		}
		format(string, sizeof(string), "*** %s killed %s. (%s)", killer, pname, reasonMsg);
		SaveToFile("DeathLog",string);
		print(string);
		format(msg, sizeof(msg), "04*** %s killed %s. (%s)", killer, pname, reasonMsg);
	}
	else
	{
		switch (reason)
		{
			case 53:
			{
				format(string, sizeof(string), "*** %s died. (Drowned)", pname);
				format(msg, sizeof(msg), "04*** %s died. (Drowned)", pname);
			}
			case 54:
			{
				format(string, sizeof(string), "*** %s died. (Collision)", pname);
				format(msg, sizeof(msg), "04*** %s died. (Collision)", pname);
			}
			default:
			{
				format(string, sizeof(string), "*** %s died.", pname);
				format(msg, sizeof(msg), "04*** %s died.", pname);
			}
		}
	}
//------------------------------------TeamKill----------------------------------
	if(killerid != INVALID_PLAYER_ID && PlayerInfo[playerid][team] == PlayerInfo[killerid][team])
	{
		KillerID[playerid] = killerid;
		new warning[128];
		format(warning, sizeof(warning), "Be careful! You You may Be punished for Team Killing!");
		SendClientMessage(killerid, 0xFFFF00AA, warning);
		ShowMenuForPlayer(TK,playerid);
		DropWeapons(playerid);
		IsSpawned[playerid] = 0;
		cuffed[playerid] = 0;
		Tazed[playerid] = 0;
		hastazer[playerid] = 0;
		LawEnforcementRadio[playerid] = 0;
		HasLawEnforcementRadio[playerid] = 0;
		ReqBk[playerid] = 0;
		ReqBkRecent[playerid] = 0;
		ReportedRecent[playerid] = 0;
		VisitReq[playerid] = 0;
		EscapedConvict[playerid] = 0;
		VisitReqExpires[playerid] = 0;
		StoleCopCarRecent[playerid] = 0;
		triedtoescaperecent[playerid] = 0;
		JailTime[playerid] = 0;
		JailTimeServed[playerid] = 0;
		copshavevc[playerid] = 0;
		commitedcrimerecently[playerid] = 0;
		wantsheal[playerid] = 0;
		wantscure[playerid] = 0;
		InfectedPlyRecent[playerid] = 0;
		wantsweed[playerid] = 0;
		playeronweed[playerid] = 0;
		playertookweed[playerid] = 0;
		HasWeedBag[playerid] = 0;
		CuffedTime[playerid] = 0;
		cannotescapejail[playerid] = 0;
		RobbedPlyRecent[playerid] = 0;
		beenrobbedrecently[playerid] = 0;
		HasWallet[playerid] = 0;
		OldCash[playerid] = 0;
		Chlamydia[playerid] = 0;
		instunt[playerid] = 0;
		return 1;
	}
And about beach
i want it just a tele command so i disabled it here
Код:
if(Current == StuntZones4)
	{
    	switch(row)
    	{
        	case 0: cmd_stuntlvair(playerid,"\1"), TogglePlayerControllable(playerid,true); //stuntlvair
        	case 1: cmd_xdrag(playerid,"\1"), TogglePlayerControllable(playerid,true); //xdrag
        	//case 2: cmd_beach(playerid,"\1"), TogglePlayerControllable(playerid,true); //xdrag2
        	case 3: cmd_xdrift(playerid,"\1"), TogglePlayerControllable(playerid,true); //xdrift
        	case 4: cmd_desertstunt(playerid,"\1"), TogglePlayerControllable(playerid,true); //desertstunt
        	case 5: cmd_lsstunt(playerid,"\1"), TogglePlayerControllable(playerid,true); //lsstunt
        	case 7: cmd_lvaministunt2(playerid,"\1"), TogglePlayerControllable(playerid,true); //lvaministunt2
        	//case 8: cmd_beachstunt(playerid,"\1"), TogglePlayerControllable(playerid,true); //beachstunt
        	//case 9: cmd_water(playerid,"\1"), TogglePlayerControllable(playerid,true); //water
        	case 10: cmd_lsastunt(playerid,"\1"), TogglePlayerControllable(playerid,true); //lsastunt
        	case 11: cmd_lsastunt2(playerid,"\1"), TogglePlayerControllable(playerid,true); //lsastunt2
        	case 12: cmd_speedjump(playerid,"\1"), TogglePlayerControllable(playerid,true); //speedjump
        	case 13: cmd_area69(playerid,"\1"), TogglePlayerControllable(playerid,true); //area69
        	case 14: cmd_grove(playerid,"\1"), TogglePlayerControllable(playerid,true); //cj
        	case 15: cmd_farm(playerid,"\1"), TogglePlayerControllable(playerid,true); //farm
			case 16: // Back
Command:
Код:
CMD:beach(playerid,params[]) {
	if(PlayerInfo[playerid][Jailed] == 1) return SendClientMessage(playerid,COLOR_BRIGHTRED,"You cannot escape your punishment!");
 CarSpawner(playerid,502);
	TeleTimer[playerid] = SetTimerEx("ttimer", 1000, true, "i",playerid);
	tseconds[playerid] = 6;
	format(tstring,45,"You Must wait %d seconds before teleporting", tseconds[playerid]-1);
	if(PlayerInfo[playerid][Level] == 0) SendClientMessage(playerid,COLOR_LIGHTBLUE, tstring);
	vCount[playerid] = 1;
	Tx[playerid] =369.9532;
	Ty[playerid] =-1652.8578;
	Tz[playerid] =37.6967;
	Ti[playerid] = 0;
	format(telestring,43,"~w~]] ~p~BE~b~AC~g~H ~w~]]");
	SendClientMessageToAll(COLOR_RED, "{FF0000}»»{66FFFF}-[Tele] : {0055FF}%s {00FF00}has just Teleport To Beach {FF00D9}/beach");
	SetTimerEx("setstunt",3000,0,"i", playerid);
	return 1;
}
?? Help please ! !

?? any ideas
Reply
#7

OPD is only called when player is connected, checking player (killed player) for invalid player is not fine.

PHP код:
OnPlayerDeath(playeridkilleridreason)
{
    if(
killerid != INVALID_PLAYER_ID)
    {
       
// ... your code here ... //
    
}
    
// ... rest of the code ... //
    
return 1;

About
Quote:

[08:13:46] [debug] #3 00007af8 in public OnPlayerCommandText (0, 688646 from SPTDM3E.amx

Use command processor such as ZCMD, I-ZCMD, PawnCMD, SCP or whatever seems easy for you.

Don't use params parameter if you aren't using it, for example from
PHP код:
CMD:beach(playeridparams[]) 
to
PHP код:
CMD:beach(playerid
with this, the short/ alternative command you make will be changed as well, from
PHP код:
CMD_b(playeridparams); 
to
PHP код:
CMD_b(playerid); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)