Raised This Month: $ Target: $400
 0% 

Can somebody add a cvar on this plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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 #6

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
 



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


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