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

help HUD Information


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
B7PK
Member
Join Date: Apr 2016
Location: palestine
Old 06-01-2016 , 10:09   help HUD Information
Reply With Quote #1

Hello guys..i have plugin ammo packs ranks if u have (0-250 AP level 1, 250-500 AP level2...) like in photo 1

i want to change level 1234...to trophies (level 1 = rooki, level 2 = Killer, level 3 = slayer...) like in photo 2


photo 1


photo 2


Full code:
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_ASSASSIN "zp50_class_assassin"
#include <zp50_class_assassin>
#define LIBRARY_SURVIVOR "zp50_class_survivor"
#include <zp50_class_survivor>
#define LIBRARY_SNIPER "zp50_class_sniper"
#include <zp50_class_sniper>
#define LIBRARY_AMMOPACKS "zp50_ammopacks"
#include <zp50_ammopacks>

const Float:HUD_SPECT_X 0.6
const Float:HUD_SPECT_Y 0.8
const Float:HUD_STATS_X 0.02
const Float:HUD_STATS_Y 0.9

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)

const PEV_SPEC_TARGET pev_iuser2

new g_MsgSync
new Level:PlayerLevels[33]  

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_ASSASSIN) || equal(moduleLIBRARY_SURVIVOR) || equal(moduleLIBRARY_SNIPER) || 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)
}

// Show HUD Task
public ShowHUD(taskid)
{
    new 
player ID_SHOWHUD
    
    
// 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
    
    checkear_ammopacks
(player)
    
    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")
            
        
// Assassin Class loaded?
        
else if (LibraryExists(LIBRARY_ASSASSINLibType_Library) && zp_class_assassin_get(player))
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_ASSASSIN")
        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_SURVIVORLibType_Library) && zp_class_survivor_get(player))
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_SURVIVOR")

        
// Sniper Class loaded?
        
else if (LibraryExists(LIBRARY_SNIPERLibType_Library) && zp_class_sniper_get(player))
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_SNIPER")
        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^nHP: %d - %L %s - %L %d - Level: %d"ID_SHOWHUD"SPECTATING"player_nameget_user_health(player), ID_SHOWHUD"CLASS_CLASS"class_name
            
ID_SHOWHUD"AMMO_PACKS1"zp_ammopacks_get(player), PlayerLevels[player])
        else
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"%L: %s^nHP: %d - %L %s - %L $ %d - LEvel: %d"ID_SHOWHUD"SPECTATING"player_nameget_user_health(player), ID_SHOWHUD"CLASS_CLASS"class_name
            
ID_SHOWHUD"MONEY1"cs_get_user_money(player), PlayerLevels[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 - Level: %d"get_user_health(ID_SHOWHUD), ID_SHOWHUD"CLASS_CLASS"class_name
            
ID_SHOWHUD"AMMO_PACKS1"zp_ammopacks_get(ID_SHOWHUD), PlayerLevels[player])
        else
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"HP: %d - %L %s - %d"get_user_health(ID_SHOWHUD), ID_SHOWHUD"CLASS_CLASS"class_name
            
PlayerLevels[ID_SHOWHUD])
    }
}
enum Level
{
    
Level1,
    
Level2,
    
Level3,
    
Level4,
    
Level5,
    
Level6,
    
Level7,
    
Level8,
    
Level9,
    
Level10,
}

public 
checkear_ammopacks(id)
{
    new 
ammopacks zp_ammopacks_get(id)
 
    if(
ammopacks && ammopacks 49)  
    {
        
PlayerLevels[id] = Level1;
    }
    else if (
ammopacks 500)
    {
        
PlayerLevels[id] = Level2;
    }
    else if(
ammopacks 1000)
    {
        
PlayerLevels[id] = Level3;
    }
    else if(
ammopacks 2000)
    {
        
PlayerLevels[id] = Level4;
    }
    else if(
ammopacks 5000)
    {
        
PlayerLevels[id] = Level5;
    }
    else if(
ammopacks 10000)
    {
        
PlayerLevels[id] = Level6;
    }
    else if(
ammopacks 30000)
    {
        
PlayerLevels[id] = Level7;
    }
    else if(
ammopacks 50000)
    {
        
PlayerLevels[id] = Level8;
    }
    else if(
ammopacks 100000)
    {
        
PlayerLevels[id] = Level9;
    }
    else if(
ammopacks 200000)
    {
        
PlayerLevels[id] = Level10;
    }
    else
    {
        
PlayerLevels[id] = Level10;
    }  
    
set_task(1.0"checkear_ammopacks"id)

__________________
B7PK is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-01-2016 , 10:40   Re: help HUD Information
Reply With Quote #2

change level names in LevelName constant.

PHP Code:
#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_ASSASSIN "zp50_class_assassin" 
#include <zp50_class_assassin> 
#define LIBRARY_SURVIVOR "zp50_class_survivor" 
#include <zp50_class_survivor> 
#define LIBRARY_SNIPER "zp50_class_sniper" 
#include <zp50_class_sniper> 
#define LIBRARY_AMMOPACKS "zp50_ammopacks" 
#include <zp50_ammopacks> 

enum Level 

    
Level1
    
Level2
    
Level3
    
Level4
    
Level5
    
Level6
    
Level7
    
Level8
    
Level9
    
Level10 


new const 
LevelName[10][] = { 
    
"noob",
    
"amateur",
    
"good player",
    
"very good player",
    
"semi professional",
    
"professional",
    
"godlike",
    
"unstoppable",
    
"the chosen one",
    
"Chuck Norris"
}

const 
Float:HUD_SPECT_X 0.6 
const Float:HUD_SPECT_Y 0.8 
const Float:HUD_STATS_X 0.02 
const Float:HUD_STATS_Y 0.9 

const HUD_STATS_ZOMBIE_R 200 
const HUD_STATS_ZOMBIE_G 250 
const HUD_STATS_ZOMBIE_B 

const HUD_STATS_HUMAN_R 
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) 

const PEV_SPEC_TARGET pev_iuser2 

new g_MsgSync 
new Level:PlayerLevels[33]   

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_ASSASSIN) || equal(moduleLIBRARY_SURVIVOR) || equal(moduleLIBRARY_SNIPER) || 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


// Show HUD Task 
public ShowHUD(taskid

    new 
player ID_SHOWHUD 
     
    
// 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 
     
    checkear_ammopacks
(player
     
    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"
             
        
// Assassin Class loaded? 
        
else if (LibraryExists(LIBRARY_ASSASSINLibType_Library) && zp_class_assassin_get(player)) 
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_ASSASSIN"
        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_SURVIVORLibType_Library) && zp_class_survivor_get(player)) 
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_SURVIVOR"

        
// Sniper Class loaded? 
        
else if (LibraryExists(LIBRARY_SNIPERLibType_Library) && zp_class_sniper_get(player)) 
            
formatex(class_namecharsmax(class_name), "%L"ID_SHOWHUD"CLASS_SNIPER"
        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^nHP: %d - %L %s - %L %d - %s"ID_SHOWHUD"SPECTATING"player_nameget_user_health(player), ID_SHOWHUD"CLASS_CLASS"class_name,  
            
ID_SHOWHUD"AMMO_PACKS1"zp_ammopacks_get(player), LevelName[PlayerLevels[player]]) 
        else 
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"%L: %s^nHP: %d - %L %s - %L $ %d - %s"ID_SHOWHUD"SPECTATING"player_nameget_user_health(player), ID_SHOWHUD"CLASS_CLASS"class_name,  
            
ID_SHOWHUD"MONEY1"cs_get_user_money(player), LevelName[PlayerLevels[player]]) 
    } 
    else 
    { 
     
        
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"get_user_health(ID_SHOWHUD), ID_SHOWHUD"CLASS_CLASS"class_name,  
            
ID_SHOWHUD"AMMO_PACKS1"zp_ammopacks_get(ID_SHOWHUD), LevelName[PlayerLevels[player]]) 
        else 
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"HP: %d - %L %s - %s"get_user_health(ID_SHOWHUD), ID_SHOWHUD"CLASS_CLASS"class_name,  
            
LevelName[PlayerLevels[ID_SHOWHUD]]) 
    } 



public 
checkear_ammopacks(id

    new 
ammopacks zp_ammopacks_get(id
  
    if(
ammopacks && ammopacks 49)   
    { 
        
PlayerLevels[id] = Level1
    } 
    else if (
ammopacks 500
    { 
        
PlayerLevels[id] = Level2
    } 
    else if(
ammopacks 1000
    { 
        
PlayerLevels[id] = Level3
    } 
    else if(
ammopacks 2000
    { 
        
PlayerLevels[id] = Level4
    } 
    else if(
ammopacks 5000
    { 
        
PlayerLevels[id] = Level5
    } 
    else if(
ammopacks 10000
    { 
        
PlayerLevels[id] = Level6
    } 
    else if(
ammopacks 30000
    { 
        
PlayerLevels[id] = Level7
    } 
    else if(
ammopacks 50000
    { 
        
PlayerLevels[id] = Level8
    } 
    else if(
ammopacks 100000
    { 
        
PlayerLevels[id] = Level9
    } 
    else if(
ammopacks 200000
    { 
        
PlayerLevels[id] = Level10
    } 
    else 
    { 
        
PlayerLevels[id] = Level10
    }   
    
set_task(1.0"checkear_ammopacks"id


Last edited by siriusmd99; 06-01-2016 at 12:43.
siriusmd99 is offline
B7PK
Member
Join Date: Apr 2016
Location: palestine
Old 06-01-2016 , 11:14   Re: help HUD Information
Reply With Quote #3

Error complete :\
PHP Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2013 ITB CompuPhaseAMX Mod X Team

Error
Undefined symbol "LevelName" on line 161
Error
Undefined symbol "LevelName" on line 164
Error
Undefined symbol "LevelName" on line 173
Error
Undefined symbol "LevelName" on line 176

4 Errors
.
Could not locate output file C:\Users\abood\Desktop\zoz_hud_InformationLV.amx (compile failed). 
__________________

Last edited by B7PK; 06-01-2016 at 11:23.
B7PK is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-01-2016 , 12:44   Re: help HUD Information
Reply With Quote #4

I updated the code.
siriusmd99 is offline
B7PK
Member
Join Date: Apr 2016
Location: palestine
Old 06-01-2016 , 13:04   Re: help HUD Information
Reply With Quote #5

thx work
__________________
B7PK is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-01-2016 , 13:21   Re: help HUD Information
Reply With Quote #6

Quote:
Originally Posted by B7PK View Post
thx work
Level starts from 0 or from 1?
siriusmd99 is offline
B7PK
Member
Join Date: Apr 2016
Location: palestine
Old 06-01-2016 , 14:55   Re: help HUD Information
Reply With Quote #7

from 0
__________________
B7PK is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-01-2016 , 16:10   Re: help HUD Information
Reply With Quote #8

Ok, then it will work,good luck.
siriusmd99 is offline
B7PK
Member
Join Date: Apr 2016
Location: palestine
Old 06-01-2016 , 16:14   Re: help HUD Information
Reply With Quote #9

Thx
__________________
B7PK is offline
walle7863
Junior Member
Join Date: Apr 2016
Old 10-12-2016 , 11:14   Re: help HUD Information
Reply With Quote #10

when ammo packs is 0 is showing level2? :\
walle7863 is offline
Reply



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 05:41.


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