SA-MP Forums Archive
auto repair fs help.... - 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: auto repair fs help.... (/showthread.php?tid=237414)



auto repair fs help.... - deviljingoku - 09.03.2011

hey friends i have these auto repair filterscripts... :-
pawn Код:
public AutoR()
{    
    for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
    {
        if(IsPlayerConnected(playerid))
        if(PlayerToPoint(2500, playerid, 563.4977,2079.7036,50.0636))//Full Lv
        {
            new Float:health, cid;
            if (IsPlayerInAnyVehicle(playerid))
            {
                cid = GetPlayerVehicleID(playerid);
                GetVehicleHealth(cid, health);
                if (health < 300)
                {
                SetVehicleHealth(cid,1000);
                GameTextForPlayer(playerid, "Vehicle Repaired!",2000,5);
                }
            }
        }
    }
    return 1;
}
but this is only for defined area only.....and i have one more auto repair fs....but that is only for admin....i want to both in 1 fs....please help....work in area only for players and for admins enywhere i mean...


Re: auto repair fs help.... - OKStyle - 09.03.2011

Try that:

pawn Код:
public AutoR()
{    
    for(new i; i < GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerAdmin(i))
            {
                new Float:health, cid;
                if(IsPlayerInAnyVehicle(i))
                {
                    cid = GetPlayerVehicleID(i);
                    GetVehicleHealth(cid, health);
                    if (health < 300)
                    {
                        RepairVehicle(cid);
                        GameTextForPlayer(playerid, "Vehicle Repaired!",2000,5);
                    }
                }
            }
            else
            {
                if(PlayerToPoint(2500, i, 563.4977,2079.7036,50.0636))//Full Lv
                {
                    new Float:health, cid;
                    if(IsPlayerInAnyVehicle(i))
                    {
                        cid = GetPlayerVehicleID(i);
                        GetVehicleHealth(cid, health);
                        if (health < 300)
                        {
                            RepairVehicle(cid);
                            GameTextForPlayer(playerid, "Vehicle Repaired!",2000,5);
                        }
                    }
                }
            }
        }
    }
    return 1;
}



Re: auto repair fs help.... - deviljingoku - 09.03.2011

thanx for help but its working anywhere for all....


Re: auto repair fs help.... - Calgon - 09.03.2011

pawn Код:
public AutoR() {
    new
        Float: fHealth;
       
    for(new playerid=0; playerid<MAX_PLAYERS; playerid++) {
        if(IsPlayerConnected(playerid)) {
            if(IsPlayerInRangeOfPoint(playerid, 5, 563.4977, 2079.7036, 50.0636)) {
                if(IsPlayerInAnyVehicle(playerid)) {
                    GetVehicleHealth(GetPlayerVehicleID(playerid), fHealth);
                    if(fHealth < 300) {
                        SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
                        GameTextForPlayer(playerid, "Vehicle Repaired!",2000,5);
                    }
                }
            }
        }
    }
    return 1;
}
Untested.


Re: auto repair fs help.... - deviljingoku - 09.03.2011

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
pawn Код:
public AutoR() {
    new
        Float: fHealth;
       
    for(new playerid=0; playerid<MAX_PLAYERS; playerid++) {
        if(IsPlayerConnected(playerid)) {
            if(IsPlayerInRangeOfPoint(playerid, 5, 563.4977, 2079.7036, 50.0636)) {
                if(IsPlayerInAnyVehicle(playerid)) {
                    GetVehicleHealth(GetPlayerVehicleID(playerid), fHealth);
                    if(fHealth < 300) {
                        SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
                        GameTextForPlayer(playerid, "Vehicle Repaired!",2000,5);
                    }
                }
            }
        }
    }
    return 1;
}
Untested.
thanx but i want auto repair for all players in only in area if(IsPlayerInRangeOfPoint(playerid, 5, 563.4977, 2079.7036, 50.0636)) but i want it for only admin in full map anywhere....


Re: auto repair fs help.... - OKStyle - 10.03.2011

Try change PlayerToPoint to IsPlayerInArea...


Re: auto repair fs help.... - deviljingoku - 19.03.2011

not working.......