Raised This Month: $404 Target: $400
 101% 

GHW Connect Messages


Post New Thread Reply   
 
Thread Tools Display Modes
priyojit
Member
Join Date: Nov 2013
Location: Kolkata
Old 10-09-2014 , 03:37   Re: GHW Connect Messages
Reply With Quote #101

#define VERSION "1.1"

#include <amxmodx>
#include <amxmisc>
#include <geoip>

#define SHOW_COLOR 1
#define SHOW_CONNECT 2
#define SHOW_DISCONNECT 4
#define PLAY_SOUND_CONNECT 8
#define PLAY_SOUND_DISCONNECT 16

new display_type_pcvar

new name[33][32]
new authid[33][32]
new country[33][46]
new ip[33][32]

new connect_soundfile[64]
new disconnect_soundfile[64]

new saytext_msgid

public plugin_init()
{
register_plugin("Connect Message",VERSION,"Arnab")
display_type_pcvar = register_cvar("cm_flags","31")
register_cvar("cm_connect_string","[-=|M[4]D|=-] %name (%steamid) has connected from (%country).")
register_cvar("cm_disconnect_string","[-=|M[4]D|=-] %name (%steamid) has disconnected from (%country).")

saytext_msgid = get_user_msgid("SayText")
}

public plugin_precache()
{
register_cvar("cm_connect_sound","buttons/bell1.wav")
register_cvar("cm_disconnect_sound","fvox/blip.wav")

get_cvar_string("cm_connect_sound",connect_so undfile,63)
get_cvar_string("cm_disconnect_sound",disconn ect_soundfile,63)

precache_sound(connect_soundfile)
precache_sound(disconnect_soundfile)
}

public client_putinserver(id)
{
if(!is_user_bot(id))
{
get_client_info(id)

new display_type = get_pcvar_num(display_type_pcvar)
if(display_type & SHOW_CONNECT)
{
new string[200]
get_cvar_string("cm_connect_string",string,19 9)
format(string,199,"^x01%s",string)

if(display_type & SHOW_COLOR)
{
new holder[46]

format(holder,45,"^x04%s^x01",name[id])
replace(string,199,"%name",holder)

format(holder,45,"^x04%s^x01",authid[id])
replace(string,199,"%steamid",holder)

format(holder,45,"^x04%s^x01",country[id])
replace(string,199,"%country",holder)

format(holder,45,"^x04%s^x01",ip[id])
replace(string,199,"%ip",holder)
}
else
{
replace(string,199,"%name",name[id])
replace(string,199,"%steamid",authid[id])
replace(string,199,"%country",country[id])
replace(string,199,"%ip",ip[id])
}

new num, players[32], player
get_players(players,num,"ch")
for(new i=0;i<num;i++)
{
player = players[i]

message_begin(MSG_ONE,saytext_msgid,{0,0,0},p layer)
write_byte(player)
write_string(string)
message_end()

if(display_type & PLAY_SOUND_CONNECT)
{
new stringlen = strlen(connect_soundfile)
if(connect_soundfile[stringlen - 1]=='v' && connect_soundfile[stringlen - 2]=='a' && connect_soundfile[stringlen - 3]=='w') //wav
{
client_cmd(player,"spk ^"sound/%s^"",connect_soundfile)
}
if(connect_soundfile[stringlen - 1]=='3' && connect_soundfile[stringlen - 2]=='p' && connect_soundfile[stringlen - 3]=='m') //wav
{
client_cmd(player,"mp3 play ^"sound/%s^"",connect_soundfile)
}
}
}
}
}
}

public get_client_info(id)
{
get_user_name(id,name[id],31)
get_user_authid(id,authid[id],31)

get_user_ip(id,ip[id],31)
geoip_country(ip[id],country[id])
if(equal(country[id],"error"))
{
if(contain(ip[id],"192.168.")==0 || equal(ip[id],"127.0.0.1") || contain(ip[id],"10.")==0 || contain(ip[id],"172.")==0)
{
country[id] = "LAN"
}
if(equal(ip[id],"loopback"))
{
country[id] = "ListenServer User"
}
else
{
country[id] = "Unknown Country"
}
}
}

public client_infochanged(id)
{
if(!is_user_bot(id))
{
get_user_info(id,"name",name[id],31)
}
}

public client_disconnect(id)
{
if(!is_user_bot(id))
{
new display_type = get_pcvar_num(display_type_pcvar)
if(display_type & SHOW_DISCONNECT)
{
new string[200]
get_cvar_string("cm_disconnect_string",string ,199)
format(string,199,"^x01%s",string)

if(display_type & SHOW_COLOR)
{
new holder[46]

format(holder,45,"^x04%s^x01",name[id])
replace(string,199,"%name",holder)

format(holder,45,"^x04%s^x01",authid[id])
replace(string,199,"%steamid",holder)

format(holder,45,"^x04%s^x01",country[id])
replace(string,199,"%country",holder)

format(holder,45,"^x04%s^x01",ip[id])
replace(string,199,"%ip",holder)
}
else
{
replace(string,199,"%name",name[id])
replace(string,199,"%steamid",authid[id])
replace(string,199,"%country",country[id])
replace(string,199,"%ip",ip[id])
}

new num, players[32], player
get_players(players,num,"ch")
for(new i=0;i<num;i++)
{
player = players[i]

message_begin(MSG_ONE,saytext_msgid,{0,0,0},p layer)
write_byte(player)
write_string(string)
message_end()

new stringlen = strlen(disconnect_soundfile)
if(disconnect_soundfile[stringlen - 1]=='v' && disconnect_soundfile[stringlen - 2]=='a' && disconnect_soundfile[stringlen - 3]=='w') //wav
{
client_cmd(player,"spk ^"sound/%s^"",disconnect_soundfile)
}
if(disconnect_soundfile[stringlen - 1]=='3' && disconnect_soundfile[stringlen - 2]=='p' && disconnect_soundfile[stringlen - 3]=='m') //wav
{
client_cmd(player,"mp3 play ^"sound/%s^"",disconnect_soundfile)
}
}
}
}
}

----------------------------------------------------------------------------------------------------------------------------

I can't compile it please help me i am using Notepad++ Allied Modders Version but i can't
priyojit is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-09-2014 , 04:06   Re: GHW Connect Messages
Reply With Quote #102

Priyojit, do you know how to compile it locally?
__________________
Problem with ZP?
ZP Helper!

Last edited by zmd94; 12-07-2014 at 05:46.
zmd94 is offline
feifei
Senior Member
Join Date: Sep 2014
Location: India
Old 10-09-2014 , 05:23   Re: GHW Connect Messages
Reply With Quote #103

Quote:
Originally Posted by zmd94 View Post
Just change this:
PHP Code:
    register_cvar("cm_connect_sound","sound/yo.wav")
    
register_cvar("cm_disconnect_sound","sound/yo.wav"
-->
PHP Code:
    register_cvar("cm_connect_sound","yo.wav")
    
register_cvar("cm_disconnect_sound","yo.wav"
ohhhhhhh..... :/

and I will paste yo.wav file in to-> HLDS\steamapps\common\Half-Life\cstrike\sound folder right ??
__________________
MaTriX is my life
Visit Here ;) For ZP MODs
feifei is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-09-2014 , 06:05   Re: GHW Connect Messages
Reply With Quote #104

Yes, feifei. ;)
__________________
Problem with ZP?
ZP Helper!
zmd94 is offline
feifei
Senior Member
Join Date: Sep 2014
Location: India
Old 10-10-2014 , 07:06   Re: GHW Connect Messages
Reply With Quote #105

Quote:
Originally Posted by zmd94 View Post
Yes, feifei. ;)
ty
__________________
MaTriX is my life
Visit Here ;) For ZP MODs
feifei is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-10-2014 , 14:12   Re: GHW Connect Messages
Reply With Quote #106

Nevermind. ;)
__________________
Problem with ZP?
ZP Helper!

Last edited by zmd94; 12-07-2014 at 05:46.
zmd94 is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 06-14-2015 , 10:31   Re: GHW Connect Messages
Reply With Quote #107

ples update for city connect !
abdobiskra is offline
Send a message via Skype™ to abdobiskra
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 06-14-2015 , 10:33   Re: GHW Connect Messages
Reply With Quote #108

ples update for city connect ! like this
Attached Files
File Type: sma Get Plugin or Get Source (CityConnect.sma - 249 views - 4.4 KB)
abdobiskra is offline
Send a message via Skype™ to abdobiskra
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 12-19-2015 , 10:32   Re: GHW Connect Messages
Reply With Quote #109

There is a little bug at public get_client_info(id), its if's should be by an else if as fallows:

Code:
public get_client_info(id) {     get_user_name(id,name[id],31)     get_user_authid(id,authid[id],31)     get_user_ip(id,ip[id],31)     geoip_country(ip[id],country[id])     if(equal(country[id],"error"))     {         if(contain(ip[id],"192.168") == 0 || equal(ip[id],"127.0.0.1") || contain(ip[id],"10.")==0 ||  contain(ip[id],"172.")==0)         {             country[id] = "LAN"         }
        else  if(equal(ip[id],"loopback"))
        {             country[id] = "ListenServer User"         }         else         {             country[id] = "Unknown Country"         }     } }
Attached Files
File Type: sma Get Plugin or Get Source (GHW_connect.sma - 211 views - 6.9 KB)

Last edited by addons_zz; 07-25-2016 at 00:09. Reason: highlighting
addons_zz is offline
Joce93
Senior Member
Join Date: Feb 2016
Old 02-10-2016 , 10:21   Re: GHW Connect Messages
Reply With Quote #110

Hi. I'm using this amxx plugin and it works great !
Now i just want to disable the default's line "XXXX has joined the game/left the game" because i see 2 messages when somebody joins or leaves the server. Can anyone help me ?
Joce93 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 17:49.


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