echo Executing Server Config... lanmode 0 rcon_password password maxplayers 50 port 7777 hostname Sydcul's SA-MP Server gamemode0 grandlarc 1 filterscripts bus announce 0 query 1 chatlogging 0 weburl www.sydcul.com onfoot_rate 40 incar_rate 40 weapon_rate 40 stream_distance 300.0 stream_rate 1000 maxnpc 10 logtimeformat [%H:%M:%S]
// © 2013 Sydcul. All rights reserved. #include <a_samp> new bus[][4][MAX_PLAYER_NAME+1] = { //Format: player/recording name, vehicle id, fare per IRL second {"Fred", 400, 10, 0} }; public OnFilterScriptInit() { print("Bus v1.0 - by Sydcul"); for(new i = 0; i < sizeof bus[]; i++) { ConnectNPC(bus[i][0][0], "bus"); bus[i][3][0] = CreateVehicle(bus[i][1][0], 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); } return 1; } public OnFilterScriptExit() { return 1; } 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; }
#include <a_npc> new name[MAX_PLAYER_NAME+1]; public OnNPCConnect(myplayerid) { GetPlayerName(myplayerid, name, sizeof(name)); } public OnRecordingPlaybackEnd() { StartRecordingPlayback(1, name); } public OnNPCEnterVehicle(vehicleid, seatid){ StartRecordingPlayback(1, name); } public OnNPCExitVehicle(){ StopRecordingPlayback(); }
SA-MP Dedicated Server ---------------------- v0.3x-R2, ©2005-2013 SA-MP Team [15:30:27] [15:30:27] Server Plugins [15:30:27] -------------- [15:30:27] Loaded 0 plugins. [15:30:27] [15:30:27] Filterscripts [15:30:27] --------------- [15:30:27] Loading filterscript 'bus.amx'... [15:30:27] Bus v1.0 - by Sydcul
Load crashdetect plugin.
|
[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)
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; }
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
printf("DEBUG: sizeof(bus) -> %i", sizeof(bus));
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
for(new i = 0; i < sizeof(bus); i++)
{
printf("DEBUG: OnPlayerSpawn -> i: %i", i);
if(!strcmp(npcname, bus[i][0][0], true))
{
SetPlayerSkin(playerid, 253);
PutPlayerInVehicle(playerid, bus[i][3][0], 0);
}
}
return 1;
}
return 1;
}
It shouldn't have crashed the server because sizeof returns 1 (it's correct) and it should be called only once with i equal to 0.
You can normally debug it: pawn Код:
Crashdetect can also help on the debugging by compiling your scripts with debug info (-d3): https://github.com/Zeex/samp-plugin-...ith-debug-info Do both and start the server, let the NPC connect to the server and post again what it printed. |
[20:11:30] [npc:join] Fred has joined the server (0:127.0.0.1) [20:11:30] DEBUG: sizeof(bus) -> 1 [20:11:30] DEBUG: OnPlayerSpawn -> i: 0 [20:11:45] [npc:part] Fred has left the server (0:0)
I really don't know why crashdetect showed that.
Take a look: https://sampforum.blast.hk/showthread.php?tid=95034 At the bottom of the first post -> Common problems |
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase Header size: 400 bytes Code size: 1400 bytes Data size: 740 bytes Stack/heap size: 16384 bytes; estimated max. usage=36 cells (144 bytes) Total requirements: 18924 bytes