Jump to content

Setare speedometer


Nigga
 Share

Recommended Posts

  • Administrator
Definesti sus in gameode
 

new PlayerText:Speedo[MAX_PLAYERS][3];
 
Functia propriu zisa + optimizata
 
function Checkvehinfo(playerid) 
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) 
    {
        if(InRaceArena[playerid] == 1 && !RaceStarted) return true;

        new engine, lights, alarm, doors, bonnet, boot, objective, string[128];
        GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);

        if(CarInfo[FindSpawnID(GetPlayerVehicleID(playerid))][cID] != -2 && FindSpawnID(GetPlayerVehicleID(playerid)) != 0 && !IsAPlane(GetPlayerVehicleID(playerid))) 
        {
            if(!IsABike(GetPlayerVehicleID(playerid)) && !IsAPlane(GetPlayerVehicleID(playerid))) 
            {
                format(string, sizeof string, "~%s~%d", (Carspeed(playerid) < 99) ? ("g") : ("r"), Carspeed(playerid));
                TextDrawSetString(Speedo[playerid][0], string);

                format(string, sizeof string, "Fuel: ~%s~%d~n~~w~~h~%s~n~Odometer: %0.2f", (Gas[GetPlayerVehicleID(playerid)] > 20) ? ("g") : ("r"), Gas[GetPlayerVehicleID(playerid)], (doors == 1) ? ("Doors: ~r~Locked~w~~h~") : ("Doors: ~g~Unlocked~w~~h~"), CarInfo[FindSpawnID(GetPlayerVehicleID(playerid))][KM]);
                TextDrawSetString(Speedo[playerid][2], string);
            }
        } 

        else 
        {
            if(!IsABike(GetPlayerVehicleID(playerid)) && !IsAPlane(GetPlayerVehicleID(playerid))) 
            {
                format(string, sizeof string,, "~%s~%d", (Carspeed(playerid) < 99) ? ("g") : ("r"), Carspeed(playerid));
                TextDrawSetString(Speedo[playerid][0], string);

                format(string, sizeof string,, "Fuel: ~%s~%d", (Gas[GetPlayerVehicleID(playerid)] > 20) ? ("g") : ("r"), Gas[GetPlayerVehicleID(playerid)]);
                TextDrawSetString(Speedo[playerid][2], string);
            }
        } 

        for(new i = 0; i < 3; i++)
        {
            PlayerTextDrawShow(playerid, Speedo[playerid][i]);
        }
    }

    return 1;
}
 

Cu placere, @@Nigga.

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...