Raised This Month: $12 Target: $400
 3% 

Solved [ZP] Fps in hud info


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Percib4l
Junior Member
Join Date: May 2021
Old 09-21-2021 , 09:58   [ZP] Fps in hud info
Reply With Quote #1

I need a little help to fix the hud I tried adding fps: % s to show the player's fps, but it stays at 0 I don't know what I'm failing...

Code i use [FPS]
PHP Code:
new g_iUserFPS[32+1];
...

public 
fw_CmdStart(iduc_handle)
{
    
// Get player's FPS accurately
    
g_iUserFPS[id] = floatround(/ (get_uc(uc_handleUC_Msec) * 0.001));
}

...

}
    
    
// Spectating someone else?
    
if (player != ID_SHOWHUD)
    {
        new 
player_name[32]
        
get_user_name(playerplayer_namecharsmax(player_name))
        
        
// Show name, health, class, and money
        
set_hudmessage(HUD_STATS_SPEC_RHUD_STATS_SPEC_GHUD_STATS_SPEC_BHUD_SPECT_XHUD_SPECT_Y06.01.10.00.0, -1)
        
        if (
LibraryExists(LIBRARY_AMMOPACKSLibType_Library))
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"| %L: %s |^n| HP: %d | %L %s | %L %d | %s |^n| SERVER 24/7 | FPS %d |"ID_SHOWHUD"SPECTATING"player_nameget_user_health(player), ID_SHOWHUD"CLASS_CLASS"class_nameID_SHOWHUD"AMMO_PACKS1"zp_ammopacks_get(player), rankNames[currentPlayerRank], g_iUserFPS[player])
        else
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"| %L: %s |^n| HP: %d | %L %s | %L %d | %s |^n| SERVERS 24/7 | FPS %d |"ID_SHOWHUD"SPECTATING"player_nameget_user_health(player), ID_SHOWHUD"CLASS_CLASS"class_nameID_SHOWHUD"MONEY1"cs_get_user_money(player), rankNames[currentPlayerRank], g_iUserFPS[player])
    }
    else
    {
        
// Show health, class
        
set_hudmessage(redgreenblueHUD_STATS_XHUD_STATS_Y06.01.10.00.0, -1)
        
        if (
LibraryExists(LIBRARY_AMMOPACKSLibType_Library))
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"| HP: %d | %L %s | %L %d | %s |^n| SERVERS 24/7 | FPS %d |"get_user_health(ID_SHOWHUD), ID_SHOWHUD"CLASS_CLASS"class_nameID_SHOWHUD"AMMO_PACKS1"zp_ammopacks_get(ID_SHOWHUD), rankNames[currentPlayerRank], g_iUserFPS[player])
        else
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"| HP: %d | %L %s | %s |^n| SERVERS 24/7 | FPS %d |"get_user_health(ID_SHOWHUD), ID_SHOWHUD"CLASS_CLASS"class_namerankNames[currentPlayerRank], g_iUserFPS[player])
    }

SMA FULL

PHP Code:
/*================================================================================
    
    ----------------------------
    -*- [ZP] HUD Information -*-
    ----------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include <amxmodx>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <zp50_class_human>
#include <zp50_class_zombie>
#define LIBRARY_NEMESIS "zp50_class_nemesis"
#include <zp50_class_nemesis>
#define LIBRARY_SURVIVOR "zp50_class_survivor"
#include <zp50_class_survivor>
#define LIBRARY_AMMOPACKS "zp50_ammopacks"
#include <zp50_ammopacks>

new PlayerRank[33

new const 
rankNames[20][] =
{
    
"Rookie",
    
"Noob",  
    
"Killer",
    
"Pro",
    
"Swat",  
    
"Hitman",
    
"Spy"
    
"Savage",  
    
"Devil",
    
"Guardian"
    
"Headtaker",  
    
"Dragon",
    
"Skyfall"
    
"Rocketman",  
    
"Monster",
    
"Dominator",
    
"Demon Slayer",  
    
"Legendary",
    
"Savage",
    
"GodLike"
}
new const 
packNames[20] =
{
    
0,
    
100,  
    
500,
    
1000,
    
2000,  
    
5000,
    
6000
    
7000,  
    
8000,
    
9000
    
10000,
    
11000,
    
15000,
    
20000,
    
50000,
    
60000,
    
70000,
    
80000,
    
100000,
    
9999999
}

const 
Float:HUD_SPECT_X = -1.0
const Float:HUD_SPECT_Y 0.85
const Float:HUD_STATS_X = -1.0
const Float:HUD_STATS_Y 0.85

const HUD_STATS_ZOMBIE_R 200
const HUD_STATS_ZOMBIE_G 250
const HUD_STATS_ZOMBIE_B 0

const HUD_STATS_HUMAN_R 0
const HUD_STATS_HUMAN_G 200
const HUD_STATS_HUMAN_B 250

const HUD_STATS_SPEC_R 255
const HUD_STATS_SPEC_G 255
const HUD_STATS_SPEC_B 255

#define TASK_SHOWHUD 100
#define ID_SHOWHUD (taskid - TASK_SHOWHUD)
new g_iUserFPS[32+1];
const 
PEV_SPEC_TARGET pev_iuser2

new g_MsgSync

public plugin_init()
{
    
register_plugin("[ZP] HUD Information"ZP_VERSION_STRING"ZP Dev Team")
    
    
g_MsgSync CreateHudSyncObj()
}

public 
plugin_natives()
{
    
set_module_filter("module_filter")
    
set_native_filter("native_filter")
}
public 
module_filter(const module[])
{
    if (
equal(moduleLIBRARY_NEMESIS) || equal(moduleLIBRARY_SURVIVOR) || equal(moduleLIBRARY_AMMOPACKS))
        return 
PLUGIN_HANDLED;
    
    return 
PLUGIN_CONTINUE;
}
public 
native_filter(const name[], indextrap)
{
    if (!
trap)
        return 
PLUGIN_HANDLED;
    
    return 
PLUGIN_CONTINUE;
}

public 
client_putinserver(id)
{
    if (!
is_user_bot(id))
    {
        
// Set the custom HUD display task
        
set_task(1.0"ShowHUD"id+TASK_SHOWHUD__"b")
    }
}

public 
client_disconnect(id)
{
    
remove_task(id+TASK_SHOWHUD)
}
public 
fw_CmdStart(iduc_handle)
{
    
// Get player's FPS accurately
    
g_iUserFPS[id] = floatround(/ (get_uc(uc_handleUC_Msec) * 0.001));
}
// Show HUD Task
public ShowHUD(taskid)
{
    new 
player ID_SHOWHUD


    
new currentPlayerRank 0;  
    while(
currentPlayerRank < (20 1)) 
    {        
        if(
zp_ammopacks_get(player) >= packNames[currentPlayerRank 1])         
        ++
currentPlayerRank;     
        else      
        break ;
    }  
    
PlayerRank[player] = currentPlayerRank;      

    
// Player dead?
    
if (!is_user_alive(player))
    {
        
// Get spectating target
        
player pev(playerPEV_SPEC_TARGET)
        
        
// Target not alive
        
if (!is_user_alive(player))
            return;
    }
    
    
// Format classname
    
static class_name[32], transkey[64]
    new 
redgreenblue
    
    
if (zp_core_is_zombie(player)) // zombies
    
{
        
red HUD_STATS_ZOMBIE_R
        green 
HUD_STATS_ZOMBIE_G
        blue 
HUD_STATS_ZOMBIE_B
        
        
// Nemesis Class loaded?
        
if (LibraryExists(LIBRARY_NEMESISLibType_Library) && zp_class_nemesis_get(player))
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_NEMESIS")
        else
        {
            
zp_class_zombie_get_name(zp_class_zombie_get_current(player), class_namecharsmax(class_name))
            
            
// ML support for class name
            
formatex(transkeycharsmax(transkey), "ZOMBIENAME %s"class_name)
            if (
GetLangTransKey(transkey) != TransKey_Badformatex(class_namecharsmax(class_name), "%L"ID_SHOWHUDtranskey)
        }
    }
    else 
// humans
    
{
        
red HUD_STATS_HUMAN_R
        green 
HUD_STATS_HUMAN_G
        blue 
HUD_STATS_HUMAN_B
        
        
// Survivor Class loaded?
        
if (LibraryExists(LIBRARY_NEMESISLibType_Library) && zp_class_survivor_get(player))
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_SURVIVOR")
        else
        {
            
zp_class_human_get_name(zp_class_human_get_current(player), class_namecharsmax(class_name))
            
            
// ML support for class name
            
formatex(transkeycharsmax(transkey), "HUMANNAME %s"class_name)
            if (
GetLangTransKey(transkey) != TransKey_Badformatex(class_namecharsmax(class_name), "%L"ID_SHOWHUDtranskey)
        }
    }
    
    
// Spectating someone else?
    
if (player != ID_SHOWHUD)
    {
        new 
player_name[32]
        
get_user_name(playerplayer_namecharsmax(player_name))
        
        
// Show name, health, class, and money
        
set_hudmessage(HUD_STATS_SPEC_RHUD_STATS_SPEC_GHUD_STATS_SPEC_BHUD_SPECT_XHUD_SPECT_Y06.01.10.00.0, -1)
        
        if (
LibraryExists(LIBRARY_AMMOPACKSLibType_Library))
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"| %L: %s |^n| HP: %d | %L %s | %L %d | %s |^n| [UG] UNITEDGAMERZ.HK.SITE | FPS %d |"ID_SHOWHUD"SPECTATING"player_nameget_user_health(player), ID_SHOWHUD"CLASS_CLASS"class_nameID_SHOWHUD"AMMO_PACKS1"zp_ammopacks_get(player), rankNames[currentPlayerRank], g_iUserFPS[player])
        else
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"| %L: %s |^n| HP: %d | %L %s | %L %d | %s |^n| [UG] UNITEDGAMERZ.HK.SITE | FPS %d |"ID_SHOWHUD"SPECTATING"player_nameget_user_health(player), ID_SHOWHUD"CLASS_CLASS"class_nameID_SHOWHUD"MONEY1"cs_get_user_money(player), rankNames[currentPlayerRank], g_iUserFPS[player])
    }
    else
    {
        
// Show health, class
        
set_hudmessage(redgreenblueHUD_STATS_XHUD_STATS_Y06.01.10.00.0, -1)
        
        if (
LibraryExists(LIBRARY_AMMOPACKSLibType_Library))
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"| HP: %d | %L %s | %L %d | %s |^n| [UG] UNITEDGAMERZ.HK.SITE | FPS %d |"get_user_health(ID_SHOWHUD), ID_SHOWHUD"CLASS_CLASS"class_nameID_SHOWHUD"AMMO_PACKS1"zp_ammopacks_get(ID_SHOWHUD), rankNames[currentPlayerRank], g_iUserFPS[player])
        else
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"| HP: %d | %L %s | %s |^n| [UG] UNITEDGAMERZ.HK.SITE | FPS %d |"get_user_health(ID_SHOWHUD), ID_SHOWHUD"CLASS_CLASS"class_namerankNames[currentPlayerRank], g_iUserFPS[player])
    }


Last edited by Percib4l; 10-05-2021 at 13:50.
Percib4l is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode