Jump to content
GIGN Forum

Recommended Posts

Lazda jautājums bija "Lai nevarētu" nevis, lai to darītu admins. :D anyway vari ieprovēt šito!

/* AMX Mod X
*   No Name Change
*
* (c) Copyright 2006-2007 by VEN
*
* This file is provided as is (no warranties)
*
*    DESCRIPTION
*        Plugin fully restricts name change on a server.
*
*    VERSIONS
*        0.1.1
*            now name command/setinfo fileds will be restored after name change attempt
*        0.1
*            first release
*
*    CREDITS
*        rattle - plugin request [ http://forums.alliedmods.net/showthread.php?t=47824 ]
*/

// plugin's main information
#define PLUGIN_NAME "No Name Change"
#define PLUGIN_VERSION "0.1.1"
#define PLUGIN_AUTHOR "VEN"

#include <amxmodx>
#include <fakemeta>

new const g_clcmd_template[] = "name ^"%s^"; setinfo name ^"%s^""
new const g_name[] = "name"

public plugin_init() {
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
    register_forward(FM_ClientUserInfoChanged, "fwClientUserInfoChanged")
}

public fwClientUserInfoChanged(id, buffer) {
    if (!is_user_connected(id))
        return FMRES_IGNORED

    static name[32], val[32]
    get_user_name(id, name, sizeof name - 1)
    engfunc(EngFunc_InfoKeyValue, buffer, g_name, val, sizeof val - 1)
    if (equal(val, name))
        return FMRES_IGNORED

    engfunc(EngFunc_SetClientKeyValue, id, buffer, g_name, name)
    client_cmd(id, g_clcmd_template, name, name)
    client_print(id, print_chat, "[NNC] Sorry, name change isn't allowed on this server")

    return FMRES_SUPERCEDE
}

Edited by amnezija
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...