SetPlayerHealth
#1

I have to create all players get +10 health in every 3 secs can anyone give me script? please..
Reply
#2

pawn Code:
forward Health();//top of script

SetTimer("Health",3000,true);//In GamemodeInt

public Health()//Give this where you want but i am giving under OnPlayerClickPlayer
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
      if(IsPlayerConnected(i))
      {
      SetPlayerHealth(i,10+);
      }
    }
    return 1;
}
Reply
#3

Use SetTimer OR SetTimerEX to give player +10 on every 3 sec
Quote:

forward message();

public OnGameModeInit()
{
print("Starting timer...");
SetTimer("message", 1000, false); // Set a timer of 1000 miliseconds (1 second)
}

public message()
{
print("1 second has passed.");
}

Reply
#4

thankz Solved
Reply
#5

Not Solved
Code:
C:\......\samp03csvr_R2-2_win32\gamemodes\HellzoneStuntages.pwn(3360) : error 029: invalid expression, assumed zero
C:\......\samp03csvr_R2-2_win32\gamemodes\HellzoneStuntages.pwn(3360) : error 001: expected token: ",", but found ";"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Code:
Line No. 3360 :       SetPlayerHealth(i,10+);
Reply
#6

SetPlayerHealth(i,10+)
Reply
#7

ok thankz...
Reply
#8

pawn Code:
// I'll make it as a filterscript.

public OnFilterScriptInit( )
{
    SetTimer( "regenHealth", 3000, true );
    return 1;
}

forward regenHealth( ); public regenHealth( )
{
    for ( new slots = GetMaxPlayers( ), i; i < slots; i ++ )
    {
        if ( !IsPlayerConnected( i ) ) continue;

        new Float: iHealth;
       
        GetPlayerHealth( i, iHealth );

        SetPlayerHealth( i, iHealth + 10.0 );
    }

    return 1;
}
SpiderWalk or RSS_Cops_sandu will not work because :
pawn Code:
SetPlayerHealth(i,10+);
I think.
Reply
#9

oh thank you so much...
Reply
#10

Jaa ,
Code:
SetPlayerHealth(i,+10);
, not
Code:
SetPlayerHealth(i,10+);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)