Counter-Strike

[AMXX] Name Prefix (AutoTAG)

Submitted by geti, , Thread ID: 77041

Thread Closed
25-02-2018, 12:31 AM
#1
Emri i Plugin: Name Prefix (AutoTAG) Autor: Freesh Onee Version: 1.0a Pershkrimi: Ky plugin bashkangjit nje prefix/tag tek cdo lojtar ne server. Komanda(cvar): mp_client_prefix - prefix i lojtarit Source code:


#include<amxmodx>
#include<amxmisc>

newg_cvar;

public
plugin_init(){
g_cvar=register_cvar("mp_client_prefix","Prefix|");
register_message(get_user_msgid("SayText"),"msg_SayText")
}

public
client_putinserver(id){
new
szPrefix[40];
get_pcvar_string(g_cvar,szPrefix,charsmax(szPrefix)-1);

static
szOldName[33];
get_user_name(id,szOldName,charsmax(szOldName)-1);

static
szName[33];
get_user_info(id,"name",szName,charsmax(szName)-1);

new
the_name[40];
formatex(the_name,charsmax(the_name)-1,"%s%s",szPrefix,szName);

if(
is_user_connected(id)){
if(
contain(szOldName,szPrefix)!=-1)return;
set_user_info(id,"name",the_name);
}
}

public
client_infochanged(id){
if(!
is_user_connected(id))returnPLUGIN_HANDLED;

new
szPrefix[40];
get_pcvar_string(g_cvar,szPrefix,charsmax(szPrefix)-1);

static
szName[33];
get_user_info(id,"name",szName,charsmax(szName)-1);

static
szOldName[33];
get_user_name(id,szOldName,charsmax(szOldName)-1);

new
the_name[40];
formatex(the_name,charsmax(the_name)-1,"%s%s",szPrefix,szName);

if(
szOldName[0]){
if(!
equal(szName,szOldName)){
if(
contain(szName,szPrefix)!=-1)returnPLUGIN_HANDLED;

set_user_info(id,"name",the_name);

client_print(0,print_chat,"%schangedhisnamein%s.",szOldName,the_name);
return
PLUGIN_HANDLED;
}
}
return
PLUGIN_CONTINUE;
}

public
msg_SayText(msg_id,msg_dest,msg_entity){
new
arg2[32]
get_msg_arg_string(2,arg2,charsmax(arg2))

staticconst
szNameChange[]="#Cstrike_Name_Change"

if(equal(arg2,szNameChange))returnPLUGIN_HANDLED

returnPLUGIN_CONTINUE
}

Users browsing this thread: 2 Guest(s)