Some Questions
#1

found this in some random script

Код:
public OnPlayerUpdate(playerid)
{
    new Float:hp,Float:armour;
    new Float:health;
    new veh = GetPlayerVehicleID(playerid);
    GetPlayerHealth(playerid,hp);
    GetPlayerArmour(playerid,armour);
    GetVehicleHealth(veh, health);

    if(God[playerid] == 1)
    {
        if(hp < 999.0) SetPlayerHealth(playerid, 1000.0);
        if(armour < 999.0) SetPlayerArmour(playerid, 1000.0);
        if(health < 999.0) SetVehicleHealth(veh, 1000.0);
        RepairVehicle(veh);
    }
    else if(God[playerid] == 1) return 1;

    return 1;
}
shouldn't it be like

Код:
public OnPlayerUpdate(playerid)
{
    new Float:hp,Float:armour;
    new Float:health;
    new veh = GetPlayerVehicleID(playerid);
    GetPlayerHealth(playerid,hp);
    GetPlayerArmour(playerid,armour);
    GetVehicleHealth(veh, health);

    if(God[playerid] == 1)
    {
        if(hp < 999.0) SetPlayerHealth(playerid, 1000.0);
        if(armour < 999.0) SetPlayerArmour(playerid, 1000.0);
        if(health < 999.0) SetVehicleHealth(veh, 1000.0);
        RepairVehicle(veh);
    }
    else if(God[playerid] == 0) return 1; //this

    return 1;
}
Reply
#2

Yes but it doesn't make sense, it should be

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(God[playerid] == 1) // god mode enabled
    {
        new Float:health;
        GetPlayerHealth(playerid,health);
        if(health < 999.0) SetPlayerHealth(playerid, 1000.0);

        GetPlayerArmour(playerid,health);
        if(health < 999.0) SetPlayerArmour(playerid, 1000.0);

        new veh = GetPlayerVehicleID(playerid);
        if(veh > 0)
        {
            GetVehicleHealth(veh, health);
            if(health < 999.0)
            {
                SetVehicleHealth(veh, 1000.0); // you don't need this line
                RepairVehicle(veh);
            }
        }
    }
    return 1;
}
Reply
#3

hmmmmmmm Thanks Jeff! "My Name Is Jeffffff"

+REP and i think i understand now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)