Green Health Bar | English

Započeo ich., Decembar 20, 2017, 07:21:56 PRE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Tip: FilterScript




[pawn]#include <a_samp>

new Text:HealthBar[MAX_PLAYERS];

public OnFilterScriptInit()
{
        for(new i; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                OnPlayerConnect(i);
            }
        }
        return 1;
}

public OnFilterScriptExit()
{
        for(new i; i<MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                TextDrawDestroy(HealthBar);
            }
        }
        return 1;
}

public OnPlayerConnect(playerid)
{
        HealthBar[playerid] = TextDrawCreate(549.000000,52.000000,"..........");
        TextDrawAlignment(HealthBar[playerid],1);
        TextDrawBackgroundColor(HealthBar[playerid],0x00ff00ff);
        TextDrawFont(HealthBar[playerid],3);
        TextDrawLetterSize(HealthBar[playerid],0.569999,2.549999);
        TextDrawColor(HealthBar[playerid],0x00ff0033);
        TextDrawSetOutline(HealthBar[playerid],1);
        TextDrawSetProportional(HealthBar[playerid],1);
        TextDrawSetShadow(HealthBar[playerid],1);
        return 1;
}

public OnPlayerDisconnect(playerid)
{
        TextDrawDestroy(HealthBar[playerid]);
        return 1;
}

public OnPlayerDeath(playerid)
{
        TextDrawHideForPlayer(playerid,HealthBar[playerid]);
        return 1;
}

public OnPlayerSpawn(playerid)
{
        TextDrawSetString(HealthBar[playerid],"..........");
        TextDrawShowForPlayer(playerid,HealthBar[playerid]);
        return 1;
}

public OnPlayerUpdate(playerid)
{
        new Float:Health;
        GetPlayerHealth(playerid,Health);
        if(Health >= 90)
        {
            TextDrawSetString(HealthBar[playerid],"..........");
            return 1;
        }
        if(Health >= 80)
        {
            TextDrawSetString(HealthBar[playerid],".........");
            return 1;
        }
        if(Health >= 70)
        {
            TextDrawSetString(HealthBar[playerid],"........");
            return 1;
        }
        if(Health >= 60)
        {
            TextDrawSetString(HealthBar[playerid],".......");
            return 1;
        }
        if(Health >= 50)
        {
            TextDrawSetString(HealthBar[playerid],"......");
            return 1;
        }
        if(Health >= 40)
        {
            TextDrawSetString(HealthBar[playerid],".....");
            return 1;
        }
        if(Health >= 30)
        {
            TextDrawSetString(HealthBar[playerid],"....");
            return 1;
        }
        if(Health >= 20)
        {
            TextDrawSetString(HealthBar[playerid],"...");
            return 1;
        }
        if(Health >= 10)
        {
            TextDrawSetString(HealthBar[playerid],"..");
            return 1;
        }
        if(Health > 0)
        {
            TextDrawSetString(HealthBar[playerid],".");
            return 1;
        }
        return 1;
}[/pawn]