health regeneration for my vip players.
#7

pawn Код:
new vip[MAX_PLAYERS]; //Variable for VIP
new VipTimer[MAX_PLAYERS];

 //every minute since the server start


forward VipHealth(playerid);
public VipHealth(playerid)
{
   new vipstate = GetPlayerState(playerid);
   if(IsPlayerConnected(playerid) && vipstate == 1 || vipstate == 2 && IsPlayerConnected(playerid)) // checks to see if the player is connect and is a vip
   {
     new Float: vHealth;//variable
     GetPlayerHealth(playerid, vHealth); // setting a value to vHealth which is = to the player health
     SetPlayerHealth(playerid, vHealth + 5); // Sets the player Health +5
   }
   return 1;
}

public OnPlayerConnect(playerid)
{
    if(vip[playerid] >= 1)
    {
        VipTimer[playerid] = SetTimerEx("VipHealth", 60000, true, "i", playerid);
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(VipTimer[playerid]);
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)