SA-MP Forums Archive
how do i make a fix cmd?? - 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: how do i make a fix cmd?? (/showthread.php?tid=231802)



how do i make a fix cmd?? - [EDT]AmanSingh123 - 26.02.2011

hey at the moment in my gamemode i have a /fix cmd that fixes your car but i want something that when i press 2 on my keyboard it fixes my car


Re: how do i make a fix cmd?? - maramizo - 26.02.2011

Use OnPlayerKeyChange


Re: how do i make a fix cmd?? - lewismichaelbbc - 26.02.2011

Maybe you will prefer an auto fix system?

:
Top of the script:
pawn Код:
forward AutoFix();
Ongamemodeinit
pawn Код:
SetTimer("AutoFix", 1000, 1);
pawn Код:
public AutoFix() {
    for(new playerid=0; playerid<MAX_PLAYERS; playerid++) {
        if(IsPlayerConnected(playerid)) {
            new Float:health, cid;
            if (IsPlayerInAnyVehicle(playerid)) {
                cid = GetPlayerVehicleID(playerid);
                GetVehicleHealth(cid, health);
                if (health < 950) {
                    RepairVehicle(GetPlayerVehicleID(playerid));

                }
            }
        }
    }
    return 1;
}
Thats it! you have a working auto fix system


Re: how do i make a fix cmd?? - maramizo - 26.02.2011

lewis, use foreach.


Re: how do i make a fix cmd?? - Edski - 26.02.2011

Look at some other scripts to see how they do it?