auto repair fs help....
#1

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

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;
}
Reply
#3

thanx for help but its working anywhere for all....
Reply
#4

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.
Reply
#5

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....
Reply
#6

Try change PlayerToPoint to IsPlayerInArea...
Reply
#7

not working.......
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)