Problems in server log - 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: Problems in server log (
/showthread.php?tid=554726)
Problems in server log -
rOps - 04.01.2015
This errors i have in my server log:
[15:35:28] [debug] Run time error 4: "Array index out of bounds"
[15:35:28] [debug] Accessing element at negative index -400
[15:35:28] [debug] AMX backtrace:
[15:35:28] [debug] #0 001ab208 in ?? () from samg.amx
[15:35:28] [debug] #1 00107790 in public SpeedoTimer () from samg.amx
ant this is my code:
Код HTML:
public SpeedoTimer()
{
for(new p = 0; p < MAX_PLAYERS; p ++)
{
if(IsPlayerNPC(p) || !IsPlayerConnected(p) || !IsPlayerInAnyVehicle(p)) continue;
if(GetPlayerState(p) == PLAYER_STATE_DRIVER)
{
if(!PlayerInfo[p][AFK_Stat])
{
vehicleDB[GetPlayerVehicleID(p)][Rida] += (floatsqroot(GetPlayerSpeed(p)) * 50) / 100000;
}
}
UpdateSpeedo(p);
}
return 1;
}
Re: Problems in server log -
Jefff - 04.01.2015
Wrong place for UpdateSpeedo(p);
if player is on foot GetPlayerVehicleID(p) == 0 and vehicle name is VehicleName[0 - 400] = -400
should be
pawn Код:
if(GetPlayerState(p) == PLAYER_STATE_DRIVER)
{
if(!PlayerInfo[p][AFK_Stat])
{
vehicleDB[GetPlayerVehicleID(p)][Rida] += (floatsqroot(GetPlayerSpeed(p)) * 50) / 100000;
}
UpdateSpeedo(p);
}