Invalid vehicle and ispassenger - 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: Invalid vehicle and ispassenger (
/showthread.php?tid=394942)
Invalid vehicle and ispassenger -
Vvolk - 24.11.2012
Hello everybody. I have problem with my server. Some cheaters or buggers buging my server. In server log I have these lines:
Код:
[21:00:50] [debug] AMX backtrace:
[21:00:50] [debug] #0 00044b50 in public OnPlayerEnterVehicle (playerid=0, vehicleid=48404, ispassenger=20) at D:\Ћaidimai\LVGM\LVGM\gamemodes\SAMP.pwn:5767
[21:00:50] Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID
[21:00:50] [debug] Run time error 4: "Array index out of bounds"
[21:00:50] [debug] Accessing element at index 63781 past array upper bound 999
[21:00:50] [debug] AMX backtrace:
[21:00:50] [debug] #0 00044b50 in public OnPlayerEnterVehicle (playerid=0, vehicleid=63781, ispassenger=175) at D:\Ћaidimai\LVGM\LVGM\gamemodes\SAMP.pwn:5767
[21:00:50] Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID
[21:00:50] [debug] Run time error 4: "Array index out of bounds"
[21:00:50] [debug] Accessing element at index 11664 past array upper bound 999
[21:00:50] [debug] AMX backtrace:
[21:00:50] [debug] #0 00044b50 in public OnPlayerEnterVehicle (playerid=0, vehicleid=11664, ispassenger=56) at D:\Ћaidimai\LVGM\LVGM\gamemodes\SAMP.pwn:5767
[21:00:50] Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID
[21:00:50] [debug] Run time error 4: "Array index out of bounds"
[21:00:50] [debug] Accessing element at index 37610 past array upper bound 999
[21:00:50] [debug] AMX backtrace:
[21:00:50] [debug] #0 00044b50 in public OnPlayerEnterVehicle (playerid=0, vehicleid=37610, ispassenger=142) at D:\Ћaidimai\LVGM\LVGM\gamemodes\SAMP.pwn:5767
[21:00:50] Warning: PlayerDialogResponse PlayerId: 0 dialog ID doesn't match last sent dialog ID
[21:00:50] [debug] Run time error 4: "Array index out of bounds"
[21:00:50] [debug] Accessing element at index 26929 past array upper bound 999
[21:00:50] [debug] AMX backtrace:
But I don't have a lot of vehicles, It can't be such vehicleid. How to make protection against this?
Re: Invalid vehicle and ispassenger -
iggy1 - 24.11.2012
It's not cheaters, your code is bugged.
You are accessing an array out off bounds.
EG:
pawn Код:
new array[5];
array[10] = 6;//array is size '5' but we are trying to access '10'
This:
Код:
Accessing element at index 11664 past array upper bound 999
Means you have an array that is size 1000, and you are accessing 11664.
Re: Invalid vehicle and ispassenger -
Vvolk - 24.11.2012
No. I don't have this problem. I am not a newbie. It is something called "Server fucker". This thing sends onplayerentervehicle callback with invalid numbers. There is everything okay with my arrays.
Re: Invalid vehicle and ispassenger -
iggy1 - 24.11.2012
If that's actually what it is called you should delete that ASAP.
It seems you are using the 'vehicleid' as an index to an array?
Respuesta: Invalid vehicle and ispassenger -
OPremium - 24.11.2012
Try using the native
IsValidVehicle:
pawn Код:
native IsValidVehicle
(vehicleid
);
// It works, but it's not in the includes for some reason (https://sampwiki.blast.hk/wiki/IsValidVehicle)public OnPlayerEnterVehicle
(playerid, vehicleid
){ if(!IsValidVehicle
(vehicleid
)) { // Whatever you want to do with him Ban
(playerid
);
return 0;
} // The rest of your code return 1;
}