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

Join Leave HUD Colors


Post New Thread Reply   
 
Thread Tools Display Modes
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 02-26-2007 , 00:39   Re: Join Leave HUD Colors
Reply With Quote #21

Probably because it need their steamid when retieving their data. Putting it in client_connect to get the data is pretty much useless. Anyways I updated it to get their rank on client_putinserver.

Yea. Edit the CONNECT_MESSAGES to your likings. I just added few options if anyone else is look for the same plugin as you. Do you need them if you dont like them ^^
__________________
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-26-2007 , 01:06   Re: Join Leave HUD Colors
Reply With Quote #22

I soo much appreciate your help mateo10, Samurai and especially you Cheap

(the host names can be very long, i would suggest just using an editor or some sort (cvar) for custom phrase "Enjoy our stay" / or whatever phrase u want for the cvar. OR somethign else could suffice COuld be way off, but Ill edit it a lil but TY very Much


P.S. Your coding is some of the cleanest I have ever seen 2x

If you want I would pretty much guarentee you it would get approved for the dynamics of this plugin. Its not restricted like many others. (and others I mean, the one I have. Since all i have found for a while here, that actually performs nicely, besides v3x's) But he doesnt change em around for what people want It would be nice if it was supported more


Edit:

Whats the purpost of connection time? IF they just joined, they could have only been their for a certain amount of seconds. Could be something else i cant see of course tho

--It did not show the Rank. Its was 0
--No sound for admins
--Pre connecting hud was green for admins / not all, its was buggy as in on and off

--And possibly and Exit server? For a small advertisement wise ;)
__________________

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

Okay. Imma test this myself for the next version. Gimme few minutes to check on the ranks stuff.
__________________
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-26-2007 , 02:07   Re: Join Leave HUD Colors
Reply With Quote #24

And at teh end, I meant as in client_exit for people to see them leave.

That is definitly nothign to think too much about, just a thought.

Is their an easy way to eliminate the client_connection section and just have joining message easily? Just in case you want them for future reference? If not, I still would like to know how

Pretty much make it be able to disable/enable teh Client connection hud (not joining hud) and disable/enable a disconnect hud of the same way

Thankx
__________________

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

Okay. Everything should be functional now.
Edit: To remove any message just leave it blank.

Version 1.2
  • Added a 2.0 seconds delay before showing the message.
  • Should show your ranks now.
  • Should play sounds now.
  • Remove {hostname} since sometimes it's too long.
  • Remove connecting message.
  • Added disconnected message.
  • Added play time (for fun). <- how long the player has been playing
Attached Files
File Type: sma Get Plugin or Get Source (eln.sma - 337 views - 4.6 KB)
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.

Last edited by Cheap_Suit; 02-26-2007 at 03:34. Reason: I suck
Cheap_Suit is offline
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-26-2007 , 03:33   Re: Join Leave HUD Colors
Reply With Quote #26

Awesome, Ill test her right now.

Althought "Added Play time for fun" Im not sure whatcha mean by that. (map play time, hourly,)
but ill test and see

And this is much Appreciated

(Are you gonna post this under "New Submissions"? Could be beneficial

--Also isnt teh connection_time limited to how long he has been in the server since he arrived? (as in max of 6 seconds)

And the only you woudl want todo is turn the different huds into cvars


EDIT:

I tried this:
HTML Code:
new const CONNECT_MESSAGES[CONNECT_TYPE:MAX_TYPE][] =
{
	/*
		{name} 		= user name
		{rankpos} 	= user rank
		{connecttime} 	= user connection time
	*/
	
	"Admin {name} has Arrived\nRank:{rankpos}\nArmyofChaos.com", //admin
	"We Welcome {name}\nRank:{rankpos}\nGood Hunting =)"  //player
	
	/*
		{name} 		= user name
		{rankpos} 	= user rank
		{playtime} 	= user play time
	*/
	
	""  //admin
	""  //player
}
Complier siad:

HTML Code:
/home/groups/amxmodx/tmp3/phpD16ekM.sma(35) : error 001: expected token: "}", but found "-string-"
Which is the line: "" //player ( I know it had a comma; "", Like the one above but I get errors both ways)

EDIT:

maybe you uploaded another version cause they all compile now. lol
__________________

Last edited by bmann_420; 02-26-2007 at 04:04.
bmann_420 is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 02-26-2007 , 03:57   Re: Join Leave HUD Colors
Reply With Quote #27

For a new plugin submission. Nope, but feel free to do it yourself if you want, but I dont think the approvers will like this plugin at all because its not unique enough. Plus the text should in in cvars instead of editing the .sma file.

Connection time - is when the user first connect until he is connected (can see the motd.)

Play time - is counted when he is connected till he disconnects (in mins.)

"" //admin
"" //player
to

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

Last edited by Cheap_Suit; 02-26-2007 at 04:07.
Cheap_Suit is offline
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 02-26-2007 , 04:57   Re: Join Leave HUD Colors
Reply With Quote #28

I see, sounds awesome. Thank you soo much

I just need a cvs for now (for many more)
__________________
bmann_420 is offline
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 03-01-2007 , 01:29   Re: Join Leave HUD Colors
Reply With Quote #29

Cheap_Suit!

It plays the police2.wav on enter and leave. I am not sure how to go about changing it so it works right, as in the seeyou.wav sound for disconnect.

Once again ty so much, but I have this:

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

#define MAX_PLAYERS 32

enum CONNECT_TYPE
{
	putinserver_admin,
	putinserver_player,
	
	disconnect_admin,
	disconnect_player,
	
	MAX_TYPE
}

new const CONNECT_MESSAGES[CONNECT_TYPE:MAX_TYPE][] =
{
	/*
		{name} 		= user name
		{rankpos} 	= user rank
		{connecttime} 	= user connection time
	*/
	
	"Admin: {name} has Arrived\nHis Rank:{rankpos}\nWatch out People! Time to really Play now!", //admin
	"We Welcome {name}\nHis Rank:{rankpos}\nGood Luck Hunting Buddy =)",  //player
	
	/*
		{name} 		= user name
		{rankpos} 	= user rank
		{playtime} 	= user play time
	*/
	
	"Admin: {name} has left, he played for {playtime} Minuts\nVisit Armyofchaos.com to learn more",  //admin
	"{name}: Has Left, He Played for {playtime} Minuts\nVisit Armyofchaos.com to learn more"  //player
}

new const MESSAGES_COLOR[CONNECT_TYPE:MAX_TYPE][3] =
{
	{255, 	0, 	0}, 	//admin
	{0, 	255, 	0}, 	//player
	
	{255, 	0, 	255}, 	//admin
	{255, 	0, 	255} 	//player
}

new const CONNECT_SOUNDS[CONNECT_TYPE:MAX_TYPE][] =
{
	"misc/police2.wav", 	 //admin
	"", 			//player
	
	"misc/seeyou.wav", 	 //admin
	"" 			//player
}

new g_hudsync
new Float:g_connecttime[MAX_PLAYERS+1][2]

static const PLUGIN_NAME[] 	= "Enter-Leave Notifications"
static const PLUGIN_AUTHOR[] 	= "Cheap_Suit"
static const PLUGIN_VERSION[]	= "1.2"

public plugin_init()
{
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
	register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER)

	g_hudsync = CreateHudSyncObj() 
}

public plugin_precache()
{
	if(strlen(CONNECT_SOUNDS[putinserver_admin]))
		precache_sound(CONNECT_SOUNDS[putinserver_admin])
		
	if(strlen(CONNECT_SOUNDS[putinserver_player]))	
		precache_sound(CONNECT_SOUNDS[putinserver_player])

	precache_sound( "misc/seeyou.wav")
    	precache_sound( "misc/police2.wav")
}

public client_connect(id)
	g_connecttime[id][0] = get_gametime()

public client_putinserver(id)
{
	if(is_user_bot(id))
		return
		
	g_connecttime[id][1] = get_gametime()
	set_task(2.0, "task_client_connected", id)
}

public client_disconnect(id) 
{
	if(is_user_bot(id))
		return
	
	g_connecttime[id][0] = get_gametime()
	set_task(0.5, "task_client_disconnected", id)
}

public task_client_connected(id)
{
	new admin = is_user_admin(id)

	static sound[32]
	format(sound, 31, CONNECT_SOUNDS[admin ? putinserver_admin : putinserver_player])
	
	if(strlen(sound) > 0)
		client_cmd(0, "spk %s", sound)
		
	static putinserver_message[192]
	format(putinserver_message, 191, CONNECT_MESSAGES[admin ? putinserver_admin : putinserver_player])	
		
	if(strlen(putinserver_message) > 0)
	{
		new Float:connecttime = g_connecttime[id][1] - g_connecttime[id][0]
		
		static connecttime_str[4]
		float_to_str(connecttime, connecttime_str, 3)
		
		static temp[8]
		static rank[8]
		new position = get_user_stats(id, temp, temp)
		num_to_str(position, rank, 7)
		
		static name[32]
		get_user_name(id, name, 31)
		
		replace(putinserver_message, 191, "{name}",	name)
		replace(putinserver_message, 191, "{rankpos}",	rank)
		replace(putinserver_message, 191, "{connecttime}", connecttime_str)
		replace_all(putinserver_message, 191, "\n", "^n")
		
		static color[3]
		for(new i = 0; i < 3; ++i)
			color[i] = MESSAGES_COLOR[admin ? putinserver_admin : putinserver_player][i]
		
		set_hudmessage(color[0], color[1], color[2], 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
		ShowSyncHudMsg(0, g_hudsync, putinserver_message)
	}
}

public task_client_disconnected(id)
{
	new admin = is_user_admin(id)

	static sound[32]
	format(sound, 31, CONNECT_SOUNDS[admin ? putinserver_admin : putinserver_player])
	
	if(strlen(sound) > 0)
		client_cmd(0, "spk %s", sound)
		
	static disconnect_message[192]
	format(disconnect_message, 191, CONNECT_MESSAGES[admin ? disconnect_admin : disconnect_player])	
		
	if(strlen(disconnect_message) > 0)
	{
		new Float:playtime = (g_connecttime[id][0] - g_connecttime[id][1]) / 60.0
		
		static playtime_str[5]
		float_to_str(playtime, playtime_str, 4)
		
		static temp[8]
		static rank[8]
		new position = get_user_stats(id, temp, temp)
		num_to_str(position, rank, 7)
		
		static name[32]
		get_user_name(id, name, 31)
		
		replace(disconnect_message, 191, "{name}",	name)
		replace(disconnect_message, 191, "{rankpos}",	rank)
		replace(disconnect_message, 191, "{playtime}",	playtime_str)
		replace_all(disconnect_message, 191, "\n", "^n")
		
		static color[3]
		for(new i = 0; i < 3; ++i)
			color[i] = MESSAGES_COLOR[admin ? disconnect_admin : disconnect_player][i]
		
		set_hudmessage(color[0], color[1], color[2], 0.10, 0.55, 0, 6.0, 6.0, 0.5, 0.15, 3)
		ShowSyncHudMsg(0, g_hudsync, disconnect_message)
	}
}
__________________

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

One line 149

change it to

PHP Code:
format(sound31CONNECT_SOUNDS[admin disconnect_admin disconnect_player]) 
Also in the plugin_precache() to:

PHP Code:
public plugin_precache()
{
    if(
strlen(CONNECT_SOUNDS[putinserver_admin]) > 0)
        
precache_sound(CONNECT_SOUNDS[putinserver_admin])
        
    if(
strlen(CONNECT_SOUNDS[putinserver_player]) > 0)    
        
precache_sound(CONNECT_SOUNDS[putinserver_player])
        
    if(
strlen(CONNECT_SOUNDS[disconnect_admin]) > 0)
        
precache_sound(CONNECT_SOUNDS[disconnect_admin])
        
    if(
strlen(CONNECT_SOUNDS[disconnect_player]) > 0)    
        
precache_sound(CONNECT_SOUNDS[disconnect_player])    

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

Last edited by Cheap_Suit; 03-01-2007 at 02:55.
Cheap_Suit 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 17:53.


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