refill health
#1

I made an admin class.
But how do I make the admin player heal refill after every 1 secound?

so it like infinit health?
Reply
#2

You can do it simply, just like this:
PHP код:
public OnPlayerUpdate(playerid){
    if(
IsPlayerAdmin(playerid)) SetPlayerHealth(playerid100);

Reply
#3

Quote:
Originally Posted by n00b_scripter
Посмотреть сообщение
SetTimer("AdminClass",1000,1);
forward AdminClass();
public AdminClass();
{
//your health refill codes here
}
For making the indentation more better and also with pawn tags:-

pawn Код:
forward AdminRefillHealth();// in top


SetTimer("AdminRefillHealth", 1000, true); // put where ever you want maybe in a command or somewhere else like gamemodeinit


public AdminRefillHealth()
{
    for(new f = 0; f < MAX_PLAYERS; f++) // making loop
    {
        if(IsPlayerConnected(f))
        {
            if(IsPlayerAdmin(f)) // change this to your var if you want. this is a default RCON admins.
            {
                SetPlayerHealth(f, 100);
            }
        }
    }
}
but timers would be a bad idea because if you use more timers it will waste your more memory/CPU try something like OnPlayerTakeDamage?

I hope this helps
-FalconX
Reply
#4

Why not use OnPlayerTakeDamage? it then doesnt waste resources on a stupid timer!

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
Reply
#5

Better to just god mode em.
Reply
#6

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Better to just god mode em.
true that xD

pawn Код:
SetPlayerHealth(playerid, 999999); // o_o
Regards FalconX
Reply
#7

Quote:
Originally Posted by FalconX
Посмотреть сообщение
true that xD

pawn Код:
SetPlayerHealth(playerid, 999999); // o_o
Regards FalconX
with 999999 health it won't make the person god because imagine you had 999999 health and i have a minigun, i could shoot you and you could die around 10 seconds. But it will work if you make a timer which sets your health 999999 every second
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)