[Help]
#1

how I can make that player will appear in red if it lacks health, and detect if the player moves or not
Reply
#2

For the lack health try this :

PHP код:
public OnGameModeInit()
{
    
SetTimer("CheckHealth",2000,1);
    return 
1;
}
forward CheckHealth();
public 
CheckHealth()
{
        new 
Float:h;
        
GetPlayerHealth(playerid,h);
        if(
<= 10)
               {
                
SetPlayerColor(playerid,COLOR_RED);
                return 
1;
               }
   return 
1;

For detecting if player's moving or not,

I'm not pretty sure of this code,

But try it :

PHP код:
public OnGameModeInit()
{
    
SetTimer("MovingPlayer",5000,1);
    return 
1;
}
forward MovingPlayer(playerid);
public 
MovingPlayer(playerid)
{
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playerid,x+1,y,z);
    
GameTextForPlayer(playerid,"~r~You are moving",3000,5);

Reply
#3

Код:
new Float:old_x, Float:old_y, Float:old_z;

public OnPlayerUpdate(playerid)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);

    if(old_x != x && old_y != y && old_z != z)
    {
        OnPlayerMove(playerid);
        GetPlayerPos(old_x, old_y, old_z);
    }
}

forward OnPlayerMove(playerid);
public OnPlayerMove(playerid)
{
    // Do domething when the player moves
}
Reply
#4

how I can do so only it appears to doctors? use GodFather
Reply
#5

help
Reply
#6

help
Reply
#7

See the other reply down...
Reply
#8

new PlayerMove[MAX_PLAYERS];
public OnPlayerUpdate(playerid)
{
new Float:hp;
GetPlayerHealth(playerid,hp);
if(hp <= 20 && PlayerMove[playerid] == 0){
SetPlayerColor(playerid,0xFF0000AA);
PlayerMove[playerid] = 1;
}else if(hp <= 20 && PlayerMove[playerid] == 1){
SendClientMessage(playerid,-1,"You still moving!");
PlayerMove[playerid] = 2;
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)