Anticheat - Surfing Boats
#1

Hi,

I've got an issue, my anticheat assumes the player is speedhacking on foot while he is surfing a boat. Surfing cars and planes are fine but boats don't seem to work, or trains.

How can this be prevented?

I thought about checking if a boat is in radius of 10.0, but then that check has to loop through all the cars and check distances every 1 second.

Have you a better way to fix the issue?
Reply
#2

If you use incognito streamer, attach dynamic area to boat.

OnPlayerEnterDynamicArea
loop boats areas()
if(boat_area_id == areaid)
SetPVarInt(playerid, "NearBoat", 1);

OnPlayerExitDynamicArea
loop boats areas()
if(boat_area_id == areaid)
SetPVarInt(playerid, "NearBoat", 0);

OnAirBrkCheck
if(GetPVarInt(playerid, "NearBoat")) return 0;
Reply
#3

You can use GetPlayerSurfingVehicleID(playerid); before your server checks the player for speedhack.
if it isn't an invalid vehicleid then you shouldn't check him for speedhack, but not sure if this always works fine.
Reply
#4

Quote:
Originally Posted by Yiin
Посмотреть сообщение
If you use incognito streamer, attach dynamic area to boat.

OnPlayerEnterDynamicArea
loop boats areas()
if(boat_area_id == areaid)
SetPVarInt(playerid, "NearBoat", 1);

OnPlayerExitDynamicArea
loop boats areas()
if(boat_area_id == areaid)
SetPVarInt(playerid, "NearBoat", 0);

OnAirBrkCheck
if(GetPVarInt(playerid, "NearBoat")) return 0;
This may be a possibility, thanks.

Quote:
Originally Posted by Roel
Посмотреть сообщение
You can use GetPlayerSurfingVehicleID(playerid); before your server checks the player for speedhack.
if it isn't an invalid vehicleid then you shouldn't check him for speedhack, but not sure if this always works fine.
This is a silly idea. GetPlayerSurfingVehicleID returns that they are NOT surfing a boat when they ARE.
Reply
#5

Why it is a silly idea, it's just a simple solution but I didn't know this function was bugged, so nvm.
Reply
#6

since speedhacks will only trigger when the player is moving, i think that the boat needs a driver.
as soon you got the drivers' id (and the vehicleid being driven), you could subtract the surfing players' position from the vehicles' position. as long the two players (or: the surfing player and the boat) are close together, you may assume that the player is still ON the boat. if you raise the "valid low distance to the boat" to more than 10 units, any player could teleport around the boat...
combining this with -2.0<z<2.0 as z-position, a boat always drives on the ocean - a player is kinda "allowed" to travel at (boats max) speeds JUST at those z-coordinates, but as soon one player figures this out, the word will spread.
one thought about a "naive" solution: (assumptions)
-your server loads 1000 vehicles
-there are like 50 boats only
-at spawning any of those 50 (or later spawned) boat(s), add this very vehicleid to an array, and increase its pointer. like BoatsSpawned[Boats]=vehicleid;Boats++;
-when a player warps around, check at OnplayerUpdate if any of those BoatsSpawned[0<Boats<50] is closer than 10 units (would not need the driver check maybe?)
Reply
#7

Quote:
Originally Posted by Babul
Посмотреть сообщение
since speedhacks will only trigger when the player is moving, i think that the boat needs a driver.
as soon you got the drivers' id (and the vehicleid being driven), you could subtract the surfing players' position from the vehicles' position. as long the two players (or: the surfing player and the boat) are close together, you may assume that the player is still ON the boat. if you raise the "valid low distance to the boat" to more than 10 units, any player could teleport around the boat...
combining this with -2.0<z<2.0 as z-position, a boat always drives on the ocean - a player is kinda "allowed" to travel at (boats max) speeds JUST at those z-coordinates, but as soon one player figures this out, the word will spread.
one thought about a "naive" solution: (assumptions)
-your server loads 1000 vehicles
-there are like 50 boats only
-at spawning any of those 50 (or later spawned) boat(s), add this very vehicleid to an array, and increase its pointer. like BoatsSpawned[Boats]=vehicleid;Boats++;
-when a player warps around, check at OnplayerUpdate if any of those BoatsSpawned[0<Boats<50] is closer than 10 units (would not need the driver check maybe?)
Thanks Babul, I've decided to go with the idea of making and attaching an area around the boat and then checking if they're in the boat area, it seems to work pretty well too!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)