05.12.2010, 07:54
i wanna make a cruise control system which limits the speed of control. How to do it. Or how to make a script that shows warning when a player drives fsatly
new seatid = GetPlayerVehicleSeat(playerid);
if(seatid == 0)
GetPlayerVehicleID(playerid);
GetVehicleVelocity(vehicleid, x, y, z);
SetVehicleVelocity(vehicleid, x, y, z+);// set it to what you want
if (GetPlayerSpeed(playerid) > some_value) {
SendClientMessage(playerid, COLOR_COLOR,"You are driving too fast! Slow down");
}
stock GetPlayerSpeed(playerid)
{
new Float:ST[4];
if(IsPlayerInAnyVehicle(playerid))
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 110.3;
return floatround(ST[3]);
}