SA-MP Forums Archive
Fliping, fixing, ect. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Fliping, fixing, ect. (/showthread.php?tid=159370)



Fliping, fixing, ect. - iLcke - 13.07.2010

Okay, how would i make it, where you hit a key, vehicle would flip, fix, ect. A looked at a few places for it, couldn't find anything, if you could place a link, or tell me how, thanks if you do.


Re: Fliping, fixing, ect. - willsuckformoney - 13.07.2010

you want an auto repair??

pawn Код:
//at top
forward AutoRepair();
forward AutoFlipReset();

//OnGameModeInIt or OnFilterScriptInIt
SetTimer("AutoRepair", 1001, true);
SetTimer("AutoFlipReset", 6000, true);

//OnPlayerConnect
AutoRepairUsed[playerid] = 0;

//At Bottom and where you want
public AutoRepair()
{
    for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
    {
        if (IsPlayerInAnyVehicle(playerid))
        {
            if (AutoRepairUsed[playerid] == 3)
            {
                SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
                AutoRepairUsed[playerid] = 0;
            }
            new Float:CarHP;
            GetVehicleHealth(GetPlayerVehicleID(playerid), CarHP);
            if (CarHP < 400)
            {
                new Float:X, Float:Y, Float:Z;
                RepairVehicle(GetPlayerVehicleID(playerid));
                GameTextForPlayer(playerid, "~y~Vehicle ~r~Auto ~y~Repaired!",2000,5);
                PlayerPlaySound(playerid, 1133, X, Y, Z);
                AutoRepairUsed[playerid] = AutoRepairUsed[playerid] +1;
            }
        }
    }
    return 1;
}

public AutoFlipReset()
{
    for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
    {
        AutoRepairUsed[playerid] = 0;
    }
    return 1;
}
That an auto repair, when the car health is down to 400 then it repairs and it flips the car automatically after 4-6 repairs