to stop repeating the checkpoint
#1

hey,i wanted to make if player enters checkpoint,then he will get the thing only once,and the checkpoint wont dissapear,how to do that?Thanks,or if u dont know,how to make that it gives 1 hp per sec?
Reply
#2

I took it to myself to create it for you. Edit it how you like. (Untested)
pawn Код:
new HealthTimer;
forward RaiseHealth(playerid, Float:Health);

public RaiseHealth(playerid)
{
    new
        Float:Health;
       
    GetPlayerHealth(playerid, Float:Health);
    SetPlayerHealth(playerid, Float:Health+1.00);
    return true;
}

public OnPlayerEnterCheckpoint(playerid)
{
    HealthTimer = SetTimerEx("RaiseHealth", 1000, true, "f", playerid);
    return true;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    KillTimer(HealthTimer);
    return true;
}
Reply
#3

Quote:
Originally Posted by Aber▲
I took it to myself to create it for you. Edit it how you like. (Untested)
pawn Код:
code..
You're code is wrong.

pawn Код:
new
    healthTimer[MAX_PLAYERS];
pawn Код:
forward RaiseHealth(playerid);
pawn Код:
public RaiseHealth(playerid)
{
  new
      Float:health;
  GetPlayerHealth(playerid, health);
  SetPlayerHealth(playerid, floatround(health) + 1);
  if(health >= 100.0)
  {
    KillTimer(healthTimer[playerid]);
    SetPlayerHealth(playerid, 100);
  }
  return true;
}
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
  healthTimer[playerid] = SetTimerEx("RaiseHealth", 1000, true, "i", playerid);
  return true;
}
pawn Код:
public OnPlayerLeaveCheckpoint(playerid)
{
  KillTimer(healthTimer[playerid]);
  return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)