[NPC FS] Instant server crash
#6

So now I've got this.
Код:
[19:57:56] [npc:join] Fred has joined the server (0:127.0.0.1)
[19:57:57] [debug] Run time error 4: "Array index out of bounds"
[19:57:57] [debug]  Accessing element at index 1 past array upper bound 0
[19:57:57] [debug] AMX backtrace:
[19:57:57] [debug] #0 000002a8 in public OnPlayerSpawn (0x00000000) from bus_fs.amx
[19:58:12] [npc:part] Fred has left the server (0:0)
The code:
Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
  	{
    	for(new i = 0; i < sizeof(bus); i++) {
    		new npcname[MAX_PLAYER_NAME];
			GetPlayerName(playerid, npcname, sizeof(npcname));
  			if(!strcmp(npcname, bus[i][0][0], true))
  			{
    	    	SetPlayerSkin(playerid, 253);
      			PutPlayerInVehicle(playerid, bus[i][3][0], 0);
			}
		}
    	return 1;
  	}
	return 1;
}
The initial crash was because of a sizeof() when there was no size set.
Reply


Messages In This Thread
[NPC FS] Instant server crash - by Sydcul - 23.12.2013, 13:34
Re: [NPC FS] Instant server crash - by Sydcul - 23.12.2013, 15:29
Re: [NPC FS] Instant server crash - by Sydcul - 27.12.2013, 16:48
Re: [NPC FS] Instant server crash - by Konstantinos - 27.12.2013, 16:51
Re: [NPC FS] Instant server crash - by Sydcul - 27.12.2013, 17:28
Re: [NPC FS] Instant server crash - by Sydcul - 27.12.2013, 17:51
Re: [NPC FS] Instant server crash - by Konstantinos - 27.12.2013, 17:59
Re: [NPC FS] Instant server crash - by Sydcul - 27.12.2013, 18:05
Re: [NPC FS] Instant server crash - by Konstantinos - 27.12.2013, 18:09
Re: [NPC FS] Instant server crash - by Sydcul - 27.12.2013, 18:23

Forum Jump:


Users browsing this thread: 1 Guest(s)