SA-MP Forums Archive
[FilterScript] 3D Info - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] 3D Info (/showthread.php?tid=289602)



3D Info - OKStyle - 12.10.2011

Since 0.3b R2 I'm scripted this thing. Rcon-admin can see important info about players with 3d-labels. Other data simple adding...



Download:
http://pastebin.com/ie8srvyA

v1.1
* 1 3D-text;
* 1 format's variable.

pawn Код:
#include <a_samp>
// 3D Info 1.1 by O.K.Style™
new PlayerText3D:Info[MAX_PLAYERS];
public OnPlayerStreamIn(playerid, forplayerid)
{
    if(!IsPlayerAdmin(forplayerid)) return 1;
    if(IsPlayerAdmin(playerid)) return 1;
    if(IsPlayerNPC(playerid)) return 1;
    Info[playerid] = CreatePlayer3DTextLabel(forplayerid, "Health: 0.0\nArmour: 0.0\nPing: 0\nFPS: 0\nMoney: 0", -1, 0.0, 0.0, 0.35, 30.0, playerid, INVALID_VEHICLE_ID, 0);
    return 1;
}
public OnPlayerUpdate(playerid)
{
    new Float:HP,Float:AP;
    GetPlayerHealth(playerid, HP);
    GetPlayerArmour(playerid, AP);
    new string_3D[256];
    format(string_3D, sizeof(string_3D), "{FFFFFF}Health: {FDE39D}%.0f\n{FFFFFF}Armour: {FDE39D}%.0f\n{FFFFFF}Ping: {FDE39D}%d\n{FFFFFF}FPS: {FDE39D}%d\n{FFFFFF}Money: {FDE39D}%d", HP, AP, GetPlayerPing(playerid), GetPlayerFPS(playerid), GetPlayerMoney(playerid));
    for(new i, j = GetMaxPlayers(); i != j; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(IsPlayerNPC(i)) continue;
        if(!IsPlayerAdmin(i)) continue;
        if(IsPlayerAdmin(playerid)) continue;
        UpdatePlayer3DTextLabelText(i, Info[playerid], -1, string_3D);
    }
    return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
    if(IsPlayerNPC(playerid)) return 1;
    if(!IsPlayerAdmin(forplayerid)) return 1;
    if(IsPlayerAdmin(playerid)) return 1;
    for(new i; i < 6; i++) DeletePlayer3DTextLabel(forplayerid, Info[playerid]);
    return 1;
}
stock GetPlayerFPS(playerid)
{
    SetPVarInt(playerid, "DrunkL", GetPlayerDrunkLevel(playerid));
    if(GetPVarInt(playerid, "DrunkL") < 100) SetPlayerDrunkLevel(playerid, 2000);
    else
    {
        if(GetPVarInt(playerid, "LDrunkL") != GetPVarInt(playerid, "DrunkL"))
        {
            SetPVarInt(playerid, "FPS", (GetPVarInt(playerid, "LDrunkL") - GetPVarInt(playerid, "DrunkL")));
            SetPVarInt(playerid, "LDrunkL", GetPVarInt(playerid, "DrunkL"));
            if((GetPVarInt(playerid, "FPS") > 0) && (GetPVarInt(playerid, "FPS") < 256)) return GetPVarInt(playerid, "FPS") - 1;
        }
    }
    return 0;
}



Re: 3D Info - HyperZ - 12.10.2011

Nice!


Re: 3D Info - [MWR]Blood - 12.10.2011

I can't understand why are you setting the player's drunk level to 2000 in the stock of GetPlayerFPS.
And lol, an infinite loop on OnPlayerUpdate!


Re: 3D Info - Dripac - 12.10.2011

The only usefull things are Money and FPS


Re: 3D Info - OKStyle - 12.10.2011

Quote:
Originally Posted by [MWR]Blood
Посмотреть сообщение
I can't understand why are you setting the player's drunk level to 2000 in the stock of GetPlayerFPS.
This is the way of getting FPS by JerneiL.

About loop: I find it easier to insert checks into the OnPlayerUpdate than creating unnecessary extra for this timer


Re: 3D Info - Hiddos - 12.10.2011

Quote:
Originally Posted by OKStyle
Посмотреть сообщение
This is the way of getting FPS by JerneiL.

About loop: I find it easier to insert checks into the OnPlayerUpdate than creating unnecessary extra for this timer
And it is the correct thing to do, because the player info is only updated when OnPlayerUpdate gets called.


Re: 3D Info - wups - 12.10.2011

A player loop on every OnPlayerUpdate?! You must be kidding me...


Re: 3D Info - [L3th4l] - 12.10.2011

Why are you creating 5 3D labels? You can make lines using "\n" when you format the string!


Re : 3D Info - TheBest6 - 12.10.2011

Very Nice.


Re: 3D Info - OKStyle - 12.10.2011

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
Why are you creating 5 3D labels? You can make lines using "\n" when you format the string!
In 0.3b (see 1st message) i can't use {color}, and labels was colorful with hex-colors. It would be edited in next versions.

EDIT: Updated!