ANTI-CAR WARP
Fags be car warping, I just copied this out of my gamemode, change it how you like. Just make sure you don't use PutPlayerInVehicle too fast, or you can even simply just hook:
p_CarWarpTime[ playerid ] = gettime( ) + 1; to those functions
The average car jack per vehicle is around 400ms (0.4 seconds), the highest I've caught to was 634ms. It's good to be safe than sorry, so I've now set it to 1 second. It's barely possible to enter more than two vehicles in under two seconds anyway, as previously with two seconds. It was possible to enter two cars within 2 seconds.
Version 0.3 - NEW
pawn Code:
new p_CarWarpTime[ MAX_PLAYERS ];
new p_CarWarpVehicleID[ MAX_PLAYERS ];
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if( newstate == PLAYER_STATE_DRIVER && p_AdminLevel[ playerid ] <= 0 )
{
if( GetPlayerVehicleID( playerid ) != p_CarWarpVehicleID[ playerid ] )
{
if( p_CarWarpTime[ playerid ] > gettime( ) )
{
SendClientMessageToAllFormatted( -1, ""COL_AC"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for car warping.", ReturnPlayerName( playerid ), playerid );
BanEx( playerid, "Car Warp" );
return 1;
}
p_CarWarpTime[ playerid ] = gettime( ) + 1;
p_CarWarpVehicleID[ playerid ] = GetPlayerVehicleID( playerid );
}
}
return 1;
}