21.12.2010, 01:58
pawn Код:
stock GetVehicleSpeed(vehicleid)
{
new Float:v_vX, Float:v_vY, Float:v_vZ, Float:retres;
GetVehicleVelocity(vehicleid, v_vX, v_vY, v_vZ);
retres = floatsqroot(floatabs(floatpower(v_vX + v_vY + v_vZ, 2)));
return floatround(retres * 100, floatround_ceil);
}
pawn Код:
OnGameModeInit()
SetTimer("SpeedTrap",1000,true);//Setting a timer to check if the player is in that Zone with a time of 1 second (1000 ms = 1 second) and the timer will be repeated (true) if you want the timer not to be repeated (false).
pawn Код:
forward SpeedTrap(playerid,vehicleid)
public SpeedTrap(playerid,vehicleid)
{
new pstats = GetPlayerState(playerid);//Storing GetPlayerState(playerid) in pstate
if(pstate = PLAYER_STATE_DRIVER)
if(IsPlayerInRangeOfPoint(playerid,10.0,x,y,z))//Replace the x,y and z with your cords
if(GetVehicleSpeed(vehicleid) > 50))
//SetPlayerWantedLevel(playerid,1);
//GivePlayerCash(playerid,-250);
return 1;
}