SA-MP Forums Archive
[Ajuda] Ajuda Com Status ... ' - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Ajuda Com Status ... ' (/showthread.php?tid=472516)



Ajuda Com Status ... ' - N3XTMapper - 28.10.2013

Pessoal, eu estou querendo criar um textdraw aqui onde mostra o status,o problema й que eu sei criar textdraws mais nao sei criar as variaveis para pegar o score fps spree e ping, se alguem pudesse me ajudar ou me add no skype para que a gente converse eu agradeceria ...




SKYPE: moises_soares_oliveira


Re: Ajuda Com Status ... ' - PT - 29.10.2013

PING: https://sampwiki.blast.hk/wiki/GetPlayerPing

FPS: https://sampforum.blast.hk/showthread.php?tid=172085


Re: Ajuda Com Status ... ' - CharlieBrown - 29.10.2013

Ping.
pawn Код:
forward AtualizarPing();

new Text:PingT[MAX_PLAYERS];


public OnGameModeInit()
{
    for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        PingT[ i ] = TextDrawCreate( 400, 25, "   " );
        TextDrawFont( PingT[ i ], 3);
        TextDrawUseBox( PingT[ i ], 0);
        TextDrawSetOutline( PingT[ i ], 1);
        TextDrawBackgroundColor( PingT[ i ], 0x32CD32FF);
        TextDrawColor( PingT[ i ], 0x000000FF);
        TextDrawAlignment( PingT[ i ], 1);
    }
    SetTimer( "AtualizarPing", 1000, 1 );
    return 1;
}

public OnPlayerSpawn(playerid)
{
for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        if( IsPlayerConnected( i ) )
        {
    TextDrawShowForPlayer( i, PingT[ i ] );
}
}
    return 1;
}

public AtualizarPing()
{
    new string[ 16 ];
    for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        if( IsPlayerConnected( i ) )
        {
            format( string, sizeof( string ), "Ping: %d", GetPlayerPing(i) );
            TextDrawSetString( PingT[ i ], gstring);
        }
    }
    return 1;
}
Scores
pawn Код:
//No Topo do GM:

new Text:ScoreTextDraw[MAX_PLAYERS];



//No OnGameModeInit:

SetTimer("AtualizarScore", 1000, true);
    for(new x = 0; x < MAX_PLAYERS; x++)
    {
        ScoreTextDraw[x] = TextDrawCreate(32.000000, 317.000000, "Score: 1000000");
        TextDrawBackgroundColor(ScoreTextDraw[x], 255);
        TextDrawFont(ScoreTextDraw[x], 1);
        TextDrawLetterSize(ScoreTextDraw[x], 0.440000, 1.500000);
        TextDrawColor(ScoreTextDraw[x], -1);
        TextDrawSetOutline(ScoreTextDraw[x], 0);
        TextDrawSetProportional(ScoreTextDraw[x], 1);
        TextDrawSetShadow(ScoreTextDraw[x], 1);
    }



//E, no Final do GM:

forward AtualizarScore();
public AtualizarScore()
{
    for(new x = 0, y = GetMaxPlayers(); x != y; x++)
    {
        if(!IsPlayerConnected(x)) continue;
        new STR[26];
        format(STR, 26, "~r~Score: ~w~%d", GetPlayerScore(x));
        TextDrawShowForPlayer(x, ScoreTextDraw[x]);
        TextDrawSetString(ScoreTextDraw[x], STR);
    }
    return true;
}
FPS
pawn Код:
#include <a_samp>

new Text: textFPS[MAX_PLAYERS];
new Text:FPS[MAX_PLAYERS];
new DLlast[MAX_PLAYERS];
new FPS2[MAX_PLAYERS];

public OnPlayerDisconnect(playerid, reason)
{
    TextDrawDestroy(FPS[playerid]);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid,FPS[playerid]);
    return 1;
}

public OnFilterScriptInit()
{
    SetTimer("fpsCheck", 100, true);
   
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        textFPS[i] = TextDrawCreate(199.000000, 375.000000, " ");
        TextDrawAlignment(textFPS[i], 3);
        TextDrawBackgroundColor(textFPS[i], 0xFF8000FF);
        TextDrawFont(textFPS[i], 3);
        TextDrawLetterSize(textFPS[i], 0.389999, 0.899999);
        TextDrawColor(textFPS[i], 0x000000f6);
        TextDrawSetOutline(textFPS[i], 1);
        TextDrawSetProportional(textFPS[i], 1);
    }
    return 1;
}

public OnPlayerUpdate(playerid)
{
        new drunk2 = GetPlayerDrunkLevel(playerid);
        if(drunk2 < 100)
        {
            SetPlayerDrunkLevel(playerid,2000);
        }
        else
        {
            if(DLlast[playerid] != drunk2)
            {
                new fps = DLlast[playerid] - drunk2;

                if((fps > 0) && (fps < 200))
                FPS2[playerid] = fps;
                DLlast[playerid] = drunk2;
            }
        }
        return 1;
}

forward fpsCheck();
public fpsCheck()
{
    for(new i; i != GetMaxPlayers(); ++i)
    {
        if(IsPlayerConnected(i) && !IsPlayerNPC(i))
        {
            if(GetPVarInt(i, "spawned"))
            {
                SetPVarInt(i, "drunkLevel", GetPlayerDrunkLevel(i));

                if(GetPVarInt(i, "drunkLevel") < 100)
                {
                    SetPlayerDrunkLevel(i, 2000);
                }
                else
                {
                    if(GetPVarInt(i, "lastDrunkLevel") != GetPVarInt(i, "drunkLevel"))
                    {
                        SetPVarInt(i, "fps", (GetPVarInt(i, "lastDrunkLevel") - GetPVarInt(i, "drunkLevel")));
                        SetPVarInt(i, "lastDrunkLevel", GetPVarInt(i, "drunkLevel"));

                        if((GetPVarInt(i, "fps") > 0) && (GetPVarInt(i, "fps") < 256))
                        {
                            new string[24];
                            format(string, sizeof(string),"FPS: %d", GetPVarInt(i, "fps") - 1);
                            TextDrawSetString(textFPS[i], string);
                            TextDrawShowForPlayer(i, textFPS[i]);
                        }
                    }
                }
            }
            else
            {
                TextDrawHideForPlayer(i, textFPS[i]);
            }
        }
    }
    return 1;
}
Oq custa ir Search ?


Re: Ajuda Com Status ... ' - Coe1 - 29.10.2013

Score:

https://sampwiki.blast.hk/wiki/GetPlayerScore