SA-MP Forums Archive
SetPlayerHealth - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetPlayerHealth (/showthread.php?tid=261399)



SetPlayerHealth - Cenation - 13.06.2011

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


Re: SetPlayerHealth - SpiderWalk - 13.06.2011

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;
}



Re: SetPlayerHealth - Iphone1234g - 13.06.2011

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.");
}




Re: SetPlayerHealth - Cenation - 13.06.2011

thankz Solved


Re: SetPlayerHealth - Cenation - 13.06.2011

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+);



Re: SetPlayerHealth - Skaizo - 13.06.2011

SetPlayerHealth(i,10+)


Re: SetPlayerHealth - Cenation - 14.06.2011

ok thankz...


Re: SetPlayerHealth - Basicz - 14.06.2011

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.


Re: SetPlayerHealth - Cenation - 14.06.2011

oh thank you so much...


Re: SetPlayerHealth - Gertin - 14.06.2011

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