Raised This Month: $ Target: $400
 0% 

Can somebody add a cvar on this plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
petrov_belota
Member
Join Date: Mar 2008
Old 01-31-2009 , 10:59   Re: Can somebody add a cvar on this plugin
Reply With Quote #1

Quote:
Originally Posted by sianbg View Post
Why you dont use One change name plugin ?!?
I need plugin who prohibits on players to change names and when player try to change his name to write Hud massage on the center and to have a cvar command determined time wich players can change the names ...
after join :]
Please I realy need this plugin
petrov_belota is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-31-2009 , 13:11   Re: Can somebody add a cvar on this plugin
Reply With Quote #2

Set to 30sec, change it for your needs.

PHP Code:
#include <amxmodx>

#define MAX_PLAYERS 32

new bool:g_bForceChange[MAX_PLAYERS+1]
new 
g_iCantChange[MAX_PLAYERS+1]
new 
g_pCvarChangeTime

public plugin_init()
{
    
register_plugin("One Name""1.0""Amxx Community")

    
g_pCvarChangeTime register_cvar("amx_change_name""30")

    
register_message(get_user_msgid("SayText") , "Message_SayText")
}

public 
client_putinserverid )
{
    
g_iCantChange[id] = get_systime() + get_pcvar_num(g_pCvarChangeTime)
}

public 
Message_SayText(msg_idmsg_destmsg_entity)
{
    new 
szArg[21]
    
get_msg_arg_string(2szArgcharsmax(szArg))
    if( 
Equal(szArg"#Cstrike_Name_Change") && g_iCantChange[get_msg_arg_int(1)] < get_systime())
        return 
PLUGIN_HANDLED

    
return PLUGIN_CONTINUE
}

public 
client_infochanged(id
{
    if( 
g_iCantChange[id] > get_systime() )
    {
        return
    }

    if(
g_bForceChange[id])
    {
        
g_bForceChange[id] = false
        
return
    }

    if(
is_user_connected(id))
    {
        static 
szNewName[32], szOldName[32]
        static const 
szNameInfo[] = "name"
        
get_user_info(idszNameInfoszNewNamecharsmax(szNewName))
        
get_user_name(idszOldNamecharsmax(szOldName))

        if( !
Equal(szOldNameszNewName) )
        {
            
g_bForceChange[id] = true
            client_print
(idprint_chat"** You are not allowed to change your name")
            
set_user_info(idszNameInfoszOldName)
        }
    } 
}

Equal(const szA[], const szB[])
{
    static 
a0

    a 
szA[i]
    do
    {
        if( 
!= szB[i])
            return 
0
    
}
    while( (
szA[++i]) )

    return 
1

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 01-31-2009 at 13:45.
ConnorMcLeod 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 01:47.


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