Posts: 2,262
Threads: 260
Joined: Mar 2009
Reputation:
0
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?
Posts: 145
Threads: 14
Joined: Aug 2012
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;
Posts: 727
Threads: 79
Joined: Mar 2012
Reputation:
0
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.
Posts: 727
Threads: 79
Joined: Mar 2012
Reputation:
0
Why it is a silly idea, it's just a simple solution but I didn't know this function was bugged, so nvm.
Posts: 1,781
Threads: 13
Joined: Sep 2009
Reputation:
0
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?)