SA-MP Forums Archive
Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem (/showthread.php?tid=630262)



Problem - Krauser123 - 11.03.2017

Okay the problem is just about spending here is the function !


PHP код:
public SetPlayerHungerEx(playeridFloatxtime)
{
    new 
Floathealth;
    if(
0)
    {
        
TextDrawShowForPlayer(playeridFoodProgressPlus);
        if(
ProgressBarValue[playerid][BAR_FOOD] < 100)
        {
            
ProgressBarValue[playerid][BAR_FOOD]++;
            switch(
ProgressBarValue[playerid][BAR_FOOD])
            {
                case 
53: { Hunger(playerid1); TextDrawHideForPlayer(playeridFoodProgressWarning); SendClientMessage(playeridCOLOR_WHITE"SERVER: You are no longer suffering from hunger."); }//52.5 is 50 precent
                
case 44: { Hunger(playerid1); SendClientMessage(playeridCOLOR_WHITE"SERVER: Your hunger level has decreased. You are suffering from hunger level 1."); }//62.0 is 60 percent
                
case 34: { Hunger(playerid1); SendClientMessage(playeridCOLOR_WHITE"SERVER: Your hunger level has decreased. You are suffering from hunger level 2."); }//71.5 is 70 percent
                
case 25: { Hunger(playerid1); SendClientMessage(playeridCOLOR_WHITE"SERVER: Your hunger level has decreased. You are suffering from hunger level 3."); }//81.0 is 80 percent
                
case 15: { Hunger(playerid1); SendClientMessage(playeridCOLOR_WHITE"SERVER: Your hunger level has decreased. You are suffering from hunger level 4."); }//90.5 is 90 percent
                
case 6: { Hunger(playerid1); SendClientMessage(playeridCOLOR_WHITE"SERVER: Your hunger level has decreased. You are suffering from hunger level 5."); }//90.5 is 90 percent
            
}
        }
        else
        {
            
GetPlayerHealth(playeridhealth);
            
health health 1.0;
            
SetPlayerHealth(playeridhealth);
            if(
health <= 0.0)
            {
                
PlayerInfo[playerid][pSpawn] = 99;
            }
            if(
PlayerInfo[playerid][pRace] == 2)
            {
                if(
== 1)
                {
                    
SetTimerEx("Vomit"15000+random(15000), false"i"playerid);
                }
            }
            else
            {
                if(
== 1)
                {
                    
SetTimerEx("Vomit"15000+random(15000), false"i"playerid);
                }
            }
        }
        
x--;
    }
    else if(
0)
    {
        
TextDrawShowForPlayer(playeridFoodProgressMinus);
        if(
ProgressBarValue[playerid][BAR_FOOD] > 5)
        {
            
ProgressBarValue[playerid][BAR_FOOD] -= 1;
            switch(
ProgressBarValue[playerid][BAR_FOOD])
            {
                case 
52: { Hunger(playerid, -1); TextDrawShowForPlayer(playeridFoodProgressWarning); SendClientMessage(playeridCOLOR_WHITE"You are suffering from hunger level 1."); }//62.0 is 60 percent
                
case 43: { Hunger(playerid, -1); SendClientMessage(playeridCOLOR_RED"SERVER: Your hunger level has increased. You are suffering from hunger level 2."); }//71.5 is 70 percent
                
case 33: { Hunger(playerid, -1); SendClientMessage(playeridCOLOR_RED"SERVER: Your hunger level has increased. You are suffering from hunger level 3."); }//81.0 is 80 percent
                
case 24: { Hunger(playerid, -1); SendClientMessage(playeridCOLOR_RED"SERVER: Your hunger level has increased. You are suffering from hunger level 4."); }//90.5 is 90 percent
                
case 14: { Hunger(playerid, -1); SendClientMessage(playeridCOLOR_RED"SERVER: Your hunger level has increased. You are suffering from hunger level 5."); }//100.0 is 100 percent
                
case 5: { Hunger(playerid, -1); SendClientMessage(playeridCOLOR_RED"SERVER: Your hunger level has increased. You are suffering from hunger level 6."); }//100.0 is 100 percent
            
}
        }
        
x++;
    }
    
SetProgressBarValue(BAR_FOODplayeridProgressBarValue[playerid][BAR_FOOD]);
    
ShowProgressBarForPlayer(BAR_FOODplayerid);
    if(
!= 0)
    {
        
SetTimerEx("SetPlayerHungerEx"timefalse"iii"playeridFloatxtime);
        return 
1;
    }
    
TextDrawHideForPlayer(playeridFoodProgressPlus);
    
TextDrawHideForPlayer(playeridFoodProgressMinus);
    return 
1;

but when I use it for example

PHP код:
SetPlayerHungerEx(playerid,-7.6*amount,1000); 
it doesn't spend it the right way please help me out


P.S : I just want to do something like it.