AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HP .... (https://forums.alliedmods.net/showthread.php?t=222305)

med 08-01-2013 05:21

HP ....
 
how to make HP from 3000 to 3,000

like that
1000= 1,000
10000= 10,000
100000 = 100,000
ect ............. Plz help me

Black Rose 08-01-2013 11:34

Re: HP ....
 
What HP? The HUD? Explain better.

DWIGHTpN 08-01-2013 12:27

Re: HP ....
 
Event hp on hud is 255 max.

med 08-01-2013 12:57

Re: HP ....
 
https://forums.alliedmods.net/attach...4&d=1374057430 This is what i mean :)

Black Rose 08-01-2013 14:04

Re: HP ....
 
Well, in that image it clearly says "3,174"... so, problem solved?

You'll have to edit the source of that mod if you want to change it. Too much work for such a small thing.

med 08-01-2013 18:20

Re: HP ....
 
yea i ant to change the source of Mod just tell me and i will try :D

MPD 08-02-2013 02:51

Re: HP ....
 
PHP Code:

public Something(id) {
    new 
hp get_user_health(id);        // E.g. 25512
    
new hp1hp2;    // For health after 1000 and before it
    
new szHealth[10];    // This is where 25,512 is writen
    
if (hp>999) {
        
hp1 hp/1000;        // This is now 25
        
hp2 hp-(hp1*1000);        // This is now 512
        
formatex(szHealthcharsmax(szhealth), "%d,%d"hp1hp2);
        
// Now we have 25,512 writen in szHealth
        // This is just example how to make what you need
    
}



DWIGHTpN 08-02-2013 09:09

Re: HP ....
 
1 Attachment(s)
Not tested.
@MPD : If hp > 1.000.000 how appear :P ?

For biggest number.
Warning , not tested (i'm not home)..
This is modified hud_info plugin ( from zp50 ):
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>
#include <string_stocks>

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

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)
}

// 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
    
    
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))
        new 
health_spec25 ]
        new 
health_spec_num get_user_health(player)
        
num_to_str(health_spec_numhealth_speccharsmaxhealth_spec ))
        new 
format_health35 ]
        for(new 
strlen(health_spec);>= 0;i-=3)
        {
            
str_insert(health_spec,","i,format_health,charsmax(format_health))
        }
        
        
// 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: %s - %L %s - %L %d"ID_SHOWHUD"SPECTATING"player_nameformat_healthID_SHOWHUD"CLASS_CLASS"class_nameID_SHOWHUD"AMMO_PACKS1"zp_ammopacks_get(player))
        else
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"%L: %s^nHP: %s - %L %s - %L $ %d"ID_SHOWHUD"SPECTATING"player_nameformat_healthID_SHOWHUD"CLASS_CLASS"class_nameID_SHOWHUD"MONEY1"cs_get_user_money(player))
    }
    else
    {
        new 
health25 ]
        new 
health_num get_user_health(ID_SHOWHUD)
        
num_to_str(health_numhealthcharsmaxhealth ))
        new 
f_health35 ]
        for(new 
strlen(health);>= 0;j-=3)
        {
            
str_insert(health,","j,f_health,charsmax(f_health))
        }
        
// 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: %s - %L %s - %L %d"f_healthID_SHOWHUD"CLASS_CLASS"class_nameID_SHOWHUD"AMMO_PACKS1"zp_ammopacks_get(ID_SHOWHUD))
        else
            
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync"HP: %s - %L %s"f_healthID_SHOWHUD"CLASS_CLASS"class_name)
    }


For this plugin, you need string_stocks library :)

med 08-02-2013 09:30

Re: HP ....
 
Can u do it for zpa plz ........ i relly need that

MPD 08-10-2013 03:31

Re: HP ....
 
Quote:

Originally Posted by DWIGHTpN (Post 2004136)
Not tested.
@MPD : If hp > 1.000.000 how appear :P ?

I don't think that someone wil give this amount of hp for somebody :)


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

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