PDA

View Full Version : Invalid vehicle and ispassenger


Vvolk
24/11/2012, 05:47 PM
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?

iggy1
24/11/2012, 05:54 PM
It's not cheaters, your code is bugged.

You are accessing an array out off bounds.

EG:

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.

Vvolk
24/11/2012, 06:04 PM
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.

iggy1
24/11/2012, 06:07 PM
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?

OPremium
24/11/2012, 06:36 PM
Try using the native IsValidVehicle (http://wiki.sa-mp.com/wiki/IsValidVehicle):


native IsValidVehicle(vehicleid); // It works, but it's not in the includes for some reason (http://wiki.sa-mp.com/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;
}