02.02.2012, 03:45
Hello, I'm using this function to check if someone is using cheat more vehicles that are above 50 meters are pulled over do not return to previous position, only those above 20 and less than 50 meters, someone can help me fix it?
not notice the way of writing am not English.
This is because there are people using some trickery to kick away the vehicles.
I thank everyone who help me.
not notice the way of writing am not English.
pawn Код:
#include <a_samp>
new
Float:PosVehAnterior[ 2000 ][ 4 ]
;
stock Float:GetDistanceBetweenPoints(Float:x,Float:y,Float:z,Float:pxtwo,Float:pytwo,Float:pztwo)
{
return floatsqroot(floatpower(floatabs(floatsub(pxtwo,x)),2)+floatpower(floatabs(floatsub(pytwo,y)),2)+floatpower(floatabs(floatsub(pztwo,z)),2));
}
public OnUnoccupiedVehicleUpdate( vehicleid, playerid, passenger_seat )
{
new
Float:PosX,
Float:PosY,
Float:PosZ,
Float:PosA
;
GetVehiclePos( vehicleid, PosX, PosY, PosZ );
GetVehicleZAngle( vehicleid, PosA );
if( PosVehAnterior[ vehicleid ][ 0 ] != 0.0 && PosVehAnterior[ vehicleid ][ 1 ] != 0.0 && PosVehAnterior[ vehicleid ][ 2 ] != 0.0 && PosVehAnterior[ vehicleid ][ 3 ] != 0.0 )
{
new
Float:Distancia = GetDistanceBetweenPoints( PosX, PosY, PosZ, PosVehAnterior[ vehicleid ][ 0 ], PosVehAnterior[ vehicleid ][ 1 ], PosVehAnterior[ vehicleid ][ 2 ] )
;
if( Distancia > 20.0 )
{
SetVehiclePos( vehicleid, PosVehAnterior[ vehicleid ][ 0 ], PosVehAnterior[ vehicleid ][ 1 ], PosVehAnterior[ vehicleid ][ 2 ] );
SetVehicleZAngle( vehicleid, PosVehAnterior[ vehicleid ][ 3 ] );
return ;
}
}
PosVehAnterior[ vehicleid ][ 0 ] = PosX;
PosVehAnterior[ vehicleid ][ 1 ] = PosY;
PosVehAnterior[ vehicleid ][ 2 ] = PosZ;
PosVehAnterior[ vehicleid ][ 3 ] = PosA;
}
I thank everyone who help me.