[Help]Car repair
#1

How do I repair my vehicle with "T"Button?.
so that when i press "T" my vehicle will be repaired
Код:
if(strcmp("/repair", cmdtext, true) == 0)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    SetVehicleHealth(vehicleid, 1000.0);
    SendClientMessage(playerid, COLOUR_WHITE, "Vehicle has been repaired.");
    return 1;
}
Sorry I'm beginner
Reply
#2

You can't choose any key you want...
You need to choose one from this list:
https://sampwiki.blast.hk/wiki/GetPlayerKeys
Reply
#3

i think its not possible to use "T"
and..if it was possible that key would be bad key
u use it to write in the chat :P
Reply
#4

so how do i start on creating the key?
Reply
#5

I don't think you can.
Try searching for an include.
Reply
#6

Use this.
Reply
#7

Top:
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_JUMP))
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        SetVehicleHealth(vehicleid, 1000.0);
        SendClientMessage(playerid, COLOUR_WHITE, "Vehicle has been repaired.");
    }
}
Reply
#8

Код:
ublic OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new nos = GetPlayerVehicleID(playerid);
        if(Nitro(nos) && (oldkeys & 1 || oldkeys & 4))
        {
            RemoveVehicleComponent(nos, 1010);
            AddVehicleComponent(nos, 1010);
            return 1;
        }
    }
    if(IsPlayerInAnyVehicle(playerid))
    {
      new vehicleid = GetPlayerVehicleID(playerid);
      if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
      {
        if((newkeys & KEY_SUBMISSION) && !(oldkeys & KEY_SUBMISSION))
        {
          RepairVehicle(vehicleid);
          new Float:PX, Float:PY, Float:PZ, Float:PA;
          GetPlayerPos(playerid, PX, PY, PZ);
          GetVehicleZAngle(GetPlayerVehicleID(playerid), PA);
          SetVehiclePos(GetPlayerVehicleID(playerid), PX, PY, PZ+1);
          SetVehicleZAngle(GetPlayerVehicleID(playerid), PA);
          SendClientMessage(playerid,1, "Your vehicle has been repaired.");
          return 1;
            }
        }
        else(SendClientMessage(playerid,151, "You're not in a vehicle!"));
    }
    return 1;
}
I've done it...How do i flip the car...w/o the car going airborne?I mean when i flip it it should me on the ground.THNX for ur help
Reply
#9

Under OnPlayerKeyStateChange:

pawn Код:
if (newkeys & KEY_SUBMISSION)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    SetVehicleHealth(vehicleid, 1000.0);
    SendClientMessage(playerid, COLOUR_WHITE, "Vehicle has been repaired.");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)