AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can somebody add a cvar on this plugin (https://forums.alliedmods.net/showthread.php?t=84744)

petrov_belota 01-31-2009 09:38

Can somebody add a cvar on this plugin
 
Hi all :)
Can somebody help me to compete one plugin ?
I have rewrite one plugin:


PHP Code:

#include <amxmodx>
#include <fakemeta>
#define PLUGIN_NAME "No_Name"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "Volta"
new const g_reason[] = "[AMXX] Sorry, name change isn't allowed on this server !"
new const g_name[] = "name"
public plugin_init() {
 
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
 
register_forward(FM_ClientUserInfoChanged"fwClientUserInfoChanged")
}
public 
fwClientUserInfoChanged(idbuffer) {
 if (!
is_user_connected(id))
  return 
FMRES_IGNORED
 
static name[32], val[32]
 
get_user_name(idnamesizeof name 1)
 
engfunc(EngFunc_InfoKeyValuebufferg_namevalsizeof val 1)
 if (
equal(valname))
  return 
FMRES_IGNORED
 engfunc
(EngFunc_SetClientKeyValueidbufferg_namename)
 
console_print(id"%s"g_reason)
 
set_hudmessage(255000.300.4106.07.0
  
show_hudmessage(0"[AMXX] V tozi server nemojete da si smenqte imeto"
 return 
FMRES_SUPERCEDE





But I want to have time durring player can change his name ....
And the time to be
determined by cvar command ?!?
Pls help me :(

ConnorMcLeod 01-31-2009 09:46

Re: Can somebody add a cvar on this plugin
 
Time after the player has joined ?
Time after new round ?
Time after the player has spawned ?
Time after what ? :mrgreen:

petrov_belota 01-31-2009 09:50

Re: Can somebody add a cvar on this plugin
 
Quote:

Originally Posted by ConnorMcLeod (Post 753190)
Time after the player has joined ?
Time after new round ?
Time after the player has spawned ?
Time after what ? :mrgreen:

First one :D (Time after the player has joined )
And when this time is еnd the players in server
to be are NOT allowed to change names
10x in advance

sianbg 01-31-2009 10:52

Re: Can somebody add a cvar on this plugin
 
Why you dont use One change name plugin ?!?

petrov_belota 01-31-2009 10:59

Re: Can somebody add a cvar on this plugin
 
Quote:

Originally Posted by sianbg (Post 753222)
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 :(

ConnorMcLeod 01-31-2009 13:11

Re: Can somebody add a cvar on this plugin
 
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



petrov_belota 01-31-2009 13:31

Re: Can somebody add a cvar on this plugin
 
@ConnorMcLeod
10x for plugin but I cant compile the plugin 0.0
It gives me an error 0.0
Can you add a hud massage + fix the error PLS :(

xPaw 01-31-2009 13:41

Re: Can somebody add a cvar on this plugin
 
change
PHP Code:

new g_iCanChange[MAX_PLAYERS+1]

// -->

new g_iCantChange[MAX_PLAYERS+1


ConnorMcLeod 01-31-2009 13:45

Re: Can somebody add a cvar on this plugin
 
updated.

petrov_belota 01-31-2009 13:49

Re: Can somebody add a cvar on this plugin
 
Super :)
The plugin worked perfect :)
10x you are a cool guy :)
Have a + karma dude ;)


All times are GMT -4. The time now is 01:47.

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