Speed Traps
#7

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;
}
Not tested.
Reply


Messages In This Thread
Speed Traps - by Rokzlive - 21.12.2010, 00:07
Re: Speed Traps - by Rokzlive - 21.12.2010, 00:15
Re: Speed Traps - by scripter1 - 21.12.2010, 00:36
Re: Speed Traps - by Rokzlive - 21.12.2010, 00:42
Re: Speed Traps - by Retardedwolf - 21.12.2010, 00:56
Re: Speed Traps - by scripter1 - 21.12.2010, 01:43
Re: Speed Traps - by Tee - 21.12.2010, 01:58
Re: Speed Traps - by Steven82 - 21.12.2010, 02:49

Forum Jump:


Users browsing this thread: 2 Guest(s)