[FilterScript] 3D Info
#1

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;
}
Reply
#2

Nice!
Reply
#3

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!
Reply
#4

The only usefull things are Money and FPS
Reply
#5

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
Reply
#6

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.
Reply
#7

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

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

Very Nice.
Reply
#10

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!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)