SA-MP Forums Archive
[Ajuda] sistema de sede - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] sistema de sede (/showthread.php?tid=593305)



sistema de sede - zPawnu - 03.11.2015

bom pessoal eu criei um sistema de fome e sede porem eu quero quando o player entrar na бgua do mar o pote de бgua de encher sozinha poderiam me ajudar ?

PHP код:
else if(pInfo[playerid][SelectedItem] == 1023// Agua_Cheia
            
{
                
GiveItem[playerid][Agua_Cheia]--;
                
SetPVarInt(playerid,"Sede1",GetPVarInt(playerid,"Sede1")-12);
                
SetProgressBarValue(SedeGetPVarInt(playerid,"Sede1"));
                
UpdateProgressBar(Sedeplayerid);
                
ClearAnimations(playerid);
                
ApplyAnimation(playerid,"VENDING","VEND_Drink_P",2,0,0,0,0,1200,1);
                
GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~g~~h~Bebendo...",2000,3);
                
GiveItem[playerid][Agua_Vazia]++;
                return 
1;
            } 
public de sede

PHP код:
public Sede1(playerid)
{
    
SetPVarInt(playerid,"Sede1",GetPVarInt(playerid,"Sede1")+7);
    
SetProgressBarValue(SedeGetPVarInt(playerid,"Sede1"));
    
UpdateProgressBar(Sedeplayerid);
    if(
GetPVarInt(playerid,"Sede1") >= 95)
    {
        
SetPlayerHealth(playerid0);
        
SendClientMessage(playerid,-1,"{FFFFFF}* Voce morreu de sede!");
    }
    return 
1;




Re: sistema de sede - [BOPE]Seu._.Madruga - 04.11.2015

Algo do tipo, teste e adapte...
PHP код:
enum tInfo {
    
pCheckInAgua
}

new 
TimerInfo[MAX_PLAYERS][tInfo];

forward OnPlayerInAgua(playerid);

public 
OnPlayerConnect(playerid)
{
    
TimerInfo[playerid][pCheckInAgua] = SetTimerEx("OnPlayerInAgua"2000true"i"playerid);
    return 
1;
}

public 
OnPlayerDisconnect(playeridreason)
{
    
KillTimer(TimerInfo[playerid][pCheckInAgua]);
    return 
1;
}

public 
OnPlayerInAgua(playerid)
{
    static 
Floatvida;
    
GetPlayerHealthplayerid,  vida );
    if(
vida != 0.0)
    {
        static 
anime;
         
anime GetPlayerAnimationIndex(playerid);
        if ((
anime== 1544) || (anime== 1250) || (anime== 1062) ||  ((anime>=  1538) && (anime<= 1542)))
        {
            if(
pInfo[playerid][SelectedItem] == 1023// Agua_Cheia
            
{
                
GiveItem[playerid][Agua_Cheia]--;
                
SetPVarInt(playerid,"Sede1",GetPVarInt(playerid,"Sede1")-12);
                
SetProgressBarValue(SedeGetPVarInt(playerid,"Sede1"));
                
UpdateProgressBar(Sedeplayerid);
                return 
1;
            }
        }
    }
    return 
true;