[Help] Putting a time
#1

Good night, I'm in need of a little help.
The system is the following when a player is hit with a shot, he start to lose life
the problem is that he lose life very fast.
I need have he lose life every 15 seconds.
I will be very grateful if anyone can help!

CODE

PHP код:
            if(PlayerInfo[i][pTakesashot] > 0
            { 
                   if(
OtherInfos[i][oLoselife] < 5OtherInfos[i][oLoselife]++; 
                else 
                { 
                      
OtherInfos[i][oLoselife] = 0
                    
SendClientMessage(iCOLOR_LIGHTRED"You are losing your life due to an untreated bullet or stab wound."); 
                    new 
Float:Lose
                    if(
PlayerInfo[i][pHeavyShot] > 0Lose8.0
                    else 
Lose5.0
                    new 
Float:health
                    
GetPlayerHealth(i,health); 
                    
SetPlayerHealth(ihealth-Lose); 
                    
HealthPlayerid[i] = health-Lose
                } 
            } 
Reply
#2

We need more code...
Reply
#3

Код:
new lastHPLose;

timer loseHP[1000]() {
	if(!lastHPLose) lastHPLose = gettime();
	else if(lastHPLose && (gettime()-lastHPLose) == 15) {
		// your code
		lastHPLose = gettime();
	}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)