SA-MP Forums Archive
Some Questions - 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)
+--- Thread: Some Questions (/showthread.php?tid=616136)



Some Questions - donhu789 - 31.08.2016

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;
}



Re: Some Questions - Jefff - 01.09.2016

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;
}



Re: Some Questions - donhu789 - 01.09.2016

hmmmmmmm Thanks Jeff! "My Name Is Jeffffff"

+REP and i think i understand now