Progressbar
#1

Hola, estuve intentando hacer un sistema de hambre, pero no me sale, miren.
pawn Код:
public Hambre()
{
    foreach(Player, playerid)
    {
        SetProgressBarValue(HambreJ[playerid], -= 5.0);
        UpdateProgressBar(HambreJ[playerid], playerid);
    }
}
Lo que estoy intentando hacer con un timer es que cada determinado tiempo le quite 5.0 al ProgressBar

Aquн es cuando yo como pizza y me sube 20.0 en el progressbar.
pawn Код:
else if(playertextid == Textdraw6[playerid])
    {
        SetProgressBarValue(HambreJ[playerid], += 20.0);
        UpdateProgressbar(HambreJ[playerid], playerid);
        Informacion[playerid][pPizza] -= 1;
        ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,0,0);
    }
Y me da los siguientes errores:
Quote:

C:\DOCUME~1\ADMINI~1\ESCRIT~1\Gamemode\GAMEMO~1\Ga memode.pwn(149) : warning 213: tag mismatch
C:\DOCUME~1\ADMINI~1\ESCRIT~1\Gamemode\GAMEMO~1\Ga memode.pwn(149) : warning 213: tag mismatch
C:\DOCUME~1\ADMINI~1\ESCRIT~1\Gamemode\GAMEMO~1\Ga memode.pwn(250) : error 029: invalid expression, assumed zero
C:\DOCUME~1\ADMINI~1\ESCRIT~1\Gamemode\GAMEMO~1\Ga memode.pwn(250) : warning 215: expression has no effect
C:\DOCUME~1\ADMINI~1\ESCRIT~1\Gamemode\GAMEMO~1\Ga memode.pwn(250) : error 001: expected token: ";", but found ")"
C:\DOCUME~1\ADMINI~1\ESCRIT~1\Gamemode\GAMEMO~1\Ga memode.pwn(250) : error 029: invalid expression, assumed zero
C:\DOCUME~1\ADMINI~1\ESCRIT~1\Gamemode\GAMEMO~1\Ga memode.pwn(250) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

їAlguien me ayuda?, desde ya muchas gracias.
Reply
#2

pawn Код:
SetProgressBarValue(HambreJ[playerid], -= 5.0);

SetProgressBarValue(HambreJ[playerid], += 20.0);

Estбn mal, basta con tan solo poner 20.0, si quieres restarle solo pon un signo positivo.


pawn Код:
SetProgressBarValue(HambreJ[playerid], -5.0);

SetProgressBarValue(HambreJ[playerid], 20.0);
Reply
#3

їPor quй me hace crashear del servidor?
pawn Код:
new Bar:HambreJ[MAX_PLAYERS] = {INVALID_BAR_ID, ...};
forward Hambre();

public Hambre()
{
    foreach(Player, playerid)
    {
        SetProgressBarValue(HambreJ[playerid], -5.0);
        UpdateProgressBar(HambreJ[playerid], playerid);
    }
}

public OnGameModeInit()
{
    SetTimer("Hambre", 50000, 1);
        return 1;
}

public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
    if(playertextid == Textdraw20[playerid])
    {
        PlayerTextDrawHide(playerid, Textdraw0[playerid]);
        PlayerTextDrawHide(playerid, Textdraw1[playerid]);
        PlayerTextDrawHide(playerid, Textdraw2[playerid]);
        PlayerTextDrawHide(playerid, Textdraw3[playerid]);
        PlayerTextDrawHide(playerid, Textdraw4[playerid]);
        PlayerTextDrawHide(playerid, Textdraw5[playerid]);
        PlayerTextDrawHide(playerid, Textdraw6[playerid]);
        PlayerTextDrawHide(playerid, Textdraw7[playerid]);
        PlayerTextDrawHide(playerid, Textdraw8[playerid]);
        PlayerTextDrawHide(playerid, Textdraw9[playerid]);
        PlayerTextDrawHide(playerid, Textdraw10[playerid]);
        PlayerTextDrawHide(playerid, Textdraw11[playerid]);
        PlayerTextDrawHide(playerid, Textdraw12[playerid]);
        PlayerTextDrawHide(playerid, Textdraw13[playerid]);
        PlayerTextDrawHide(playerid, Textdraw14[playerid]);
        PlayerTextDrawHide(playerid, Textdraw15[playerid]);
        PlayerTextDrawHide(playerid, Textdraw16[playerid]);
        PlayerTextDrawHide(playerid, Textdraw17[playerid]);
        PlayerTextDrawHide(playerid, Textdraw18[playerid]);
        PlayerTextDrawHide(playerid, Textdraw19[playerid]);
        PlayerTextDrawHide(playerid, Textdraw20[playerid]);
        CancelSelectTextDraw(playerid);
    }
    else if(playertextid == Textdraw6[playerid])
    {
        SetProgressBarValue(HambreJ[playerid], 20.0);
        UpdateProgressBar(HambreJ[playerid], playerid);
        Informacion[playerid][pPizza] -= 1;
        ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,1,1,0,0,0);
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new npcname[24];
        GetPlayerName(playerid, npcname, 24);
        if(!strcmp(npcname, "Ricardo", true))
        {
            SetPlayerSkin(playerid, 111);
        }
        return 1;
    }

    if(GetPVarInt(playerid, "HaMuerto") == 1){
        SetPVarInt(playerid, "HaMuerto", 0);
        SetPlayerPos(playerid, 1183.31, -1325.01, 13.58);
        SetPlayerFacingAngle(playerid, -90);
        SetPlayerSkin(playerid, Informacion[playerid][pRopaPuesta]);
        return 1;
    }
    if(NuevoUsuario[playerid] == true)
    {
        SetPlayerPos(playerid, 1183.31, -1325.01, 13.58);
        return 1;
    }

    SetPlayerPos(playerid,Informacion[playerid][pPos_x],Informacion[playerid][pPos_y],Informacion[playerid][pPos_z]);
    SetPlayerVirtualWorld(playerid, Informacion[playerid][pVirtualWorld]);
    SetPlayerInterior(playerid, Informacion[playerid][pInterior]);
    SetPlayerFacingAngle(playerid, Informacion[playerid][pPos_r]);
   
    SetPlayerHealth(playerid, Informacion[playerid][pVida]);
    SetPlayerArmour(playerid, Informacion[playerid][pChaleco]);
    SetPlayerSkin(playerid, Informacion[playerid][pRopaPuesta]);
    SaludJ[playerid] = CreateProgressBar(562.800048, 191.900009, _, _, 0xFA58ACFF, 100.0);
    ShowProgressBarForPlayer(playerid, SaludJ[playerid]);
    HambreJ[playerid] = CreateProgressBar(633.200012, 279.260314, _, _, 0xF7FE2EFF, 100.0);
    ShowProgressBarForPlayer(playerid, HambreJ[playerid]);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)