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

Can I "client_print" to only one team?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
suhdude
Senior Member
Join Date: Mar 2016
Location: Sweden
Old 11-07-2017 , 20:21   Can I "client_print" to only one team?
Reply With Quote #1

I am using this plugin on my war server:
https://forums.alliedmods.net/showthread.php?p=1033664

But I think the HUD text looks cheap, and people always complain that I have AMX on my server.

How hard would it be to make it print the money using client_print instead?
But only have it show up for one team..
I think the multilang text looks clean and would make it look a lot better.


(I would also really appriciate if someone could tell me how to add a $ sign before the money digits.)

I belive it is this section that needs editing:

THANKS! /da nub



Quote:
public show_money(client)
{
static message[1024];
static name[32];

new money, id, len;

len = format(message, charsmax(message), "Team Economy:^n");
for (id = 1; id <= g_max_players; id++)
{
if (id != client && is_user_connected(id) && cs_get_user_team(id) == cs_get_user_team(client))
{
money = cs_get_user_money(id);
get_user_name(id, name, 31);
len += format(message[len], charsmax(message) - len, "%-22.22s: %d^n", name, money);
}
}
set_hudmessage(100, 200, 0, 0.05, 0.35, 0, 0.02, 5.0, 0.1, 0.2, 2);
ShowSyncHudMsg(client, g_sync_creat_list, message);
}

public set_team(id)
g_teammate[id] = boolread_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 = 0, blue = 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(pid, name, charsmax(name))
new money = cs_get_user_money(pid)
if (g_teammate[id])
{
set_hudmessage(red, 50, blue, -1.0, 0.60, 1, 0.01, 0.6, 0.01, 0.01,
ShowSyncHudMsg(id, g_sync_creat_statustext, "Friend:%s -- Money:%d", name, money)
}
else {
set_hudmessage(red, 50, blue, -1.0, 0.60, 1, 0.01, 0.6, 0.01, 0.01,
ShowSyncHudMsg(id, g_sync_creat_statustext, "Enemy:%s", name)
}
}
return PLUGIN_CONTINUE
}

Last edited by suhdude; 11-07-2017 at 20:22.
suhdude is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-07-2017 , 22:40   Re: Can I "client_print" to only one team?
Reply With Quote #2

Quote:
Originally Posted by suhdude View Post
people always complain that I have AMX on my server.
Nearly every HLDS server have AMX Mod X installed . . .


Quote:
Originally Posted by suhdude View Post
How hard would it be to make it print the money using client_print instead?
Delete set_hudmessage() and replace ShowSyncHudMsg() with client_print() (you'll have to adjust the arguments accordingly).
__________________
fysiks is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-07-2017 , 22:41   Re: Can I "client_print" to only one team?
Reply With Quote #3

Quote:
Originally Posted by suhdude View Post
But only have it show up for one team..
Check for the team before calling show_team()

Quote:
Originally Posted by suhdude View Post
I think the multilang text looks clean and would make it look a lot better.
"MultiLang" doesn't change the appearance of text. It's only for language translations.

Quote:
Originally Posted by suhdude View Post
(I would also really appriciate if someone could tell me how to add a $ sign before the money digits.)
Simply put a dollar sign in the message (i.e. before the %d where money is used).

@Moderators/Admins: Had to use two posts because, for some strange reason, CloudFlare was blocking the above text in a single post.
__________________

Last edited by fysiks; 11-07-2017 at 22:42.
fysiks is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 11-08-2017 , 05:46   Re: Can I "client_print" to only one team?
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
Simply put a dollar sign in the message (i.e. before the %d where money is used).
I think he need to put double dollar sign to work.
KiLLeR. is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 11-08-2017 , 06:31   Re: Can I "client_print" to only one team?
Reply With Quote #5

Quote:
Originally Posted by KiLLeR. View Post
I think he need to put double dollar sign to work.
No...he don't
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
suhdude
Senior Member
Join Date: Mar 2016
Location: Sweden
Old 11-08-2017 , 07:11   Re: Can I "client_print" to only one team?
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Nearly every HLDS server have AMX Mod X installed . . .
Delete set_hudmessage() and replace ShowSyncHudMsg() with client_print() (you'll have to adjust the arguments accordingly).
I have never played on a war server using amx.

I tried my best, to transfer the arguments without really knowing what I'm doing...
It looks alright, exept everything is on the same line.. Like a string of names and money.

Last edited by suhdude; 11-08-2017 at 07:12.
suhdude is offline
suhdude
Senior Member
Join Date: Mar 2016
Location: Sweden
Old 11-08-2017 , 07:13   Re: Can I "client_print" to only one team?
Reply With Quote #7

Replaced this:
Quote:
set_hudmessage(100, 200, 0, 0.05, 0.35, 0, 0.02, 5.0, 0.1, 0.2, 2);
ShowSyncHudMsg(client, g_sync_creat_list, message);
With this:
Quote:
client_print(client, print_chat, message)


And this:
Quote:
set_hudmessage(red, 50, blue, -1.0, 0.60, 1, 0.01, 0.6, 0.01, 0.01,
ShowSyncHudMsg(id, g_sync_creat_statustext, "Friend:%s -- Money:%d", name, money)
}
else {
set_hudmessage(red, 50, blue, -1.0, 0.60, 1, 0.01, 0.6, 0.01, 0.01,
ShowSyncHudMsg(id, g_sync_creat_statustext, "Enemy:%s", name)

with this:

Quote:
client_print(id, print_chat, name, money)
}
else {
client_print(id, print_chat, name, money)

I dont' know, but it seems like it only prints my teams money, I can't tell maybe it prints everyones but I only cannot see it because its on the same line?

Any help would be appriciated.

(Also got cloudflare block)
suhdude is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 11-08-2017 , 08:40   Re: Can I "client_print" to only one team?
Reply With Quote #8

Quote:
Originally Posted by wickedd View Post
No...he don't
Yeah you are right, because I was thinking for '%' symbol where you have to put 2 in a row to be shown.

Quote:
Originally Posted by suhdude View Post
And this:
Quote:
set_hudmessage(red, 50, blue, -1.0, 0.60, 1, 0.01, 0.6, 0.01, 0.01,
ShowSyncHudMsg(id, g_sync_creat_statustext, "Friend:%s -- Money:%d", name, money)
}
else {
set_hudmessage(red, 50, blue, -1.0, 0.60, 1, 0.01, 0.6, 0.01, 0.01,
ShowSyncHudMsg(id, g_sync_creat_statustext, "Enemy:%s", name)
with this:
Quote:
client_print(id, print_chat, name, money)
}
else {
client_print(id, print_chat, name, money)
It must be:
Code:
if( ... ) {     client_print(id, print_chat, "Friend: %s -- Money: %d", name, money) } else {     client_print(id, print_chat, "Enemy: %s", name) }

Last edited by KiLLeR.; 11-08-2017 at 08:41.
KiLLeR. is offline
suhdude
Senior Member
Join Date: Mar 2016
Location: Sweden
Old 11-08-2017 , 09:08   Re: Can I "client_print" to only one team?
Reply With Quote #9

Quote:
Originally Posted by KiLLeR. View Post
It must be: (CODE)
I can't get it to work, but I found another plugin that does this.
But only when you type /money in chat.

Is there a way to make players say /money on spawn using engclient_cmd?
I'm obviously no programmer, thanks for being patient.

here is the plugin I'm trying to change:
Code:
/* say_team /money // client cmd */ #include <amxmodx> #include <cstrike> #define PLUGIN "show_money" #define VERSION "1.0" #define AUTHOR "Weejee & n2k" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /money", "cmd_money")     register_clcmd("say_team /money", "cmd_money") } public cmd_money(id) {     new iMoney;     new money_Buffer[100+1];     iMoney = cs_get_user_money(id);     format( money_Buffer, 100, "$%d", iMoney );         engclient_cmd( id, "say_team", money_Buffer ); }

Last edited by suhdude; 11-08-2017 at 09:09.
suhdude is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 11-08-2017 , 10:12   Re: Can I "client_print" to only one team?
Reply With Quote #10

Instead of explaining, it was a faster to edit the plugin you have gave in first post. So, here is it:
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_players, g_sync_creat_statustext; new bool:g_teammate[33] new cvar_plugin_on new cvar_status_on public plugin_init() {     register_plugin(NAME, VERSION, AUTHOR)         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() } public clcmd_money(client) {     if (!get_pcvar_num(cvar_plugin_on))     {         client_print(client, print_chat, "[AMXX]: Show Teammate's Money was off.")         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 name[32];         new money, id;         client_print(client, print_chat, "The teammate's money:");     for (id = 1; id <= g_max_players; id++)     {         if (id != client && is_user_connected(id) && cs_get_user_team(id) == cs_get_user_team(client))         {             money = cs_get_user_money(id);             get_user_name(id, name, 31);             client_print(client, print_chat, "%-22.22s: $%d", name, money);         }     } } 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 = 0, blue = 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(pid, name, charsmax(name))         new money = cs_get_user_money(pid)         if (g_teammate[id])         {             set_hudmessage(red, 50, blue, -1.0, 0.60, 1, 0.01, 0.6, 0.01, 0.01, 8)             ShowSyncHudMsg(id, g_sync_creat_statustext, "Friend:%s -- Money:%d", name, money)         }         else {             set_hudmessage(red, 50, blue, -1.0, 0.60, 1, 0.01, 0.6, 0.01, 0.01, 8)             ShowSyncHudMsg(id, g_sync_creat_statustext, "Enemy:%s", name)         }     }     return PLUGIN_CONTINUE } public client_disconnect(client) {     remove_task(client) }
But I think this is useless and ugly, because chat will be flooded if there is more players in the server when someone write "/money" in chat.

Last edited by KiLLeR.; 11-08-2017 at 10:56.
KiLLeR. 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 11:27.


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