#1

Код:
else if(pInfo[playerid][pBlood] <= 1000)
		{

			SendClientMessage(playerid,-1,"*"COL_RED" You have low amount of blood! Use a blood bag or a medical kit to replenish your health!");
 		}
So this detects if the user have 1000 blood or lower. The thing is, everytime it goes lower, it just sends that warning. What I want is, if the player have 1000 blood or less, it gives a message then if the user still have that 1000 blood or lower he will get another message, but after a decent amount of time. Like every 10 minutes.

So how?



[/hr]


Also check this please: https://sampforum.blast.hk/showthread.php?tid=658313

I need a solution, I can't find any...
Reply
#2

PHP код:
new BloodWarning[MAX_PLAYERS];
else if(
pInfo[playerid][pBlood] <= 1000 && gettime() > BloodWarning[playerid] + 600)// 10 minutes
{
     
SendClientMessage(playerid,-1,"*"COL_RED" You have low amount of blood! Use a blood bag or a medical kit to replenish your health!");
     
BloodWarning[playerid]=gettime();

Reply
#3

Quote:
Originally Posted by Shinja
Посмотреть сообщение
PHP код:
new BloodWarning[MAX_PLAYERS];
else if(
pInfo[playerid][pBlood] <= 1000 && gettime() > BloodWarning[playerid] + 600)// 10 minutes
{
     
SendClientMessage(playerid,-1,"*"COL_RED" You have low amount of blood! Use a blood bag or a medical kit to replenish your health!");
     
BloodWarning[playerid]=gettime();

Utils/PlayerFunctions.pwn(109 : error 029: invalid expression, assumed zero
Utils/PlayerFunctions.pwn(109 : warning 215: expression has no effect
Utils/PlayerFunctions.pwn(109 : error 001: expected token: ";", but found "if"
Reply
#4

Line? and show code above aswell
Reply
#5

Quote:
Originally Posted by Shinja
Посмотреть сообщение
Line? and show code above aswell
correction;


Utils/PlayerFunctions.pwn(110 : error 029: invalid expression, assumed zero
Utils/PlayerFunctions.pwn(110 : warning 215: expression has no effect
Utils/PlayerFunctions.pwn(110 : error 001: expected token: ";", but found "if"

Line 1108:
Код:
else if(pInfo[playerid][pBlood] <= 1000 && gettime() > BloodWarning[playerid] + 600)// 10 minutes
The whole part:
PHP код:
CheckBars(playerid)
{
    if(
pInfo[playerid][pIsPlayerSpawned] == true && pInfo[playerid][pIsPlayerInMenu] == false)
    {
        if(
pInfo[playerid][pHunger] <= 0)
        {
            new 
str[65];
            
format(str,sizeof(str),"* "COL_GREY" %s has starved to death!"pInfo[playerid][pUsername]);
            
SendNearbyMessage(60.0playeridstr, -1);
            
SendClientMessage(playerid,-1,"*"COL_GREY" You starved to death!");
            
SetPlayerHealth(playerid0.0);
        }
        else if(
pInfo[playerid][pThirst] <= 0)
        {
            new 
str[65];
            
format(str,sizeof(str),"* "COL_GREY" %s has died of thirst!"pInfo[playerid][pUsername]);
            
SendNearbyMessage(60.0playeridstr, -1);
            
SendClientMessage(playerid,-1,"*"COL_GREY" You died of thirst!");
            
SetPlayerHealth(playerid0.0);
        }
        else if(
pInfo[playerid][pBlood] <= 0)
        {
            new 
str[65];
            
format(str,sizeof(str),"* "COL_GREY" %s has died of blood loss!"pInfo[playerid][pUsername]);
            
SendNearbyMessage(60.0playeridstr, -1);
            
SendClientMessage(playerid,-1,"*"COL_GREY" You died of blood loss!");
            
SetPlayerHealth(playerid0.0);
        }
        
        else if(
pInfo[playerid][pTemperature] <= 0.0)
        {
            new 
str[65];
            
format(str,sizeof(str),"* "COL_GREY" %s has frozen to death!"pInfo[playerid][pUsername]);
            
SendNearbyMessage(60.0playeridstr, -1);
            
SendClientMessage(playerid,-1,"*"COL_GREY" You froze to death!");
            
SetPlayerHealth(playerid0.0);
        }
        new 
BloodWarning[MAX_PLAYERS]; 
        else if(
pInfo[playerid][pBlood] <= 1000 && gettime() > BloodWarning[playerid] + 600)// 10 minutes 
        

            
SendClientMessage(playerid,-1,"*"COL_RED" You have low amount of blood! Use a blood bag or a medical kit to replenish your health!"); 
            
BloodWarning[playerid]=gettime(); 
        }  
    }
    return 
1;

Reply
#6

PHP код:
else if(pInfo[playerid][pBlood] <= 1000 && gettime() > (BloodWarning[playerid] + 600))// 10 minutes 
Reply
#7

Still gives the same error tho

Utils/PlayerFunctions.pwn(110 : error 029: invalid expression, assumed zero
Utils/PlayerFunctions.pwn(110 : warning 215: expression has no effect
Utils/PlayerFunctions.pwn(110 : error 001: expected token: ";", but found "if"
Reply
#8

new BloodWarning[MAX_PLAYERS]; Must be at top of script not inside the function
Reply
#9

Quote:
Originally Posted by Shinja
Посмотреть сообщение
new BloodWarning[MAX_PLAYERS]; Must be at top of script not inside the function
Ah yeah, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)