Jump to content
  • 0

pomoc Přidani hp


Benalek

Dotaz

Zdravím potřebuji udělat že když hráč nezachytí během 5sec žádnou střelu nebo ránu tak mu to bude postupně přidavat pomalu HP.. Skoušel sem to takto: ale nefunguje to... Děkuji.

 

public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
   new string[128];
   new Utocnik[MAX_PLAYER_NAME];
new Napadeny[MAX_PLAYER_NAME];
 GetPlayerName(playerid, Utocnik, sizeof (Utocnik));
   GetPlayerName(damagedid, Napadeny, sizeof (Napadeny));

   SetPlayerHealth(Napadeny,100);
   return 1;
}

Link to comment
Share on other sites

7 odpovědí na tuto otázku

Recommended Posts

  • 0

Nevím jestli to pojede. Prostě mě něco napadlo...

 

new hp[MAX_PLAYERS];
new podminka[MAX_PLAYERS];

forward neco(playerid);
public neco(playerid)
{
if(podminka[playerid] == 1)
{
GetPlayerHealth(playerid,hp[playerid]);
podminka[playerid] =2;
}
else if(podminka[playerid] == 2)
{
GetPlayerHealth(playerid,health);
if(health == hp[playerid])
{
SetPlayerHealth(playerid, health +5);
podminka[playerid] =1;
}
}
return 1;
}

public OnPlayerSpawn(playerid)
{
podminka[playerid] =1;
SetTimerEx("neco",5*1000,true,"i",playerid);
return 1;
}

Link to comment
Share on other sites

  • 0

Mám tam chybu.

 

C:\DOCUME~1\User\Plocha\MODVES~1\SAMP03~1\GAMEMO~1\mod.pwn(861) : warning 213: tag mismatch

C:\DOCUME~1\User\Plocha\MODVES~1\SAMP03~1\GAMEMO~1\mod.pwn(866) : warning 213: tag mismatch

 

public neco(playerid)

{

new health;

if(podminka[playerid] == 1)

{

řádek 861 GetPlayerHealth(playerid,hp[playerid]);

podminka[playerid] =2;

}

else if(podminka[playerid] == 2)

{

řádek 866 GetPlayerHealth(playerid,health);

if(health == hp[playerid])

{

SetPlayerHealth(playerid, health +5);

podminka[playerid] =1;

}}

return 1;

}

Link to comment
Share on other sites

  • 0

Hele zkoušel jsem to a jede to.

 

nahoru k new dej:

 

new Float:hp[MAX_PLAYERS];
new podminka[MAX_PLAYERS];

 

do public OnPlayerSpawn dej:

 

podminka[playerid] =1;
SetTimerEx("necpp",5000,true,"i",playerid); //1 000 - 1 sekunda, čas, za jak dlouho mu to bude přidávat.

 

a kamkoliv do módu:

 

 

forward necpp(playerid);
public necpp(playerid)
{
new Float:health;
if(podminka[playerid] == 1)
{
GetPlayerHealth(playerid,hp[playerid]);
podminka[playerid] =2;
}
else if(podminka[playerid] == 2)
{
GetPlayerHealth(playerid,health);
if(health == hp[playerid] && health < 90) // health < 90 = když je zdraví menší jak 90, tak mu to přidá. Jak mile bude mít víc jak 90 životů, tak mu to nebude přidávat.
{
SetPlayerHealth(playerid, health +10); // + 10 = kolik chceš aby mu to přidalo
podminka[playerid] =1;
}
}
return 1;
}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...