12.07.2011, 22:58
I want to be able to make my skin soldier, so that when he's beside his wounded teammate he's able to heal automatically. And that he's unable to heal other teammates.
#include < a_samp >
#include < foreach >
new
pUpdateTimer[ MAX_PLAYERS ]
;
public OnPlayerConnect( playerid ) {
pUpdateTimer[ playerid ] = SetTimerEx( "healMembers", 1000, true, "i", playerid );
return 1;
}
forward healMembers( playerid );
public healMembers( playerid )
{
if ( GetPlayerSkin( playerid ) == 287 )
{
new
Float: X, Float: Y, Float: Z, target = INVALID_PLAYER_ID;
GetPlayerPos( playerid, X, Y, Z );
foreach (Player, i)
{
if ( IsPlayerInRangeOfPoint( i, 2.0, X, Y, Z ) && i != playerid )
{
target = i;
}
}
if ( GetPlayerSkin( target ) == 287 )
{
new Float: pHealth;
GetPlayerHealth( target, pHealth );
if ( pHealth != 100.0 ) {
SetPlayerHealth( target, pHealth + 4.0 );
GameTextForPlayer( target, "~w~Being healed", 500, 3 );
}
}
}
return 1;
}