SA-MP Forums Archive
[Help] - 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)
+--- Thread: [Help] (/showthread.php?tid=579033)



[Help] - MARIOBROSS - 23.06.2015

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


Re : [Help] - KillerDVX - 24.06.2015

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




Re: [Help] - Shetch - 24.06.2015

Код:
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
}



Respuesta: [Help] - MARIOBROSS - 25.06.2015

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


Respuesta: [Help] - MARIOBROSS - 25.06.2015

help


Respuesta: [Help] - MARIOBROSS - 28.06.2015

help


Re: [Help] - kyriakos587 - 29.06.2015

See the other reply down...


Re: [Help] - kyriakos587 - 29.06.2015

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