la restrictednames ma refer vreau cand un player intra cu numele care l-am pus eu in zp_restrictednames.ini sa fie interzis vreau sa-i schimbe numele in IP-ul dela server el este setat acuma sa-l schimbe in DNS
sursa
- | Afiseaza codul
#include < amxmodx > #include < amxmisc > #include < cstrike > #include < fakemeta > #pragma tabsize 0; #if AMXX_VERSION_NUM < 183 #assert AMX Mod X v1.8.3 or later library required! #endif new PlayerTag [33] [32], bool: PlayerHasTag [33], File [128], RestrictedNames [256] [32], WordsCount; new const BlockTexts [ ] [] = { "#", "$", "%" }; public plugin_init ( ) { register_forward ( FM_ClientUserInfoChanged, "fwClientInfoChanged" ); register_concmd ( "amx_reloadtags", "cmdReloadTags" ); register_clcmd ( "say", "CheckSay" ); register_clcmd ( "say_team", "CheckSayTeam" ); new File, Director [512], Line [32]; get_localinfo ( "amxx_configsdir", Director, charsmax ( Director ) ); format ( Director, charsmax ( Director ), "%s/zp_restrictednames.ini", Director ); File = fopen ( Director, "rt" ); while ( !feof ( File ) ) { fgets ( File, Line, charsmax ( Line ) ); trim ( Line ); if ( strlen ( Line ) ) { copy ( RestrictedNames [WordsCount], 31, Line ); WordsCount++; } } fclose ( File ); } public plugin_precache ( ) { get_configsdir ( File, charsmax ( File ) ); formatex ( File, charsmax ( File ), "%s/tags.ini", File ); if ( !file_exists ( File ) ) write_file ( File, ";^"EnTeR_^" ^"Dev. #^"", -1 ); } public fwClientInfoChanged ( id, Buffer ) { if ( !is_user_connected ( id ) ) return FMRES_IGNORED; new NewName [32], OldName [32]; get_user_name ( id, OldName, charsmax ( OldName ) ) engfunc ( EngFunc_InfoKeyValue, Buffer, "name", NewName, charsmax ( NewName ) ); if ( !equal ( OldName, NewName ) ) { set_task ( 1.0, "TaskCheckName", id ); set_task ( 0.1, "LoadPlayerTag", id ); } return FMRES_IGNORED; } public TaskCheckName ( id ) { if ( is_user_connected ( id ) && !is_user_bot ( id ) && !is_user_hltv ( id ) ) { static Name [32], i; get_user_name ( id, Name, charsmax ( Name ) ); new HostName [64]; get_cvar_string ( "hostname", HostName, charsmax ( HostName ) ); for ( i = 0; i < WordsCount; i ++ ) { if ( containi ( Name, RestrictedNames ) != -1 ) { set_user_info ( id, "name", HostName ); break; } } } } public CheckSay ( id ) { if ( !is_user_connected ( id ) ) return PLUGIN_HANDLED_MAIN; new Args [194]; read_args ( Args, charsmax ( Args ) ) remove_quotes ( Args ); for ( new i = 0; i < sizeof ( BlockTexts ); i ++ ) { if ( containi ( Args, BlockTexts ) != -1 ) return PLUGIN_HANDLED; } new iAlive = is_user_alive ( id ); new CsTeams: iTeam = cs_get_user_team ( id ); new iPlayers [32], iNum; get_players ( iPlayers, iNum ); new Name [32]; get_user_name ( id, Name, charsmax ( Name ) ); new const Prefixes [2] [CsTeams] [ ] = { { "^1*DEAD*^1 ", "^1*DEAD*^1 ", "^1*DEAD*^1 ", "^1*SPEC*^1 " }, { "", "", "", "" } }; new Message [192]; if ( PlayerHasTag [id] ) formatex ( Message, charsmax ( Message ), "%s^4%s^3 %s^4 :^1 %s", Prefixes [iAlive] [iTeam], PlayerTag [id], Name, Args ); else formatex ( Message, charsmax ( Message ), "%s^3%s^4 :^1 %s", Prefixes [iAlive] [iTeam], Name, Args ); new iTarget; for( new i = 0; i < iNum; i ++ ) { iTarget = iPlayers ; if ( iTarget == id || ( iAlive || is_user_connected ( iTarget ) ) ) client_print_color ( iTarget, print_team_default, Message ); } return PLUGIN_HANDLED_MAIN; } public CheckSayTeam ( id ) { if ( !is_user_connected ( id ) ) return PLUGIN_HANDLED_MAIN; new Args [194]; read_args ( Args, charsmax ( Args ) ) remove_quotes ( Args ); for ( new i = 0; i < sizeof ( BlockTexts ); i ++ ) { if ( containi ( Args, BlockTexts ) != -1 ) return PLUGIN_HANDLED; } new iAlive = is_user_alive ( id ); new CsTeams: iTeam = CsTeams:( ( _:cs_get_user_team ( id ) ) % 3 ); new iPlayers [32], iNum; get_players ( iPlayers, iNum ); new Name [32]; get_user_name ( id, Name, charsmax ( Name ) ); new const Prefixes [2] [CsTeams] [ ] = { { "^4(^1Spectator^4)^1 ", "^1*DEAD*^4 (^1Terrorist^4)^1 ", "^1*DEAD*^4 (^1Counter-Terrorist^4)^1 ", "" }, { "^4(^1Spectator^4)^1 ", "^4(^1Terrorist^4)^1 ", "^4(^1Counter-Terrorist^4)^1 ", "" } }; new Message [192]; if ( PlayerHasTag [id]) formatex ( Message, charsmax ( Message ), "%s^4%s ^3%s^4 :^1 %s", Prefixes [iAlive] [iTeam], PlayerTag [id], Name, Args ); else formatex ( Message, charsmax ( Message ), "%s^3%s^4 :^1 %s", Prefixes [iAlive] [iTeam], Name, Args ); for ( new i = 0, iTeamMate; i < iNum; i ++ ) { iTeamMate = iPlayers ; if ( iTeamMate == id || ( iAlive || is_user_connected ( iTeamMate ) ) && CsTeams:( ( _:cs_get_user_team ( iTeamMate ) ) % 3 ) == iTeam ) client_print_color ( iTeamMate, print_team_default, Message ); } return PLUGIN_HANDLED_MAIN; } public client_putinserver ( id ) { if ( is_user_bot ( id ) || is_user_hltv ( id ) ) return PLUGIN_HANDLED; set_task ( 1.0, "TaskCheckName", id ); PlayerHasTag [id] = false; LoadPlayerTag ( id ); return PLUGIN_CONTINUE; } public cmdReloadTags ( id ) { if ( !( get_user_flags ( id ) & ADMIN_IMMUNITY ) ) return PLUGIN_CONTINUE; new Players [32], Num; get_players ( Players, Num, "c" ); for ( new i = 0 ; i < Num ; i ++ ) { PlayerHasTag [Players ] = false; LoadPlayerTag ( Players ); } console_print ( id, "* Tags have been loaded successfully !" ); return PLUGIN_HANDLED; } public LoadPlayerTag ( id ) { PlayerHasTag[ id ] = false; if ( !file_exists ( File ) ) write_file ( File, ";^"EnTeR_^" ^"Dev. #^"", -1 ); new FileOpen = fopen ( File, "rt" ); if ( !FileOpen ) return PLUGIN_CONTINUE; new Data [512], Buffer [2] [32]; while ( !feof ( FileOpen ) ) { fgets ( FileOpen, Data, charsmax ( Data ) ); if ( !Data [0] || Data [0] == ';' || ( Data [0] == '/' && Data [1] == '/' ) ) continue; parse ( Data, Buffer [0], charsmax ( Buffer [ ] ), Buffer [1], charsmax ( Buffer [ ] ) ) new Name [32]; get_user_name ( id, Name, charsmax ( Name ) ); if ( equal ( Name, Buffer [0] ) ) { PlayerHasTag [id] = true; copy ( PlayerTag [id], charsmax ( PlayerTag [ ] ), Buffer [1] ); break; } } return PLUGIN_CONTINUE; }
IP in care sa fie schimbat. 89.40.233.189:27015