AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Ammo display (https://forums.alliedmods.net/showthread.php?t=206704)

tomes11 01-25-2013 10:07

Ammo display
 
Hi

There is a problem with the ammo show, cuz it dont go above 254. Soo i wanted to add a current BP ammo hud but whats the command for it? to know my current bp ammo?

edit1:found the ammo code, but now how to make that the game check it? So whenever i use +reload it re calculate it.

tomes11 01-26-2013 08:26

Re: Ammo display
 
help???

tomes11 01-27-2013 06:26

Re: Ammo display
 
Hud is now look like this:

PHP Code:

show_hudmessage(0BP ammo: [%i] , cs_get_user_bpammo(id)) 

But not wroking. Whats the correct mode of using bp ammo??

gogicaa 01-27-2013 14:17

Re: Ammo display
 
PHP Code:

"BP ammo: [%i]" 


gpower 01-27-2013 16:39

Re: Ammo display
 
Deleted

gogicaa 01-27-2013 17:05

Re: Ammo display
 
cs_get_user_bpammo(index, weapon)

tomes11 01-28-2013 08:42

Re: Ammo display
 
Now it can compile it but didn't show anything :S

PHP Code:

public HUDUpdate(idindexweapon)
{
    if(
is_user_connected(id))
    {
        
set_hudmessage(get_cvar_num("zphud_rcolor"),get_cvar_num("zphud_gcolor"),get_cvar_num("zphud_bcolor"), -1.00.0500.50.5)
        
show_hudmessage(0"BP ammo: [%i]" cs_get_user_bpammo(indexweapon))
    }


of course its not the full code, jsut the hud.

gpower 01-28-2013 08:55

Re: Ammo display
 
Can you show me your plugin ?

tomes11 01-28-2013 08:58

Re: Ammo display
 
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <zombieplague>
#include <dhudmessage>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <csx>

#define TASK_SHOWHUD 100
#define ID_SHOWHUD (taskid - TASK_SHOWHUD)

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
set_task(0.5,"HUDUpdate"0,"",0,"b")
    
    
/* CVARS */
    
    
register_cvar("zphud_rcolor","0"// RED
    
register_cvar("zphud_gcolor","255"// GREEN
    
register_cvar("zphud_bcolor","0"// BLUE
    
    
}

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


public 
HUDUpdate(idindexweapon)
{
    if(
is_user_connected(id))
    {
        
set_hudmessage(get_cvar_num("zphud_rcolor"),get_cvar_num("zphud_gcolor"),get_cvar_num("zphud_bcolor"), -1.00.0500.50.5)
        
show_hudmessage(0"BP ammo: [%i]" cs_get_user_bpammo(indexweapon))
    }
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
*/ 


H.RED.ZONE 01-28-2013 19:16

Re: Ammo display
 
Try.
PHP Code:

// Includes.
#include < amxmodx >
#include < cstrike >
#include < dhudmessage >

// Plugin Name, Author,Version.
#define _PLUGIN    "[ZP] Show Ammo Hud"
#define _AUTHOR       "H.RED.ZONE"
#define _VERSION          "1.0"

// Cvars.
new _pCvarRedColor
    
,_pCvarGreenColor
    
,_pCvarBlueColor

// Task.
#define TASK_SHOWHUD 121
#define ID_SHOWHUD (taskid - TASK_SHOWHUD)    
    
// Called When Map Loads.
public plugin_init( ) { 
    
    
// Register Plugin.
    
register_plugin_PLUGIN_VERSION_AUTHOR )
    
    
// Cvars.
    
_pCvarRedColor register_cvar"zphud_rcolor","0" // Red
    
_pCvarGreenColor register_cvar"zphud_gcolor","255" // Green
    
_pCvarBlueColor register_cvar"zphud_bcolor","0" // Blue
}

// Client Put In Server.
public client_putinserverplr ){
    
    
// If user Is Not Bot.
    
if ( !is_user_bot(plr) ) {
        
        
// Set Task Show Hud.
        
set_task1.0"ShowHUD"plr+TASK_SHOWHUD__"b" )
    }
}

// Show Hud.
public ShowHUD(plr) {
    
    
// If User Is Alive.
    
if(is_user_alive(plr)) {
        
        
// Hud Message.
        
set_hudmessageget_pcvar_num(_pCvarRedColor),get_pcvar_num(_pCvarGreenColor),get_pcvar_num(_pCvarBlueColor), -1.00.0500.50.5 )
        
show_hudmessageplr"BP ammo: [ %d ]" cs_get_weapon_ammo(plr) )
    }




All times are GMT -4. The time now is 08:15.

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