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

Join Leave HUD Colors


Post New Thread Reply   
 
Thread Tools Display Modes
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-25-2007 , 16:48   Re: Join Leave HUD Colors
Reply With Quote #11

That is very very clean, thanks mate010.

THe only thins, is their a green hud for regulars and red hud for admins? I only saw one set_hudmessage. Sorry guys, but thanks soo much

This is what I got it so far.
( i know the client cmd doesnt work in that spot...) I was trying to find different ways to emmit the sound, but... blah

HTML Code:
#include <amxmodx>
#include <amxmisc>
#include <csstats>

new g_szSoundFile[] = "buttons/blip1.wav";

public plugin_precache()
{
    precache_sound(g_szSoundFile);
}


public plugin_init() {
	register_plugin("Enter Leave Message", "1.0", "MaTTe");
}

public client_connect(id) {

	if(is_user_bot(id)) 
	return PLUGIN_CONTINUE;

	new name[32];
	get_user_name(id, name, 31);
	
	new data[8], rankpos[8], pos;
	pos = get_user_stats(id, data, data);
	num_to_str(pos, rankpos, 7);
	
	set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0, 0.1, 0.2, -1);
	if(is_user_admin(id)) {
		client_cmd(param[0],"spk %s", g_szSoundFile);
		show_hudmessage(0, "Admin %s has just joined |AoC|!^n(Rank is %s)\nSo watch out! =)", name, rankpos);
	} else {
	set_hudmessage(255, 0, 0, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, -1) 
		show_hudmessage(0, "Player %s has just joined |AoC|!^n(Rank is %s)\nEnjoy you stay!", name, rankpos);
	}
}
__________________

Last edited by bmann_420; 02-25-2007 at 17:01.
bmann_420 is offline
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-25-2007 , 19:48   Re: Join Leave HUD Colors
Reply With Quote #12

This is what im using now, with a few errors

HTML Code:
#include <amxmodx>
#include <amxmisc>
#include <csstats>

public plugin_precache()
{
    precache_sound(buttons/blip1.wav);
}


public plugin_init() {
	register_plugin("Enter Leave Message", "1.0", "MaTTe");
}

public client_authorized(id) {

	if(is_user_bot(id)) 
	return PLUGIN_CONTINUE;

	new name[32];
	get_user_name(id, name, 31);
	
	new data[8], rankpos[8], pos;
	pos = get_user_stats(id, data, data);
	num_to_str(pos, rankpos, 7);
	
	if(is_user_admin(id)) {
	
	emit_sound("buttons/blip1.wav")

	set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0, 0.1, 0.2, -1);
	show_hudmessage(0, "Admin %s has just joined |AoC|!^n(Rank is %s)\nSo watch out! =)", name, rankpos);
	
	} else {
	
	set_hudmessage(255, 0, 0, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, -1) 
		show_hudmessage(0, "Player %s has just joined |AoC|!^n(Rank is %s)\nEnjoy you stay!", name, rankpos);
	}
}
I also tried this with no success

HTML Code:
#include <amxmodx>
#include <amxmisc>
#include <csstats>
#define SOUNDFILES 

new soundName[SOUNDFILES][] = "buttons/blip1.wav";
{
    "buttons/blip1.wav"	
}
enum
{
	blip1
{

public plugin_init() {
	register_plugin("Enter Leave Message", "1.0", "MaTTe");
}

public client_authorized(id) {

	if(is_user_bot(id)) 
	return PLUGIN_CONTINUE;

	new name[32];
	get_user_name(id, name, 31);
	
	new data[8], rankpos[8], pos;
	pos = get_user_stats(id, data, data);
	num_to_str(pos, rankpos, 7);
	
	if(is_user_admin(id)) {
	
	emit_sound(0, CHAN_VOICE, soundName[blip1], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

	set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0, 0.1, 0.2, -1);
	show_hudmessage(0, "Admin %s has just joined |AoC|!^n(Rank is %s)\nSo watch out! =)", name, rankpos);
	
	} else {
	
	set_hudmessage(255, 0, 0, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, -1) 
		show_hudmessage(0, "Player %s has just joined |AoC|!^n(Rank is %s)\nEnjoy you stay!", name, rankpos);
	}
}
I know this soo easy, i feel like, well like i need to learn alot more
__________________

Last edited by bmann_420; 02-25-2007 at 20:07.
bmann_420 is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 02-25-2007 , 20:28   Re: Join Leave HUD Colors
Reply With Quote #13

Here is an edited version.
Note: Untested

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <csstats>

new soundName[] = "buttons/blip1.wav";

public 
plugin_init() {
    
register_plugin("Enter Leave Message""1.0""MaTTe");
}

public 
plugin_precache()
    
precache_sound(soundName)
    

public 
client_authorized(id
{
    if(
is_user_bot(id)) 
        return 
PLUGIN_CONTINUE;

    new 
name[32];
    
get_user_name(idname31);
    
    new 
data[8], rankpos[8], pos;
    
pos get_user_stats(iddatadata);
    
num_to_str(posrankpos7);
    
    new 
admin is_user_admin(id)
    
    new 
color[3]
    if(
admin
    {
        
color[0] = 255     //red
        
color[1] = 0       //green
        
color[2] = 0       //blue
    
}
    else
    {
        
color[0] = 0     //red
        
color[1] = 255      //green
        
color[2] = 0       //blue
    
}
    
    
client_cmd(0"spk %s"soundName)

    
set_hudmessage(color[0], color[1], color[2], -1.0, -1.006.012.00.10.2, -1)
    
show_hudmessage(0"%s %s has just joined |AoC|!^n(Rank is %s)\nSo watch out! =)"admin "Admin" "Player"namerankpos)

__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.

Last edited by Cheap_Suit; 02-25-2007 at 20:33. Reason: edited: client_cmd mistake
Cheap_Suit is offline
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-25-2007 , 21:11   Re: Join Leave HUD Colors
Reply With Quote #14

im not seeing how you can have 2 enter messages with that. I could be ovbiously wrong, ill try it. But I was looking for: 1 enter message for Admins = red HUD / editeabe by me || 1 enter message for regular people = green / editable by me.
In the same position as

Kinda like the HUD on the first one: (0, 255, 0, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)

I know thiers colors in their, but its the position I would like for both


Truly, thankx guys for your help

Im gonna test it Cheap, and see. I could be talkin out my ass so we will see. thanks tho very much

EDIT:

Tested

-The HUD is right above their crosshairs, the code in the origional has the right coordinates.
-The rank is always 0, which i can fix, but right idea, wrong spot
-It beeps for every person ( i was hoping for just admins)
-Says same thing for both admins and client
"\nSo watch out!" it shows /n
-colors are right tho

THis code, under here all I was wanted was this code exactly and have a diff phrase for admins and a diff color. I thought it was easy, but somehow holy shit its not. least for me
Attached Files
File Type: sma Get Plugin or Get Source (Enter_message.sma - 252 views - 1.6 KB)
__________________

Last edited by bmann_420; 02-25-2007 at 22:03.
bmann_420 is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 02-25-2007 , 21:50   Re: Join Leave HUD Colors
Reply With Quote #15

Im really bad at explaining but here I go..

The color:
I stored the color in the color array. color[0] which is red, color[1] with is green, color[2] which is blue.

If the user is an admin the color is set to:
color[3] = {255, 0, 0}
or
color[0] = 255
color[1] = 0
color[2] = 0

If the user is just a player i've set color[1] to 255 and the rest to 0.

and set the hud message color using the color array
set_hudmessage(color[0], color[1], color[2]....

The admin string:
For the first (%s), this string is controlled if the user is an admin or not.
Another way to do this is:
PHP Code:
new string[6] = admin "Admin" "Player"
show_hudmessage(0"%s %s has just joined |AoC|!^n(Rank is %s)\nSo watch out! =)"stringnamerankpos
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-25-2007 , 22:54   Re: Join Leave HUD Colors
Reply With Quote #16

Okay, im understanding most, but the admin strings. ANd the positions. (trouble coding) I need 2 different phrases, one for admins, and one for normals. Besides the color of course.

HTML Code:
#include <amxmod> 
#include <csstats> 

public client_putinserver(id){ 
   
   if(is_user_bot(id)) return PLUGIN_CONTINUE;

   new param[34], len 
   param[0] = id 
   len = get_user_name(id,param[1],31) 
   set_task(2.0, "enter_msg", 0, param,len + 2) 
   return PLUGIN_CONTINUE 
}  

public enter_msg(param[]) { 
   new message[192],hostname[64] 
   get_cvar_string("amx_enter_message", message, 191) 
   get_cvar_string("hostname", hostname, 63) 
   replace(message,191, "%hostname%", hostname)
   if (cvar_exists("csstats_reset")){ 
      new data[8], rankpos[8], pos 
      pos = get_user_stats(param[0],data,data) 
      numtostr(pos,rankpos,7) 
      replace(message, 191, "%rankpos%", rankpos) 
   } 
   replace(message, 191, "%name%", param[1]) 
   while(replace(message, 191, "\n", "^n")){} 
   set_hudmessage(0, 255, 0, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3) 
   show_hudmessage(0, message) 
   return PLUGIN_CONTINUE 
} 

public admin_msg(param[]) { 
   if(get_user_flags(param[0]))
   new message2[192],hostname[64] 
   get_cvar_string("amx_admin_message", message2, 191) 
   get_cvar_string("hostname", hostname, 63) 
   replace(message, 191, "%hostname%", hostname) 
   replace(message, 191, "%name%", param[1]) 
   while(replace(message, 191, "\n", "^n")){} 
   set_hudmessage(255, 0, 0, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3) 
   show_hudmessage(0, message) 
   return PLUGIN_CONTINUE 
} 

public plugin_init() { 
  register_plugin("Enter-Leave Message","0.2","[Kindzhon] China") 
  register_cvar("amx_enter_message", "%name% Welcome to |AoC|!\n(Rank is %rankpos%)\nEnjoy Your Stay") 
  register_cvar("amx_admin_message", "Admin %name% has just joined |AoC|!\n(Rank is %rankpos%)\nSo watch out! =)") 
  return PLUGIN_CONTINUE 
}
Maybe be sloppy but its the only possible way, and i get
HTML Code:
"/home/groups/amxmodx/tmp3/phpM1JvMg.sma(55) : error 003: declaration of a local variable must appear in a compound block
/home/groups/amxmodx/tmp3/phpM1JvMg.sma(55) : error 017: undefined symbol "message2"
/home/groups/amxmodx/tmp3/phpM1JvMg.sma(55) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/phpM1JvMg.sma(55) : error 001: expected token: ";", but found "]"
/home/groups/amxmodx/tmp3/phpM1JvMg.sma(55) : fatal error 107: too many error messages on one line"
I changed "message" for enter to "message2" for admin. I just want it easily editable, and I know this is sloppy coding but Im not quite understanding what your saing. IN making it exactly what i was trying to do. But TY again
__________________

Last edited by bmann_420; 02-25-2007 at 23:01.
bmann_420 is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 02-25-2007 , 23:02   Re: Join Leave HUD Colors
Reply With Quote #17

lol. gimme a few minutes
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-25-2007 , 23:18   Re: Join Leave HUD Colors
Reply With Quote #18

Im testing this now
HTML Code:
* Cvars: 
* amx_enter_message "%name% has joined!\nHave Fun Suka!\n(Rank is %rankpos%,IP:%IP%)" 
* amx_admin_message "%name% has left!\nSee Ya Next Time Suka." 
* 
* If you are using csstats module then you may use 
* %rankpos% expression in amx_enter_message cvar. 
* 
*/ 

#include <amxmod> 
#include <csstats> 

public client_putinserver(id){ 
   
   if(is_user_bot(id)) return PLUGIN_CONTINUE;

   new param[34], len 
   param[0] = id 
   len = get_user_name(id,param[1],31) 
   set_task(2.0, "enter_msg", 0, param,len + 2) 
   return PLUGIN_CONTINUE 
}  

public enter_msg(param[]) { 
   new message[192],hostname[64] 
   get_cvar_string("amx_enter_message", message, 191) 
   get_cvar_string("hostname", hostname, 63) 
   replace(message,191, "%hostname%", hostname)
   if (cvar_exists("csstats_reset")){ 
      new data[8], rankpos[8], pos 
      pos = get_user_stats(param[0],data,data) 
      numtostr(pos,rankpos,7) 
      replace(message, 191, "%rankpos%", rankpos) 
   } 
   replace(message, 191, "%name%", param[1]) 
   while(replace(message, 191, "\n", "^n")){} 
   set_hudmessage(0, 255, 0, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3) 
   show_hudmessage(0, message) 
   return PLUGIN_CONTINUE 
} 

public admin_msg(id,param[]) { 

   if(is_user_bot(id) || ADMIN_LEVEL_A) return PLUGIN_CONTINUE;

   new message[192],hostname[64] 
   get_cvar_string("amx_admin_message", message, 191) 
   get_cvar_string("hostname", hostname, 63) 
   replace(message,191, "%hostname%", hostname)
   if (cvar_exists("csstats_reset")){ 
      new data[8], rankpos[8], pos 
      pos = get_user_stats(param[0],data,data) 
      numtostr(pos,rankpos,7) 
      replace(message, 191, "%rankpos%", rankpos) 
   } 
   replace(message, 191, "%name%", param[1]) 
   while(replace(message, 191, "\n", "^n")){} 
   set_hudmessage(255, 0, 0, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3) 
   show_hudmessage(0, message) 
   return PLUGIN_CONTINUE 
} 
 

public plugin_init() { 
  register_plugin("Enter-Leave Message","0.2","[Kindzhon] China") 
  register_cvar("amx_enter_message", "%name% Welcome to |AoC|!\n(Rank is %rankpos%)\nEnjoy Your Stay") 
  register_cvar("amx_admin_message", "Admin %name% has just joined |AoC|!\n(Rank is %rankpos%)\nSo watch out! =)") 
  return PLUGIN_CONTINUE 
}
Not the most effecient, but hell, what are you gonna do. IF i could get it more effecient that would be great, but its beyond me to make one from scratch.
__________________
bmann_420 is offline
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-25-2007 , 23:34   Re: Join Leave HUD Colors
Reply With Quote #19

OOOO snap, I fogot I have those cvars in my server.cfg Let me edit those and get back lol wow
--even tho if I dont have the cvar in my server.cfg it should use the default wich is in the plugin.... headaches.... their comming, and fast

Sorry for double posting, but I also tried this and all i get is the regular join message. Saying Hello, rank and everything no matter if your an admin or not.
Compiles fine tho obviously.

HTML Code:
#include <amxmod> 
#include <csstats> 

public client_putinserver(id){ 
   
   if(is_user_bot(id)) return PLUGIN_CONTINUE;

   new param[34], len 
   param[0] = id 
   len = get_user_name(id,param[1],31) 
   set_task(2.0, "enter_msg", 0, param,len + 2) 
   return PLUGIN_CONTINUE 
}  

public enter_msg(param[]) { 
   new message[192],hostname[64] 
   get_cvar_string("amx_enter_message", message, 191) 
   get_cvar_string("hostname", hostname, 63) 
   replace(message,191, "%hostname%", hostname)
   if (cvar_exists("csstats_reset")){ 
      new data[8], rankpos[8], pos 
      pos = get_user_stats(param[0],data,data) 
      numtostr(pos,rankpos,7) 
      replace(message, 191, "%rankpos%", rankpos) 
   } 
   replace(message, 191, "%name%", param[1]) 
   while(replace(message, 191, "\n", "^n")){} 
   set_hudmessage(0, 255, 0, 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3) 
   show_hudmessage(0, message) 
   return PLUGIN_CONTINUE 
} 

public admin_msg(id,level,param[]) { 
   
   if (!(get_user_flags(id)&level))
	return PLUGIN_HANDLED

   new message[192],hostname[64] 
   get_cvar_string("amx_admin_message", message, 191) 
   get_cvar_string("hostname", hostname, 63) 
   replace(message,191, "%hostname%", hostname)
   if (cvar_exists("csstats_reset")){ 
      new data[8], rankpos[8], pos 
      pos = get_user_stats(param[0],data,data) 
      numtostr(pos,rankpos,7) 
      replace(message, 191, "%rankpos%", rankpos) 
   } 
   replace(message, 191, "%name%", param[1]) 
   while(replace(message, 191, "\n", "^n")){} 
   set_hudmessage(255, 0, 0, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, -1)
   show_hudmessage(0, message) 
   return PLUGIN_CONTINUE 
} 
 

public plugin_init() { 
  register_plugin("Enter-Leave Message","0.2","[Kindzhon] China") 
  register_cvar("amx_enter_message", "%name% Welcome to |AoC|!\n(Rank is %rankpos%)\nEnjoy Your Stay") 
  register_cvar("amx_admin_message", "Admin %name% has just joined |AoC|!\n(Rank is %rankpos%)\nSo watch out! =)") 
  return PLUGIN_CONTINUE 
} 
__________________

Last edited by bmann_420; 02-25-2007 at 23:39.
bmann_420 is offline
Old 02-25-2007, 23:39
Cheap_Suit
This message has been deleted by Cheap_Suit. Reason: Download from below
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-25-2007 , 23:41   Re: Join Leave HUD Colors
Reply With Quote #20

I edited my post a few tiems, sorry. I forgot about the beep. Thanks Cheap Il test it

And now once again for the test:

THe Rank is alwasy 0

Where they came from? It shows the server and everything.
THis is great coding Cheap but i was also just looking for basics of what I want to say when they join.
The text is green for admins and regulars also.

Welcome: "Blank"
Rank 0
Connect time ( I really dont need or wnat )

But i have yet to test the colors, but red works for admins dunno about green. but it displays no info and it does not say what i want it to, like the origional one i tried to manipulate and modify to make it how i see fit.
__________________

Last edited by bmann_420; 02-26-2007 at 00:11.
bmann_420 is offline
Reply


Thread Tools
Display Modes

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:02.


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