23.08.2012, 20:43
pawn Код:
forward GetVehicleSpeed(vehicleid, unit);
forward test(playerid);
/*=========================Callbacks=========================*/
public GetVehicleSpeed(vehicleid, unit)
{
new
Float:x_speed, Float:y_speed, Float:z_speed, Float:speedf, speed;
GetVehicleVelocity(vehicleid,x_speed,y_speed,z_speed);
if(unit == kmh)
{
speedf = floatsqroot(((x_speed*x_speed)+(y_speed*y_speed))+(z_speed*z_speed)) * 187.666667;
}
else if(unit == mph)
{
speedf = floatsqroot(((x_speed*x_speed)+(y_speed*y_speed))+(z_speed*z_speed)) * 116.541;
}
speed = floatround(speedf,floatround_round);
return speed;
}
public OnPlayerConnect(playerid)
{
SetTimerEx("test", 360000, true, "i", playerid);
return 1;
}
public test(playerid)
{
if(IsPlayerInRangeOfPoint(playerid,30.0,-2802.2390,-474.2502,7.1875))
{
new v = GetPlayerVehicleID(playerid);
GetVehicleSpeed(v,kmh);
if(GetVehicleSpeed(GetPlayerVehicleID(playerid) > 50))
{
SendClientMessage(playerid,-1,"Speed kam kar oye!");
GivePlayerMoney(playerid,-100);
}
}
}
Try This.