A question.
#1

pawn Код:
stock SetPlayerHealthFull()
{
 for(new i=0; i<MAX_PLAYERS;
 SetPlayerHealth(playerid, 100);
 return 1;
}
I saw that in a script and I was wondering what it is. Can anyone help?
Reply
#2

This is a loop, but this isn't a properly working one.

pawn Код:
stock SetPlayerHealthFull()
{
 for(new i=0; i<MAX_PLAYERS; i++(
 SetPlayerHealth(i, 100);
 return 1;
}
This loops through all the players and refills their health.
Reply
#3

How can it be used as a command to set all players health?
Reply
#4

Just do this.

pawn Код:
cmd(healall, playerid,params[])
{
for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
    SetPlayerHealth(i, 100);
    }
SendClientMessageToAll(-1, "Everyone has been healed");
}
Reply
#5

Quote:
Originally Posted by nogh445
Посмотреть сообщение
How can it be used as a command to set all players health?
you need to call it where you want it.
like
pawn Код:
CMD:healall(playerid, params[])
{
    SetPlayerHealthFull();
    return 1;
}
Reply
#6

Quote:
Originally Posted by emokidx111
Посмотреть сообщение
you need to call it where you want it.
like
pawn Код:
CMD:healall(playerid, params[])
{
    SetPlayerHealthFull();
    return 1;
}
I deleted the stock, as why do you need a stock for such a small piece of code?
Reply
#7

Because that's what his question was.
Reply
#8

I know, but still..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)