AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Add weapon name next to team money (https://forums.alliedmods.net/showthread.php?t=309246)

csykosoma 07-18-2018 16:27

Add weapon name next to team money
 
Currently using the code below, and am wanting to add 2 features to it.

1. The primary main weapon slot 1 name be displayed or if player has none the space is blank. Placed after the money amount.

2. The money and weapon name is updated every 1 second for 14 seconds.

I believe this is a better way to help coordinate team buying for pug's.

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>

#define NAME "show teammate's money"
#define VERSION "1.3.1"
#define AUTHOR "K.K.Lv"

new g_max_playersg_sync_creat_statustextg_sync_creat_list

new bool:g_teammate[33]

new 
cvar_plugin_on
new cvar_status_on

public plugin_init()
{
    
register_plugin(NAMEVERSIONAUTHOR)

    
RegisterHam(Ham_Spawn"player""player_spawn"1)

    
register_clcmd("say /money""clcmd_money")

    
//register_event("StatusValue", "show_teammate_money", "be", "1=2", "2!0")
    //register_event("StatusValue", "set_team", "be", "1=1")

    
cvar_plugin_on register_cvar("stm_on""1")
    
cvar_status_on register_cvar("stm_st_on""1")

    
g_max_players get_maxplayers()
    
g_sync_creat_statustext CreateHudSyncObj()
    
g_sync_creat_list CreateHudSyncObj()
}

public 
clcmd_money(client)
{
    if (!
get_pcvar_num(cvar_plugin_on))
    {
        
client_print(clientprint_chat"Your teammate's money.")
        return 
PLUGIN_HANDLED
    
}
    
show_money(client)
    return 
PLUGIN_CONTINUE
}

public 
player_spawn(client)
{
    
remove_task(client)
    if (
is_user_alive(client) && get_pcvar_num(cvar_plugin_on))
    {
        
set_task(1.0"show_money"client)
    }
}

public 
show_money(client)
{
    static 
message[1024];
    static 
name[32];
    
    new 
moneyidlen;
    
    
len format(messagecharsmax(message), "The teammate's money:^n");
    for (
id 1id <= g_max_playersid++)
    {
        if (
is_user_connected(id) && cs_get_user_team(id) == cs_get_user_team(client))
        {
            
money cs_get_user_money(id);
            
get_user_name(idname31);
            
len += format(message[len], charsmax(message) - len"%-22.22s: %d^n"namemoney);
        }
    }
    
set_hudmessage(10150110.050.3500.0214.00.10.22);
    
ShowSyncHudMsg(clientg_sync_creat_listmessage);
}

public 
set_team(id)
    
g_teammate[id] = bool:(read_data(2) == 1);

public 
show_teammate_money(id)
{
    if (!
get_pcvar_num(cvar_plugin_on))
        return 
PLUGIN_HANDLED
    
if(!is_user_bot(id) && is_user_connected(id) && get_pcvar_num(cvar_status_on))
    {
        static 
name[32]
        
        new 
pid read_data(2)
        new 
red 0blue 0
        
        
if (cs_get_user_team(pid) == CS_TEAM_T)
            
red 255
        
else if(cs_get_user_team(pid) == CS_TEAM_CT)
            
blue 255
        
        get_user_name
(pidnamecharsmax(name))
        new 
money cs_get_user_money(pid)
        if (
g_teammate[id])
        {
        
set_hudmessage(red50blue, -1.00.6010.010.60.010.018)
        
ShowSyncHudMsg(idg_sync_creat_statustext"Friend:%s -- Money:%d"namemoney)
        }
        else {
        
set_hudmessage(red50blue, -1.00.6010.010.60.010.018)
        
ShowSyncHudMsg(idg_sync_creat_statustext"Enemy:%s"name)
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
client_disconnect(client)
{
    
remove_task(client)



kristi 07-19-2018 11:12

Re: Add weapon name next to team money
 
PHP Code:

#include <amxmodx> 
#include <cstrike> 

#define NAME "Show team's money & primary weapons" 
#define VERSION "1.4" 
#define AUTHOR "kristi" 

//#pragma tabsize 0
#pragma semicolon 1

const CSW_ALL_PRIMARYWEAPONS = ((<< CSW_AK47)|(<< CSW_AUG)|(<< CSW_GALIL)|(<< CSW_AWP)        |
                (
<< CSW_M4A1)|(<< CSW_SCOUT)|(<< CSW_GALIL)|(<< CSW_SG550)    |
                (
<< CSW_SG552)|(<< CSW_FAMAS)|(<< CSW_AUG)|(<< CSW_G3SG1)    |
                (
<< CSW_M249)|(<< CSW_M3)|(<< CSW_MP5NAVY)|(<< CSW_MAC10)    |
                (
<< CSW_P90)|(<< CSW_TMP)|(<< CSW_UMP45)|(<< CSW_XM1014)    );

const 
TASK_ShowMoneyWpns 1337;

new 
teams[][] =
{
    
"TERRORIST",
    
"CT"
};

new 
g_HudSyncThing;
new 
pcvarpcvar2;

public 
plugin_init() 

    
register_plugin(NAMEVERSIONAUTHOR);
    
    
register_event("HLTV""OnEvent_NewRound""a""1=0""2=0");
    
register_clcmd("say /money""OnClcmd_money");
    
register_clcmd("say_team /money""OnClcmd_money");
    
    
// set to how many seconds do you want to show HUD message
    // or set it to 1 to use mp_freezetime value
    // 0 disables the plugin
    
pcvar register_cvar("amx_showteammoney""1");
    
    
pcvar2 get_cvar_pointer("mp_freezetime");
    
    
    
g_HudSyncThing CreateHudSyncObj();
}

public 
OnClcmd_money(client

    if(!
get_pcvar_num(pcvar)) 
        return 
PLUGIN_HANDLED;
        
    
client_print(clientprint_chat"Your team's money & weapons.");
    
show_info_to(clientcs_get_user_team(client));
    
    return 
PLUGIN_CONTINUE;


public 
OnEvent_NewRound()
{
    new 
value get_pcvar_num(pcvar);
    new 
freezetimeValue get_pcvar_num(pcvar2);
    
    
remove_task(TASK_ShowMoneyWpns);
    
    if(
value)
    {
        
show_info();
        
set_task(1.0"show_info"TASK_ShowMoneyWpns, .flags "a", .repeat = (value 1) ? freezetimeValue value);
    }
}

public 
show_info() 

    
show_info_to(.Team CS_TEAM_T);
    
show_info_to(.Team CS_TEAM_CT);
}

show_info_to(client 0CsTeams:Team)
{
    new 
a[32], niid;
    
get_players(an"e"teams[Team 1]);
    
    if(
2) return;
    
    static 
message[1024];
    new 
playerName[13], playerPrimWpn[32], playerMoney;
    new 
lenwpnId;
    
    
len formatex(messagecharsmax(message), "Your team's money & weapons:^n");
    
    for(
0ni++)
    {
        
id a[i];
        
playerName[0] = playerPrimWpn[7] = playerMoney EOS;
        
        
wpnId get_primary_weapon(id);
        if(
wpnId)
        {
            
get_weaponname(wpnIdplayerPrimWpncharsmax(playerPrimWpn));
            
strtoupper(playerPrimWpn);
        }
        
        
get_user_name(idplayerName12);
        
playerMoney cs_get_user_money(id);
        
        
len += formatex(message[len], charsmax(message) - len"%s:  $%d  - %s^n"playerNameplayerMoneyplayerPrimWpn[7]);
    }
    
    if(!
client)
    {
        
set_hudmessage(10150110.050.3500.021.10.10.22);
        for(
0ni++)
        {
            
ShowSyncHudMsg(a[i], g_HudSyncThingmessage); 
        }
    }
    else
    {
        
set_hudmessage(10150110.050.3500.025.00.10.22);
        
ShowSyncHudMsg(clientg_HudSyncThingmessage);
    }
}

get_primary_weapon(id)
{
    new 
weapons[32], weaponsNumweapon;
    
get_user_weapons(idweaponsweaponsNum);
    
    for(new 
iweaponsNumi++)
    {
        
weapon weapons[i];
        
        if((
<< weapon) & CSW_ALL_PRIMARYWEAPONS)
        {
            return 
weapon;
        }
    }  
    
    return 
0;



csykosoma 07-20-2018 16:05

Re: Add weapon name next to team money
 
This works beautifully, it's already helped a lot. The only feedback I got back was people also wanted to see the secondary pistol after the primary, to help coordinate deagle buys.

The ultimate version I think would just show it all, kevlar, kevlar+helmet, and grenades and what type and how many. We'd be cs:go then.

Still as is it's a huge upgrade.


All times are GMT -4. The time now is 09:56.

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