17/12/2020 13:33 
(Esta mensagem foi modificada pela última vez a: 17/12/2020 13:34 por LeleziiN.)
	
	
	
		Bom queria saber porque ficou dessa forma, as barras de necessidades - Fome, Sede e Sono aparecem Vazias quando o player Spawn no Servidor, ai as barrinhas vão enchendo conforme o player for jogando, e quando o player sair e volta as barras voltam aparecer vazias novamente. O que poderá ser? Podem mim ajuda Pfvr?
Ta ir o código
	
	
	
Código:
#include <a_samp>
#include <progress>
new Bar:BFome, Bar:BSede, Bar:BSono;
new Text:SFome, Text:SSede, Text:SSono, Text:TelaSono, dormindo[MAX_PLAYERS];
new TimerF[MAX_PLAYERS], TimerS[MAX_PLAYERS], TimerSo[MAX_PLAYERS];
public OnGameModeInit()
{
    BFome = CreateProgressBar(255.00, 440.00, 66.50, 5.19, 0xFF9900AA, 100);
    BSede = CreateProgressBar(327.00, 440.00, 66.50, 5.19, 0x057ABDAA, 100);
    BSono = CreateProgressBar(399.00, 440.00, 66.50, 5.19, 0xFFFFFFAA, 100);
    SetProgressBarMaxValue(BFome, 100);
    SetProgressBarMaxValue(BSede, 100);
    SetProgressBarMaxValue(BSono, 100);
    SFome = TextDrawCreate(279.000000, 431.000000, "Fome");//////
    TextDrawBackgroundColor(SFome, 255);
    TextDrawFont(SFome, 1);
    TextDrawLetterSize(SFome, 0.190000, 0.899999);
    TextDrawColor(SFome, -1);
    TextDrawSetOutline(SFome, 1);
    TextDrawSetProportional(SFome, 1);
    SSede = TextDrawCreate(352.000000, 431.000000, "Sede");/////////
    TextDrawBackgroundColor(SSede, 255);
    TextDrawFont(SSede, 1);
    TextDrawLetterSize(SSede, 0.190000, 0.899999);
    TextDrawColor(SSede, -1);
    TextDrawSetOutline(SSede, 1);
    TextDrawSetProportional(SSede, 1);
    SSono = TextDrawCreate(425.000000, 431.000000, "Sono");///////
    TextDrawBackgroundColor(SSono, 255);
    TextDrawFont(SSono, 1);
    TextDrawLetterSize(SSono, 0.190000, 0.899999);
    TextDrawColor(SSono, -1);
    TextDrawSetOutline(SSono, 1);
    TextDrawSetProportional(SSono, 1);
    TelaSono = TextDrawCreate(-30.000000, -5.000000, "TelaPreta");
    TextDrawBackgroundColor(TelaSono, 255);
    TextDrawFont(TelaSono, 1);
    TextDrawLetterSize(TelaSono, 0.700000, 53.099998);
    TextDrawColor(TelaSono, -1);
    TextDrawSetOutline(TelaSono, 0);
    TextDrawSetProportional(TelaSono, 1);
    TextDrawSetShadow(TelaSono, 1);
    TextDrawUseBox(TelaSono, 1);
    TextDrawBoxColor(TelaSono, 255);
    TextDrawTextSize(TelaSono, 650.000000, 30.000000);
    return 1;
}
public OnGameModeExit()
{
    HideProgressBarForAll(BFome);
    HideProgressBarForAll(BSede);
    HideProgressBarForAll(BSono);
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    if(GetPVarInt(playerid,"Fome") >= 95)
    {
        SetProgressBarValue(BFome,-10);
        UpdateProgressBar(BFome,playerid);
        SetPVarInt(playerid,"Fome",-10);
        UpdateProgressBar(BSono,playerid);
    }
    if(GetPVarInt(playerid,"Sede") >= 95)
    {
        SetProgressBarValue(BSede,-10);
        UpdateProgressBar(BSede,playerid);
        SetPVarInt(playerid,"Sede",-10);
        UpdateProgressBar(BSono,playerid);
    }
    return 1;
}
//Comandos
if(!strcmp(cmdtext, "/ComerLanche", true))
    {
        new stringx[128];
        if(!CPS_IsPlayerInCheckpoint(playerid, CPLojaShopping[5]) && (EmpresaAtual[playerid] == -1) || (PlayerNaLoja[playerid] != 5) && (EmpresaAtual[playerid] == -1) || (EmpresaAtual[playerid] != -1) && (!CPS_IsPlayerInCheckpoint(playerid, CPCluckinBell)) && (!CPS_IsPlayerInCheckpoint(playerid, CPBurguerShot)) && (!CPS_IsPlayerInCheckpoint(playerid, CPTheWell)))
        {
            SendClientMessage(playerid, CORX1, "| ERRO | Você não está no restaurante!");
            return 1;
        }
        /*if(!CPS_IsPlayerInCheckpoint(playerid, CPPetShop))
        {
            SendClientMessage(playerid, CORX1, "| ERRO | Desativado! /VerLanches");
            return 1;
        }*/
        new Preco = 50;
        if(EmpresaAtual[playerid] == -1)
        {
            if((ShoppingLiquidacao == 0) && (GetPlayerMoneyEx(playerid) < Preco))
            {
                SendClientMessage(playerid, CORX1, "| ERRO | Você não tem dinheiro suficiente (R$ 50)!");
                return 1;
            }
            else if((ShoppingLiquidacao == 1) && (GetPlayerMoneyEx(playerid) < (Preco / 2)))
            {
                  SendClientMessage(playerid, CORX1, "| ERRO | Você não tem dinheiro suficiente (R$ 25)!");
                  return 1;
            }
            if(ShoppingLiquidacao == 0) GivePlayerMoneyEx(playerid, - Preco);
            else if(ShoppingLiquidacao == 1) GivePlayerMoneyEx(playerid, -(Preco / 2));
            format(stringx, sizeof(stringx), "| SHOPPING | Obrigado por comprar, %s!", PlayerName(playerid));
        }
        else
        {
            if(GetPlayerMoneyEx(playerid) < Preco)
            {
                SendClientMessage(playerid, CORX1, "| ERRO | Você não tem dinheiro suficiente (R$ 50)!");
                return 1;
            }
            GivePlayerMoneyEx(playerid, - Preco);
            format(stringx, sizeof(stringx), "* Obrigado por comprar, %s!", PlayerName(playerid));
            new A[25];
            format(A, sizeof(A), "%d", ((dini_Int(EmpresasFile(EmpresaAtual[playerid]),"Receber")) + Preco));
             dini_Set(EmpresasFile(EmpresaAtual[playerid]), "Receber", A);
             if(IsPlayerConnected(EmpresaDono[EmpresaAtual[playerid]]))
             {
        if(Linguagem[EmpresaDono[EmpresaAtual[playerid]]] == 0)
        {
            format(stringx, sizeof(stringx), "| LUCRO | %s comprou em sua Empresa ID %d", PlayerName(playerid), EmpresaAtual[playerid]);
            SendClientMessage(EmpresaDono[EmpresaAtual[playerid]], COR_ORKUT, stringx);
          }
          else
        {
        format(stringx, sizeof(stringx), "| PROFIT | %s bought in your Company ID %d", PlayerName(playerid), EmpresaAtual[playerid]);
        SendClientMessage(EmpresaDono[EmpresaAtual[playerid]], COR_ORKUT, stringx);
        }
             }
        }
        SendClientMessage(playerid, COR_ORKUT, stringx);
        new Float:V;
        GetPlayerHealth(playerid, V);
        if(V < 49.0)
            SetPlayerHealth(playerid, (V + 50.0));
        else
            SetPlayerHealth(playerid, 99.0);
            SetPVarInt(playerid,"Fome",GetPVarInt(playerid,"Fome")-15);
            SetProgressBarValue(BFome, GetPVarInt(playerid,"Fome"));
            UpdateProgressBar(BFome,playerid);
        ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
        SendClientMessage(playerid,-1,"| INDO | Você acabou de matar sua fome");
        OnePlayAnim(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0); // Eat Burger
          UsandoAnimacao[playerid] = 1;
        return 1;
    }
    if(!strcmp(cmdtext, "/BeberBebida", true))
    {
        new stringx[128];
        if(!CPS_IsPlayerInCheckpoint(playerid, CPLojaShopping[6]) && (EmpresaAtual[playerid] == -1) || (PlayerNaLoja[playerid] != 6) && (EmpresaAtual[playerid] == -1) || (EmpresaAtual[playerid] != -1) && (!CPS_IsPlayerInCheckpoint(playerid, CPBar1)) || (EmpresaAtual[playerid] != -1) && (!CPS_IsPlayerInCheckpoint(playerid, CPBar2)))
        {
            SendClientMessage(playerid, CORX1, "| ERRO | Você não está no bar!");
            return 1;
        }
        /*if(!CPS_IsPlayerInCheckpoint(playerid, CPPetShop))
        {
            SendClientMessage(playerid, CORX1, "| ERRO | Desativado! /VerLanches");
            return 1;
        }*/
        new Preco = 50;
        if(EmpresaAtual[playerid] == -1)
        {
            if((ShoppingLiquidacao == 0) && (GetPlayerMoneyEx(playerid) < Preco))
            {
                SendClientMessage(playerid, CORX1, "| ERRO | Você não tem dinheiro suficiente (R$ 50)!");
                return 1;
            }
            else if((ShoppingLiquidacao == 1) && (GetPlayerMoneyEx(playerid) < (Preco / 2)))
            {
                  SendClientMessage(playerid, CORX1, "| ERRO | Você não tem dinheiro suficiente (R$ 25)!");
                  return 1;
            }
            if(ShoppingLiquidacao == 0) GivePlayerMoneyEx(playerid, - Preco);
            else if(ShoppingLiquidacao == 1) GivePlayerMoneyEx(playerid, -(Preco / 2));
            format(stringx, sizeof(stringx), "| SHOPPING | Obrigado por comprar, %s!", PlayerName(playerid));
        }
        else
        {
            if(GetPlayerMoneyEx(playerid) < Preco)
            {
                SendClientMessage(playerid, CORX1, "| ERRO | Você não tem dinheiro suficiente (R$ 50)!");
                return 1;
            }
            GivePlayerMoneyEx(playerid, - Preco);
            format(stringx, sizeof(stringx), "* Obrigado por comprar, %s!", PlayerName(playerid));
            new A[25];
            format(A, sizeof(A), "%d", ((dini_Int(EmpresasFile(EmpresaAtual[playerid]),"Receber")) + Preco));
             dini_Set(EmpresasFile(EmpresaAtual[playerid]), "Receber", A);
             if(IsPlayerConnected(EmpresaDono[EmpresaAtual[playerid]]))
             {
        if(Linguagem[EmpresaDono[EmpresaAtual[playerid]]] == 0)
        {
            format(stringx, sizeof(stringx), "| LUCRO | %s comprou em sua Empresa ID %d", PlayerName(playerid), EmpresaAtual[playerid]);
            SendClientMessage(EmpresaDono[EmpresaAtual[playerid]], COR_ORKUT, stringx);
          }
          else
        {
        format(stringx, sizeof(stringx), "| PROFIT | %s bought in your Company ID %d", PlayerName(playerid), EmpresaAtual[playerid]);
        SendClientMessage(EmpresaDono[EmpresaAtual[playerid]], COR_ORKUT, stringx);
        }
             }
        }
        SendClientMessage(playerid, COR_ORKUT, stringx);
        new Float:V;
        GetPlayerHealth(playerid, V);
        if(V < 49.0)
            SetPlayerHealth(playerid, (V + 50.0));
        else
            SetPlayerHealth(playerid, 99.0);
            SetPVarInt(playerid,"Fome",GetPVarInt(playerid,"Fome")-15);
            SetProgressBarValue(BFome, GetPVarInt(playerid,"Fome"));
            UpdateProgressBar(BFome,playerid);
        ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0);
        SendClientMessage(playerid,-1,"| INDO | Você acabou de matar sua fome");
        OnePlayAnim(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0); // Eat Burger
          UsandoAnimacao[playerid] = 1;
        return 1;
    }
forward Fome(playerid);
public Fome(playerid)
{
    SetPVarInt(playerid,"Fome",GetPVarInt(playerid,"Fome")+5);
    SetProgressBarValue(BFome, GetPVarInt(playerid,"Fome"));
    UpdateProgressBar(BFome,playerid);
    if(GetPVarInt(playerid,"Fome") == 75)
    {
        new Float:Vida;
        GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-15.0);
        SendClientMessage(playerid,-1,"| INFO | Vá até um restaurante comer ou você irá morrer de fome!");
    }
    if(GetPVarInt(playerid,"Fome") == 80)
    {
        new Float:Vida;
        GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-20.0);
        SendClientMessage(playerid,-1,"| INFO | Vá até um restaurante comer ou você irá morrer de fome!");
    }
    if(GetPVarInt(playerid,"Fome") == 85)
    {
        new Float:Vida;
        GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-25.0);
        SendClientMessage(playerid,-1,"| INFO | Vá até um restaurante comer ou você irá morrer de fome!");
    }
    if(GetPVarInt(playerid,"Fome") == 90)
    {
        new Float:Vida;
        GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-20.0);
        SendClientMessage(playerid,-1,"| INFO | Vá até um restaurante comer ou você irá morrer de fome!");
    }
    if(GetPVarInt(playerid,"Fome") == 100)
    {
        new Float:Vida;
        GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-20.0);
        SendClientMessage(playerid,-1,"| INFO | Vá até um restaurante comer ou você irá morrer de fome!");
    }
    return 1;
}
forward Sede(playerid);
public Sede(playerid)
{
    SetPVarInt(playerid,"Sede",GetPVarInt(playerid,"Sede")+5);
    SetProgressBarValue(BSede, GetPVarInt(playerid,"Sede"));
    UpdateProgressBar(BSede,playerid);
    if(GetPVarInt(playerid,"Sede") == 75)
    {
        new Float:Vida;
        GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-15.0);
        SendClientMessage(playerid,-1,"| INFO | Vá até um restaurante beber ou você irá morrer de sede!");
    }
    if(GetPVarInt(playerid,"Sede") == 80)
    {
        new Float:Vida;
        GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-20.0);
        SendClientMessage(playerid,-1,"| INFO | Vá até um restaurante beber ou você irá morrer de sede!");
    }
    if(GetPVarInt(playerid,"Sede") == 85)
    {
        new Float:Vida;
        GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-25.0);
        SendClientMessage(playerid,-1,"| INFO | Vá até um restaurante beber ou você irá morrer de sede!");
    }
    if(GetPVarInt(playerid,"Sede") == 90)
    {
        new Float:Vida;
        GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-20.0);
        SendClientMessage(playerid,-1,"| INFO | Vá até um restaurante beber ou você irá morrer de sede!");
    }
    if(GetPVarInt(playerid,"Sede") >= 100)
    {
        new Float:Vida;
        GetPlayerHealth(playerid,Vida),SetPlayerHealth(playerid,Vida-25.0);
        SendClientMessage(playerid,-1,"| INFO | Vá até um restaurante beber ou você irá morrer de sede!");
    }
    return 1;
}
forward Sono(playerid);
public Sono(playerid)
{
    SetPVarInt(playerid,"Sono",GetPVarInt(playerid,"Sono")+5);
    SetProgressBarValue(BSono, GetPVarInt(playerid,"Sono"));
    UpdateProgressBar(BSono, playerid);
    if(GetPVarInt(playerid,"Sono") == 90){
    if(dormindo[playerid] == 0){
        SendClientMessage(playerid,-1,"| INFO | Você está com sono, durma ou irá desmaiar!");
    }
    }
    if(GetPVarInt(playerid,"Sono") == 95){
    if(dormindo[playerid] == 0){
        SendClientMessage(playerid,-1,"| INFO | Você está com sono, durma ou irá desmaiar!");
    }
    }
    if(GetPVarInt(playerid,"Sono") == 100)
    {
        if(dormindo[playerid] == 0){
        SendClientMessage(playerid,-1,"| INFO | Você desmaiou de sono!");
        ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
        TogglePlayerControllable(playerid,0);
        TextDrawShowForPlayer(playerid, TelaSono);
        SetTimerEx("Acordar", 60000, false, "i", playerid);
        dormindo[playerid] = 1;
        }
        return 1;
    }
    return 1;
}
forward Acordar(playerid);
public Acordar(playerid)
{
    TextDrawHideForPlayer(playerid, TelaSono);
    SendClientMessage(playerid,-1,"| INFO | Você acordou!");
    dormindo[playerid] = 0;
    SetPVarInt(playerid,"Sono",GetPVarInt(playerid,"Sono")-100);
    SetProgressBarValue(BSono, GetPVarInt(playerid,"Sono"));
    UpdateProgressBar(BSono,playerid);
    TogglePlayerControllable(playerid,1);
    GameTextForPlayer(playerid, "~r~Acordado!" , 3000, 4);
    ClearAnimations(playerid);
}Ta ir o código
