My small drug system gets timer error :/
#1

Hey, Im a newb with timers, just look at this, how to kill the regernation timer after you have full health?

/takedrugs cmd:
Код:
if (strcmp("/takedrugs",cmdtext,true)==0)
{
  if(pInfo[playerid][HasDrugs] == 0)
  {
    SendClientMessage(playerid, 0xFF0000AA, "Error: You don't have any drugs to take!");
  }
  else
  {
    SetTimer("Regernation",5000,true);
    SendClientMessage(playerid, 0xFFFF00AA, "You took the drugs! You will regernate health every 10 seconds!");
    pInfo[playerid][HasDrugs] = 0;
    SetPlayerDrunkLevel(playerid, 1000);
  }
  return 1;
}
Regernation function:

Код:
forward Regernation(playerid);
public Regernation(playerid)
{
  new Float:Health;
  GetPlayerHealth(playerid, Health);

  SetPlayerHealth(playerid, Health + 10.0);
  
  if(Health >= 100)
  {
    pInfo[playerid][OnDrugs] = 0;
    SetPlayerDrunkLevel(playerid, 0);
    SendClientMessage(playerid, 0xFFFF00AA, "You are now not on drugs anymore!");
    KillTimer("Regernation");
  }
  return 1;
}
Reply


Messages In This Thread
My small drug system gets timer error :/ - by bajskorv123 - 07.02.2010, 10:22
Re: My small drug system gets timer error :/ - by jasonnw666 - 07.02.2010, 10:28
Re: My small drug system gets timer error :/ - by jasonnw666 - 07.02.2010, 10:34
Re: My small drug system gets timer error :/ - by bajskorv123 - 07.02.2010, 10:42
Re: My small drug system gets timer error :/ - by jasonnw666 - 07.02.2010, 10:49
Re: My small drug system gets timer error :/ - by jasonnw666 - 07.02.2010, 10:52

Forum Jump:


Users browsing this thread: 1 Guest(s)