[AJUDA] /beber bugado -
ChacaL_DesodeirO - 24.05.2013
Galera estou com um problema, tentei varias coisas e nгo consegui arrumar e sinceramente tentei pegar ate o mesmo codigo em outros GM's e substituir mas nгo de certo, o player ao beber fica com o sangue acima de 100 o que atrapalha muito, como posso consertar esse erro ?
Код:
if(strcmp(cmd, "/beber", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsAtBar(playerid))
{
if(PlayerInfo[playerid][pDorgado2] >= 70)
{
PlayerInfo[playerid][pDoenca] = 4;
PlayerInfo[playerid][pDorgado2] = 0;
SendClientMessage(playerid, COLOR_GRAD2, "* Vocк estб infectado com cirrose, vб atй um hospital se tratar !");
return true;
}
if(PlayerDrunk[playerid] < 10)
{
if(PlayerInfo[playerid][pDoenca] == 4)
{
SendClientMessage(playerid, COLOR_GRAD2, "* Vocк estб com cirrose, vб atй um hospital se tratar !");
return true;
}
new Float:health;
new x_nr[32];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr)) {
SendClientMessage(playerid, COLOR_WHITE, "|__________________[ Bar's Drinks ]__________________|");
SendClientMessage(playerid, COLOR_WHITE, "Use: /beber [Bebida]");
SendClientMessage(playerid, COLOR_GREY, "Nomes Vбlidos: Cerveja (R$3), Vodka (R$5), Whisky (R$10), Coca-Cola (R$2), Бgua (R$1)");
return true;
}
if(strcmp(x_nr,"Cerveja",true) == 0)
{
if(PlayerInfo[playerid][pAge] < 0)
{
SendClientMessage(playerid, COLOR_WHITE, "BarMan - Vocк Nгo Tem 18 Anos ou mais Para Poder Beber.");
return true;
}
GivePlayerMoney(playerid, - 3);
PlayerDrunk[playerid] += 1;
PlayerInfo[playerid][pDorgado2] += 2;
if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~Voce Esta~n~~p~Tonto~n~~g~beba agua ou coca-cola", 3500, 1); }
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 3000);
ApplyAnimation(playerid, "FOOD","EAT_Vomit_P",3.0,0,0,0,0,0);
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 15; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 15.0); }
}
}
else if(strcmp(x_nr,"Vodka",true) == 0)
{
if(PlayerInfo[playerid][pAge] < 0)
{
SendClientMessage(playerid, COLOR_WHITE, "BarMan - Vocк Nгo Tem 18 Anos ou mais Para Poder Beber.");
return true;
}
GivePlayerMoney(playerid, - 5);
PlayerDrunk[playerid] += 2;
PlayerInfo[playerid][pDorgado2] += 2;
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 3000);
ApplyAnimation(playerid, "FOOD","EAT_Vomit_P",3.0,0,0,0,0,0);
if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~Voce Esta~n~~p~Tonto~n~~g~beba agua ou coca-cola", 3500, 1); }
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 25; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 25.0); }
}
}
else if(strcmp(x_nr,"Whisky",true) == 0)
{
if(PlayerInfo[playerid][pAge] < 0)
{
SendClientMessage(playerid, COLOR_WHITE, "BarMan - Vocк Nгo Tem 18 Anos ou mais Para Poder Beber");
return true;
}
GivePlayerMoney(playerid, - 10);
PlayerDrunk[playerid] += 3;
PlayerInfo[playerid][pDorgado2] += 2;
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 3000);
ApplyAnimation(playerid, "FOOD","EAT_Vomit_P",3.0,0,0,0,0,0);
if(PlayerDrunk[playerid] >= 5) { GameTextForPlayer(playerid, "~w~Voce Esta~n~~p~Tonto~n~~g~beba agua ou coca-cola", 3500, 1); }
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 27; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 27.0); }
}
}
else if(strcmp(x_nr,"Coca-Cola",true) == 0)
{
GivePlayerMoney(playerid, - 2);
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 27; SetPlayerHealth(playerid, health + hp); }
else { SetPlayerHealth(playerid, health + 5.0); }
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) - 2300);
PlayerDrunk[playerid] = 0;
PlayerDrunkTime[playerid] = 0;
SetPlayerDrunkLevel (playerid, 0);
}
}
else if(strcmp(x_nr,"agua",true) == 0)
{
GivePlayerMoney(playerid, - 1);
if(GetPlayerHealth(playerid, health) < 100)
{
if(PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp = 2 * PlayerInfo[playerid][pAlcoholPerk]; hp += 27; SetPlayerHealth(playerid, health + hp); }
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) - 2300);
PlayerDrunk[playerid] = 0;
PlayerDrunkTime[playerid] = 0;
SetPlayerDrunkLevel (playerid, 0);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "BarMan - Nгo nгo vendemos essa bebida.");
return true;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s bebeu um(a) %s.", sendername ,x_nr);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo pode beber mais, Vocк vai vomitar...!");
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 3000);
return true;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo estб em um bar !");
return true;
}
}
return true;
}
Re: Ajuda -
SkullFire - 24.05.2013
Como assim? ele fica com 115/125 etc , de sangue ?
Re: Ajuda -
[THs]ShadoW - 24.05.2013
Coloca isso aqui no cуdigo, ve se da certo..
Код:
new Health = GetPlayerHealth(playerid)
if(Health >= 100)
{
SendClientMessage(playerid, -1, "Vocк jб estб com vida cheia !");
SetPlayerHealth(playerid, 100);
}
Re: Ajuda -
ChacaL_DesodeirO - 24.05.2013
nгo deu certo, eu coloco esse cуdigo e o da um erro falando que o pawno precisa ser fechado =/
@skull
sim ele fica subindo, jб reparei que enche atй 254
Re: Ajuda -
Gii - 24.05.2013
pawn Код:
new Float: Health;
GetPlayerHealth(playerid, Health);
if(Health >= 100)
return SendClientMessage(playerid, -1, "Vocк jб estб com vida cheia !");
Re: Ajuda -
ChacaL_DesodeirO - 25.05.2013
continua dando erro =/
Код:
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(50958) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(50982) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(50984) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(50985) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(51001) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(51003) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(51004) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(51020) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(51022) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(51023) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(51029) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(51031) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(51032) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(51042) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(51044) : error 017: undefined symbol "health"
C:\Users\01-Cerebro\Desktop\Secondary Life - Testes\gamemodes\SecondaryLife.pwn(51045) : error 017: undefined symbol "health"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Re: Ajuda -
Gii - 25.05.2013
pawn Код:
if (strcmp(cmd, "/beber", true) == 0) {
new Float: HP;
GetPlayerHealth(playerid, HP);
if(HP >= 100)
return SendClientMessage(playerid, -1, "Impossнvel executar tal aзгo, limite de vida exedido!");
if (IsAtBar(playerid)) {
if (PlayerInfo[playerid][pDorgado2] >= 70) {
PlayerInfo[playerid][pDoenca] = 4;
PlayerInfo[playerid][pDorgado2] = 0;
SendClientMessage(playerid, COLOR_GRAD2, "* Vocк estб infectado com cirrose, vб atй um hospital se tratar !");
return true;
}
if (PlayerDrunk[playerid] < 10) {
if (PlayerInfo[playerid][pDoenca] == 4) return SendClientMessage(playerid, COLOR_GRAD2, "* Vocк estб com cirrose, vб atй um hospital se tratar !");
new Float: health;
new x_nr[32];
x_nr = strtok(cmdtext, idx);
if (!strlen(x_nr)) {
SendClientMessage(playerid, COLOR_WHITE, "|__________________[ Bar's Drinks ]__________________|");
SendClientMessage(playerid, COLOR_WHITE, "Use: /beber [Bebida]");
SendClientMessage(playerid, COLOR_GREY, "Nomes Vбlidos: Cerveja (R$3), Vodka (R$5), Whisky (R$10), Coca-Cola (R$2), Бgua (R$1)");
return true;
}
if (strcmp(x_nr, "Cerveja", true) == 0) {
if (PlayerInfo[playerid][pAge] < 0) return SendClientMessage(playerid, COLOR_WHITE, "BarMan - Vocк Nгo Tem 18 Anos ou mais Para Poder Beber.");
GivePlayerMoney(playerid, -3);
PlayerDrunk[playerid] += 1;
PlayerInfo[playerid][pDorgado2] += 2;
if (PlayerDrunk[playerid] >= 5) {
GameTextForPlayer(playerid, "~w~Voce Esta~n~~p~Tonto~n~~g~beba agua ou coca-cola", 3500, 1);
}
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 3000);
ApplyAnimation(playerid, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 0);
if (GetPlayerHealth(playerid, health) < 100) {
if (PlayerInfo[playerid][pAlcoholPerk] > 0) {
PlayerDrunk[playerid] += 1;
new hp = 2 * PlayerInfo[playerid][pAlcoholPerk];
hp += 15;
SetPlayerHealth(playerid, health + hp);
} else {
SetPlayerHealth(playerid, health + 15.0);
}
}
} else if (strcmp(x_nr, "Vodka", true) == 0) {
if (PlayerInfo[playerid][pAge] < 0) return SendClientMessage(playerid, COLOR_WHITE, "BarMan - Vocк Nгo Tem 18 Anos ou mais Para Poder Beber.");
GivePlayerMoney(playerid, -5);
PlayerDrunk[playerid] += 2;
PlayerInfo[playerid][pDorgado2] += 2;
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 3000);
ApplyAnimation(playerid, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 0);
if (PlayerDrunk[playerid] >= 5) {
GameTextForPlayer(playerid, "~w~Voce Esta~n~~p~Tonto~n~~g~beba agua ou coca-cola", 3500, 1);
}
if (GetPlayerHealth(playerid, health) < 100) {
if (PlayerInfo[playerid][pAlcoholPerk] > 0) {
PlayerDrunk[playerid] += 1;
new hp = 2 * PlayerInfo[playerid][pAlcoholPerk];
hp += 25;
SetPlayerHealth(playerid, health + hp);
} else {
SetPlayerHealth(playerid, health + 25.0);
}
}
} else if (strcmp(x_nr, "Whisky", true) == 0) {
if (PlayerInfo[playerid][pAge] < 0) return SendClientMessage(playerid, COLOR_WHITE, "BarMan - Vocк Nгo Tem 18 Anos ou mais Para Poder Beber");
GivePlayerMoney(playerid, -10);
PlayerDrunk[playerid] += 3;
PlayerInfo[playerid][pDorgado2] += 2;
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 3000);
ApplyAnimation(playerid, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 0);
if (PlayerDrunk[playerid] >= 5) {
GameTextForPlayer(playerid, "~w~Voce Esta~n~~p~Tonto~n~~g~beba agua ou coca-cola", 3500, 1);
}
if (GetPlayerHealth(playerid, health) < 100) {
if (PlayerInfo[playerid][pAlcoholPerk] > 0) {
PlayerDrunk[playerid] += 1;
new hp = 2 * PlayerInfo[playerid][pAlcoholPerk];
hp += 27;
SetPlayerHealth(playerid, health + hp);
} else {
SetPlayerHealth(playerid, health + 27.0);
}
}
} else if (strcmp(x_nr, "Coca-Cola", true) == 0) {
GivePlayerMoney(playerid, -2);
if (GetPlayerHealth(playerid, health) < 100) {
if (PlayerInfo[playerid][pAlcoholPerk] > 0) {
PlayerDrunk[playerid] += 1;
new hp = 2 * PlayerInfo[playerid][pAlcoholPerk];
hp += 27;
SetPlayerHealth(playerid, health + hp);
} else {
SetPlayerHealth(playerid, health + 5.0);
}
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) - 2300);
PlayerDrunk[playerid] = 0;
PlayerDrunkTime[playerid] = 0;
SetPlayerDrunkLevel(playerid, 0);
}
} else if (strcmp(x_nr, "agua", true) == 0) {
GivePlayerMoney(playerid, -1);
if (GetPlayerHealth(playerid, health) < 100) {
if (PlayerInfo[playerid][pAlcoholPerk] > 0) {
PlayerDrunk[playerid] += 1;
new hp = 2 * PlayerInfo[playerid][pAlcoholPerk];
hp += 27;
SetPlayerHealth(playerid, health + hp);
}
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) - 2300);
PlayerDrunk[playerid] = 0;
PlayerDrunkTime[playerid] = 0;
SetPlayerDrunkLevel(playerid, 0);
}
} else return SendClientMessage(playerid, COLOR_WHITE, "BarMan - Nгo nгo vendemos essa bebida.");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s bebeu um(a) %s.", sendername, x_nr);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
} else {
SendClientMessage(playerid, COLOR_GREY, " Vocк nгo pode beber mais, Vocк vai vomitar...!");
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 3000);
return true;
}
} else return SendClientMessage(playerid, COLOR_GREY, " Vocк nгo estб em um bar !");
return true;
}
Re: Ajuda -
ChacaL_DesodeirO - 25.05.2013
agora eu bebo a agua e nao enche o sangue oO
Re: Ajuda -
ChacaL_DesodeirO - 25.05.2013
Obrigado pela ajuda caro colega iCastiei, e aos outros que tiveram intenзгo de ajudar, consegui resolver com o code passado pelo castiel.
Obrigado mesmo, valeu!