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

Need help with VIP connect


Post New Thread Reply   
 
Thread Tools Display Modes
LaineN
Veteran Member
Join Date: Mar 2008
Location: Sweden
Old 04-20-2008 , 03:07   Re: Need help with VIP connect
Reply With Quote #21

Quote:
Originally Posted by atomen View Post
Try this
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define ON_CONNECT
//#define PRINT_CHAT

#if defined ON_CONNECT
 #include <fakemeta>
#endif

new const PLUGIN_NAME[] = "VIP Connect"
new const PLUGIN_VERSION[] = "1.0"
new const PLUGIN_AUTHOR[] = "Atomen"

#define ADMIN_LEVEL ADMIN_LEVEL_B

new sound_prepcvarname[32]

#if defined PRINT_CHAT
 
new const MESSAGE[] = "^x04[VIP] ^x01%s has ^x04connected ^x01to the server"
#else
 
new const MESSAGE[] = "[VIP] %s has connected to the server"
#endif

public plugin_init()
{
    
//Register Plugin
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)

    
//Register Event
    #if defined ON_CONNECT
    
register_forward(FM_ClientConnect,"FM_Client_Connect")
    
#endif
    
pcvar register_cvar("amx_vip""1")
}

public 
plugin_precache()
{
    if(
get_pcvar_num(pcvar))
        
sound_pre precache_sound("valve/sound/buttons/bell1.wav")
}

#if defined ON_CONNECT
public FM_Client_Connect(id)
{
    if(
get_pcvar_num(pcvar))
    {
        if(
get_user_flags(id) & ADMIN_LEVEL)
        {
            
get_user_name(idname31)

            
#if defined PRINT_CHAT
             
join_print(id)
            
#else
             
set_hudmessage(255255255, -1.00.3206.05.0)
             
show_hudmessage(0MESSAGEname)
            
#endif

            
client_cmd(0"speak %s"sound_pre)
        }
    }
}

#else
public client_putinserver(id)
{
    if(
get_pcvar_num(pcvar))
    {
        if(
get_user_flags(id) & ADMIN_LEVEL)
        {
            
get_user_name(idname31)

            
#if defined PRINT_CHAT
             
join_print(id)
            
#else
             
set_hudmessage(255255255, -1.00.3206.05.0)
             
show_hudmessage(0MESSAGEname)
            
#endif

            
client_cmd(0"speak %s"sound_pre)
        }
    }
}
#endif

#if defined PRINT_CHAT
stock join_print(id, {Float,Sql,Result,_}:...)
{
    new 
finalmsg[192]
    
formatex(finalmsg191"%s"MESSAGEname[id])
    
message_begin(MSG_ALLget_user_msgid("SayText"))
    
write_byte(id)
    
write_string(finalmsg)
    
message_end()
}
#endif 
No sound...
Please try to edit
LaineN is offline
Godofwar
AlliedModders Donor
Join Date: Dec 2015
Location: Germany
Old 04-30-2016 , 08:50   Re: Need help with VIP connect
Reply With Quote #22

Quote:
#include <amxmodx>
#include <amxmisc>

#define ON_CONNECT
//#define PRINT_CHAT

#if defined ON_CONNECT
#include <fakemeta>
#endif

new const PLUGIN_NAME[] = "VIP Connect"
new const PLUGIN_VERSION[] = "1.0"
new const PLUGIN_AUTHOR[] = "Atomen"

#define ADMIN_LEVEL ADMIN_LEVEL_B

new sound_pre, pcvar, name[32]

#if defined PRINT_CHAT
new const MESSAGE[] = "^x04[VIP] ^x01%s has ^x04connected ^x01to the server"
#else
new const MESSAGE[] = "[VIP] %s has connected to the server"
#endif

public plugin_init()
{
//Register Plugin
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

//Register Event
#if defined ON_CONNECT
register_forward(FM_ClientConnect,"FM_Client_Connect")
#endif
pcvar = register_cvar("amx_vip", "1")
}

public
plugin_precache()
{
if(
get_pcvar_num(pcvar))
sound_pre = precache_sound("valve/sound/buttons/bell1.wav")
}

#if defined ON_CONNECT
public FM_Client_Connect(id)
{
if(
get_pcvar_num(pcvar))
{
if(
get_user_flags(id) & ADMIN_LEVEL_B)
{
get_user_name(id, name, 31)

#if defined PRINT_CHAT
join_print(id)
#else
set_hudmessage(255, 255, 255, -1.0, 0.32, 0, 6.0, 5.0)
show_hudmessage(0, MESSAGE, name)
#endif

client_cmd(0, "speak %s", sound_pre)
}
}
}

#else
public client_putinserver(id)
{
if(
get_pcvar_num(pcvar))
{
if(
get_user_flags(id) & ADMIN_LEVEL_B)
{
get_user_name(id, name, 31)

#if defined PRINT_CHAT
join_print(id)
#else
set_hudmessage(255, 255, 255, -1.0, 0.32, 0, 6.0, 5.0)
show_hudmessage(0, MESSAGE, name)
#endif

client_cmd(0, "speak %s", sound_pre)
}
}
}
#endif

#if defined PRINT_CHAT
stock join_print(id, {Float,Sql,Result,_}:...)
{
new
finalmsg[192]
formatex(finalmsg, 191, "%s", MESSAGE, name[id])
message_begin(MSG_ALL, get_user_msgid("SayText"))
write_byte(id)
write_string(finalmsg)
message_end()
}
#endif
DONT WORK - NOTHING happens... When i join server nothing. no sound, no "connected the server" nothing...

Last edited by Godofwar; 04-30-2016 at 08:51.
Godofwar is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 04-30-2016 , 09:07   Re: Need help with VIP connect
Reply With Quote #23

This :

PHP Code:

#include <amxmodx> 

#define PLUGIN "Vip Connect MSG And sound" 
#define VERSION "1.0" 
#define AUTHOR "alliedmods" 

public plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR

 
public 
client_putinserver(id) { 
    if(
get_user_flags(id) & ADMIN_LEVEL_B){ 
    new 
name[32
    
get_user_name(idname31
    
set_hudmessage(255255255, -1.00.25010.010.00.80.81
    
show_hudmessage(0"VIP: %s has joined the server!"name
    
client_cmd(0"spk buttons/bell1.wav"
    } 

siriusmd99 is offline
Old 11-21-2017, 10:30
ZEDD_Intensity
This message has been deleted by ZEDD_Intensity.
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 11-23-2017 , 12:39   Re: Need help with VIP connect
Reply With Quote #24

Quote:
Originally Posted by ZEDD_Intensity View Post
Greetings siriusmd99,

Great job on this code as this is exactly what I was looking for, but would it be possible to print the "VIP: %s has joined the server!", name) message in the normal chat with VIP as the red color and everything else as green?

Just like :
VIP: AlliedModders has joiend the server!

Would be much appreciated.

Regards,
ZEDD
I believe its possible and one who is good at scripting, can do it in few secs.
Alber9091 is offline
silsfocs
Member
Join Date: Oct 2016
Location: Ocidental Praia Lusitana
Old 11-23-2017 , 13:21   Re: Need help with VIP connect
Reply With Quote #25

PHP Code:
#include <amxmodx>
#include <colorchat>

#define PLUGIN "Vip Connect MSG And sound" 
#define VERSION "1.0" 
#define AUTHOR "alliedmods" 

public plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR

 
public 
client_putinserver(id) { 
    if(
get_user_flags(id) & ADMIN_LEVEL_B){ 
    new 
name[32
    
get_user_name(idname31
    
ColorChat(0RED,"VIP: ^4%s has joined the server!"name
    
client_cmd(0"spk buttons/bell1.wav"
    } 

Put the include colorchat in your scripting/include folder
Get it here: https://forums.alliedmods.net/showthread.php?t=293174
Then compile the code

Last edited by silsfocs; 11-23-2017 at 13:30.
silsfocs 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 03:48.


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