How to make cruise control system
#1

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
Reply
#2

i belive you would need to use this in your code
pawn Код:
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
kinda in a rush just giving you the basics of what you might need
Reply
#3

pawn Код:
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]);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)