[Ajuda] Ao beber cafй, a vida aumenta mesmo estando 100
#1

Gente, criei este comando aqui, mas ai tipo.. se ele tiver 100 de life, e se ele beber cafй, a vida dele aumenta pra depois de 100, e eu queria que o limite de vida fosse 100, como arrumar isto?


PHP код:
if(strcmp(cmd"/bebercafe"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
IsAtCafe(playerid))
            {
                if(
PlayerInfo[playerid][pDorgado2] >= 70)
                {
                    
PlayerInfo[playerid][pDoenca] = 4;
                    
PlayerInfo[playerid][pDorgado2] = 0;
                    
SendClientMessage(playeridCOLOR_GRAD2"* Vocк estб infectado com cirrose, vб atй um hospital se tratar !");
                    return 
true;
                }
                if(
PlayerDrunk[playerid] < 10)
                {
                    if(
PlayerInfo[playerid][pDoenca] == 4)
                      {
                        
SendClientMessage(playeridCOLOR_GRAD2"* Vocк estб com cirrose, vб atй um hospital se tratar!");
                        return 
true;
                      }
                    new 
Float:health;
                    new 
x_nr[32];
                    
x_nr strtok(cmdtextidx);
                    if(!
strlen(x_nr)) {
                        
SendClientMessage(playeridCOLOR_WHITE"|__________________[ Cafeteria ]__________________|");
                        
SendClientMessage(playeridCOLOR_WHITE"Use: /beber cafe");
                          
SendClientMessage(playeridCOLOR_GREY"Nomes Vбlidos: Cafй (R$10,00");
                        return 
true;
                    }
                    if(
strcmp(x_nr,"Cafй",true) == 0)
                    {
                        if(
PlayerInfo[playerid][pAge] < 0)
                        {
                            
SendClientMessage(playeridCOLOR_WHITE"Cafeteria - Vocк Nгo Tem 18 Anos ou mais Para Poder Beber.");
                            return 
true;
                        }
                        
GivePlayerMoney(playerid, - 3);
                        
ApplyAnimation(playerid"FOOD","EAT_Vomit_P",3.0,0,0,0,0,0);
                        if(
GetPlayerHealth(playeridhealth) < 100)
                        {
                            if(
PlayerInfo[playerid][pAlcoholPerk] > 0) { PlayerDrunk[playerid] += 1; new hp PlayerInfo[playerid][pAlcoholPerk]; hp += 15SetPlayerHealth(playeridhealth hp); }
                            else { 
SetPlayerHealth(playeridhealth 15.0); }
                        }
                    }
                    else
                    {
                        
SendClientMessage(playeridCOLOR_WHITE"BarMan - Nгo nгo vendemos essa bebida.");
                        return 
true;
                    }
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    
format(stringsizeof(string), "* %s bebeu um cafй."sendername ,x_nr);
                    
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
                    
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY"   Vocк nгo pode beber mais cafй, vocк vai passar mau...!");
                    
SetPlayerDrunkLevel(playeridGetPlayerDrunkLevel(playerid) + 3000);
                    return 
true;
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"   Vocк nгo estб em uma Cafeteria!");
                return 
true;
            }
        }
        return 
true;
    } 
Reply
#2

pawn Код:
// Corrigindo
new Float:health;
GetPlayerHealth(playerid, health)
if(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); }
}
Reply
#3

Desculpa, nгo sei adaptar este cуdigo aн ao que eu passei, teria como vocк adaptar? ;x
Reply
#4

pawn Код:
if(strcmp(cmd, "/bebercafe", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsAtCafe(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;
                    GetPlayerHealth(playerid, health)
                    new x_nr[32];
                    x_nr = strtok(cmdtext, idx);
                    if(!strlen(x_nr)) {
                        SendClientMessage(playerid, COLOR_WHITE, "|__________________[ Cafeteria ]__________________|");
                        SendClientMessage(playerid, COLOR_WHITE, "Use: /beber cafe");
                          SendClientMessage(playerid, COLOR_GREY, "Nomes Vбlidos: Cafй (R$10,00");
                        return true;
                    }
                    if(strcmp(x_nr,"Cafй",true) == 0)
                    {
                        if(PlayerInfo[playerid][pAge] < 0)
                        {
                            SendClientMessage(playerid, COLOR_WHITE, "Cafeteria - Vocк Nгo Tem 18 Anos ou mais Para Poder Beber.");
                            return true;
                        }
                        GivePlayerMoney(playerid, - 3);
                        ApplyAnimation(playerid, "FOOD","EAT_Vomit_P",3.0,0,0,0,0,0);
                        if(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
                    {
                        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 cafй.", 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 cafй, vocк vai passar mau...!");
                    SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 3000);
                    return true;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк nгo estб em uma Cafeteria!");
                return true;
            }
        }
        return true;
    }
Reply
#5

Erro!

error 001: expected token: ";", but found "new"

Linha: new x_nr[32];

q pode ser?
Reply
#6

pawn Код:
...w Float:health;
GetPlayerHealth(playerid, health); // Tava faltando o ; daqui
new x_nr[32];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr)) {
SendClientMess...
Espero ter sido ъtil.
Reply
#7

Valeu! =)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)