for(new i; i<GetMaxPlayers();)
{
new PulsHP[100];
new Float: hp;
PulsHP[GetPlayerHealth(i,hp)] -= 1;
SetPlayerHealth(i,hp);
}
for ( new i; i < GetMaxPlayers(); i++ )
{
new
Float:hp
;
GetPlayerHealth( i, hp );
if ( hp > 0.0 && hp <= 1.0 )
SetPlayerHealth( i, 100.0 );
else
SetPlayerHealth( i, hp - 1.0 );
}
public pulsar()
{
static Float:playerHealthKey[MAX_PLAYERS] = {1.0,..};
for ( new playerid, maxPlayers = GetMaxPlayers(), Float:health; playerid < maxPlayers; playerid++ )
{
GetPlayerHealth( playerid, health );
switch(floatcmp( health, playerHealthKey[playerid]))
{
case 1:
{
SetPlayerHealth( playerid, health - 1.0 );
}
case -1:
{
SetPlayerHealth( playerid, health + 1.0 );
}
case 0:
{
playerHealthKey[playerid] = (!floatcmp(playerHealthKey[playerid], 100.0)) ? 1.0 : 100.0;
}
}
}
}
static Float ![]() |
SetTimerEx("Pulsator",100,1,"d",playerid);
forward Pulsator(playerid);
public Pulsator(playerid)
{
new Float:hp;
GetPlayerHealht(playerid, hp);
(hp < 1.1) ? SetPlayerHealth(playerid, 100.0) : SetPlayerHealth(playerid, hp - 1.0);
return 1;
}
вот здесь error 029
ну вообщем хп у меня убавляется, а вот прибавить неполучается, он у меня умирает и неуспевая заспванится снова умирает. и так бесконечно |
static Float:PlayerHealthKey[MAX_PLAYERS] = {1.0,...};
public Pulsator(playerid)
{
new Float:hp;
GetPlayerHealht(playerid, hp);
if(GetPVarInt(playerid, "Increase") == 1)
{
if(hp > 99.1) SetPVarInt(playerid,"Increase", 0);
else SetPlayerHealth(playerid, hp + 1.0);
}
else if(GetPVarInt(playerid, "Increase") == 0)
{
if(hp < 1.1) SetPVarInt(playerid,"Increase", 1);
else SetPlayerHealth(playerid, hp - 1.0);
}
return 1;
}
new timer[max_players];
timer[playerid] = SetTimer("PulsatorHealth",1,true);
срабатывает, но ипользовать может только 1 игрок, второй игрок уже не может...
как сделать отделльно для игроков? что то вроде PHP код:
|