Sistema de Fome, Sede e Sono - LeleziiN - 17/12/2020
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?
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
RE: Sistema de Fome, Sede e Sono - SkolPlay - 17/12/2020
Tem que fazer um salvamento. Quando o player deslogar, as barrinhas ficam salva e quando ele logar, vai continuar onde parou
RE: Sistema de Fome, Sede e Sono - LeleziiN - 17/12/2020
Certo mais, pq as barrinhas sempre spawn vazias e vai enchendo conforme o tempo de jogo vai passando - tipo a pessoa logou no Servidor ai quando espana as barrinhas aparecem vazias ai conforme a pessoa vai passando o tempo jogando no servidor elas vão enchendo
RE: Sistema de Fome, Sede e Sono - SkolPlay - 17/12/2020
Use esse sistema que fiz, tá sem nenhum problema:
Sistema de fome, sede e sono
RE: Sistema de Fome, Sede e Sono - LeleziiN - 18/12/2020
(17/12/2020 16:56)SkolPlay Escreveu: Use esse sistema que fiz, tá sem nenhum problema:
Sistema de fome, sede e sono
Mais amigo eu estou usando esse sistema já só fiz adc os comando para comer e beber e dormir de acordo com o sistema do meu Gamemode
RE: Sistema de Fome, Sede e Sono - SkolPlay - 18/12/2020
(18/12/2020 09:39)LeleziiN Escreveu: (17/12/2020 16:56)SkolPlay Escreveu: Use esse sistema que fiz, tá sem nenhum problema:
Sistema de fome, sede e sono
Mais amigo eu estou usando esse sistema já só fiz adc os comando para comer e beber e dormir de acordo com o sistema do meu Gamemode
O sistema que tu está utilizando não é meu.
RE: Sistema de Fome, Sede e Sono - LeleziiN - 18/12/2020
Mano pode ter certeza que é o seu sistema, a única coisa que fiz foi adicionar mais coisas tipo os comandos para dormir, cormer e beber.
Vou postar o sistema completo para vc ver
RE: Sistema de Fome, Sede e Sono - SkolPlay - 18/12/2020
(18/12/2020 12:16)LeleziiN Escreveu: Mano pode ter certeza que é o seu sistema, a única coisa que fiz foi adicionar mais coisas tipo os comandos para dormir, cormer e beber.
Vou postar o sistema completo para vc ver
Me desculpe, é a minha mesmo, não tinha prestado atenção.
Bom, fiz testes aqui na minha FS, e funcionou normalmente, spawnei diversas vezes e as barrinhas continua normais. Reveja o meu codigo e vai editando aos poucos, porque aqui ta tudo normal...
RE: Sistema de Fome, Sede e Sono - walker_join - 20/12/2020
ei mano eu baixei seu sistema mas nao ta compilando.
usei essa include progress: https://github.com/Agneese-Saini/SA-MP/blob/master/pawno/include/progress.inc
porem esta dando error 017: undefined symbol "CreateProgressBar" e mais 23 desses.
pode me ajudar ?
RE: Sistema de Fome, Sede e Sono - SkolPlay - 20/12/2020
(20/12/2020 07:45)walker_join Escreveu: ei mano eu baixei seu sistema mas nao ta compilando.
usei essa include progress: https://github.com/Agneese-Saini/SA-MP/blob/master/pawno/include/progress.inc
porem esta dando error 017: undefined symbol "CreateProgressBar" e mais 23 desses.
pode me ajudar ? Sim, aqui a include que utilizo: http://www.mediafire.com/file/y4gn2rwj12gcnbl/progress.inc/file
|