A Question About "Winning HP"
#1

Hi, i want to set the Health Point of a Team +3 for each 2Sec , It is Possible to do it?

Help me Please.


RESOLVED BY varthshenon THANKS TO HIM
Reply
#2

Sorry , i forgot to say that i use zcmd...(i don't know if it works with zcmd or anything else.)
Reply
#3

Yes. Use https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#4

oK thanx , it is the Timer , but i can't found any code that Give for Ex: TEAM_COP +3HP Per 2Sec Help me please how to do it.
Reply
#5

Give me your Team variable and I'll give you an /example/ with explanation.
Reply
#6

I do not understand but i have this
pawn Код:
static gTeam[MAX_PLAYERS];
and
pawn Код:
#define TEAM_COP 2
Reply
#7

pawn Код:
new Health[MAX_TEAM];

Health[TEAM_COP] = SetTimerEx("Increasing",2000,1,"d",TEAM_COP);//Wherever you want to start increasing the team HP

forward Increasing(teamid);//Forwarding your callback

public Increasing(teamid)
{
    new Float:x;//Create a new float variable "x"
    foreach(Player,i)//Use foreach
    {
        if(gTeam[i] == teamid)//If player tim is teamid which in this case is TEAM_COP
        {
            GetPlayerHealth(playerid,x);//You know..
            SetPlayerHealth(playerid,x + 3);//This already..
        }
    }
    return 1;
}

KillTimer(Health[TEAM_COP]);//If you want to stop increasing
Reply
#8

Thank You a lot ! i have two questions please,

1-i need only the include foreach to run it?
2-how to Fix the Max HP to 200 ?

Thanx
Reply
#9

Quote:
Originally Posted by ServerScripter
Посмотреть сообщение
Thank You a lot ! i have two questions please,

1-i need only the include foreach to run it?
2-how to Fix the Max HP to 200 ?

Thanx
1. Yes, but please read the whole foreach topic to prevent asking in scripting discussion section.
2.
pawn Код:
GetPlayerHealth(playerid,x);
if(x => 200)
{
   SetPlayerHealth(playerid,200);
Reply
#10

I have 5 Errors
Код:
C:\DOCUME~1\mrich\Bureau\alaee\ANEPAS~1\ZOMBIE~1\GAMEMO~1\ZMRP.pwn(10) : error 017: undefined symbol "MAX_TEAM"
C:\DOCUME~1\mrich\Bureau\alaee\ANEPAS~1\ZOMBIE~1\GAMEMO~1\ZMRP.pwn(12) : error 010: invalid function or declaration
C:\DOCUME~1\mrich\Bureau\alaee\ANEPAS~1\ZOMBIE~1\GAMEMO~1\ZMRP.pwn(473) : error 017: undefined symbol "playerid"
C:\DOCUME~1\mrich\Bureau\alaee\ANEPAS~1\ZOMBIE~1\GAMEMO~1\ZMRP.pwn(474) : error 017: undefined symbol "playerid"
C:\DOCUME~1\mrich\Bureau\alaee\ANEPAS~1\ZOMBIE~1\GAMEMO~1\ZMRP.pwn(480) : error 021: symbol already defined: "KillTimer"
C:\DOCUME~1\mrich\Bureau\alaee\ANEPAS~1\ZOMBIE~1\GAMEMO~1\ZMRP.pwn(797) : warning 203: symbol is never used: "Health"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Edite : Please tell me where i put each code, for now i have:
pawn Код:
new Health[MAX_TEAM];Health[TEAM_ZOMBIE] = SetTimerEx("Increasing",2000,1,"d",TEAM_ZOMBIE);//Wherever you want to start increasing the team HPforward Increasing(teamid);//Forwarding your callback
Under foreach

Can u Say to me where i put the full script ? Thanx for Hellping ;)

5 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)