how do i make a fix cmd??
#1

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

Use OnPlayerKeyChange
Reply
#3

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

lewis, use foreach.
Reply
#5

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


Forum Jump:


Users browsing this thread: 5 Guest(s)