Offline |
|
|
Csatlakozott: 2013.05.14. 21:07 Hozzászólások: 117
Megköszönt másnak: 39 alkalommal Megköszönték neki: 1 alkalommal
|
Tokione írta: Azt a plugint keresem amelyik ki írja emberek elé hogy PL: [ADMIN]Torta [STEAM]Süti [NON~STEAM]Kenyér és úgy legyen hogy ne 2x írjon egyszer úgy simán Süti:asd majd [STEAM]Süti:asd Aki segít megy a GOMB! Steames előtag #include <amxmodx> #include <amxmisc> #define PLUGIN "STEAM Players" #define VERSION "0.0b" #define AUTHOR "Quit edit" #define ACCESS_LEVEL ADMIN_CVAR #define ADMIN_LISTEN ADMIN_RCON new message[192] new sayText new teamInfo new maxPlayers new show_ip,show_steamid,show_time,show_ping,show_loss; new g_MessageColor new g_NameColor new g_AdminListen new strName[191] new strText[191] new alive[11] public plugin_init() { register_plugin (PLUGIN , VERSION , AUTHOR) g_MessageColor = register_cvar ("amx_color", "1") g_NameColor = register_cvar ("amx_namecolor", "6") g_AdminListen = register_cvar ("amx_listen", "1") show_ip = register_cvar("sp_showip","0") show_steamid = register_cvar("sp_showsteamid","1") show_time = register_cvar("sp_showtime","0") show_ping = register_cvar("sp_showping","0") show_loss = register_cvar("sp_showloss","0") sayText = get_user_msgid ("SayText") teamInfo = get_user_msgid ("TeamInfo") maxPlayers = get_maxplayers() register_message (sayText, "det_duplicated") register_clcmd ("amx_color", "set_color", ACCESS_LEVEL, "<color>") register_clcmd ("amx_namecolor", "set_name_color", ACCESS_LEVEL, "<color>") register_clcmd ("amx_listen", "set_listen", ACCESS_LEVEL, "<1 | 0>") register_clcmd ("say /steamosok", "who_steam") register_clcmd ("say /sp", "who_steam") register_clcmd ("say /steamosjatekosok", "who_steam") register_clcmd ("say", "hook_say") register_clcmd ("say_team", "hook_teamsay") } public det_duplicated (msgId, msgDest, receiver) { return PLUGIN_HANDLED } public who_steam(id) { new bool:ip_showed = false new bool:steamid_showed = false new bool:time_showed = false new bool:ping_showed = false new bool:loss_showed = false if (get_pcvar_num(show_ip)>0) { ip_showed = true } if (get_pcvar_num(show_steamid)>0) { steamid_showed = true } if (get_pcvar_num(show_time)>0) { time_showed = true } if (get_pcvar_num(show_ping)>0) { ping_showed = true } if (get_pcvar_num(show_loss)>0) { loss_showed = true } new players[32], playersFound get_players(players,playersFound) new pos, message[2048] new name[40], ip[30],steamid[32], ping, loss; new str_pt[6],str_pi[6],str_lo[6] pos += format(message[pos],2048 - pos,"<STYLE>body{background:#232323;color:#cfcbc2;margin:20px}table{width:100%%;line-height:160%%;font-size:12px}th{background:#2f3030;color:#c4b550;text-align:left}.q{border:2px solid #4a4945}tr{background:#4a4945}.b{background:#3b3b37}</STYLE>") for (new i = 0;i < playersFound;i++) { new bool:steam = false if (is_user_steam(id)) steam = true new bool:bot = false if (is_user_bot(id)) bot = true get_user_name(players[i],name,39) get_user_ip(players[i],ip,29,1) get_user_authid(players[i], steamid, 31) num_to_str(get_user_time(players[i]),str_pt,5) get_user_ping(players[i],ping,loss) num_to_str(ping,str_pi,5) num_to_str(loss,str_lo,5) pos += format(message[pos],2048 - pos,"%d.<font color=^"red^">%s</font> <font color=^"green^">%s</font>%s %s%s",i+1,name,steam?"[STEAM]":"",bot?"[BOT]":"",ip_showed?"IP:":"",ip_showed?ip:"") pos += format(message[pos],2048 - pos," %s%s %s%s",steamid_showed?"STEAMID:":"",steamid_showed?steamid:"",time_showed?"TIME:":"",time_showed?str_pt:"") pos += format(message[pos],2048 - pos," %s%s %s%s^n",ping_showed?"PING":"",ping_showed?str_pi:"",loss_showed?"LOSS:":"",loss_showed?str_lo:"") } show_motd(id,message,"STEAMOS Jatekosok") return PLUGIN_HANDLED } public hook_say(id) { read_args (message, 191) remove_quotes (message) if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, "")) return PLUGIN_CONTINUE new name[32] get_user_name (id, name, 31) new bool:steam = false if (is_user_steam(id)) steam = true new isAlive if (is_user_alive (id)) { isAlive = 1 alive = "^x01" } else { isAlive = 0 alive = "^x01" } static color[10] if (steam) { switch (get_pcvar_num (g_NameColor)) { case 1: format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name) case 2: format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name) case 3: { color = "SPECTATOR" format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name) } case 4: { color = "CT" format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name) } case 5: { color = "TERRORIST" format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name) } case 6: { get_user_team (id, color, 9) format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name) } } switch (get_pcvar_num (g_MessageColor)) { case 1: // Yellow format (strText, 191, "%s", message) case 2: // Green format (strText, 191, "^x04%s", message) case 3: // White { copy (color, 9, "SPECTATOR") format (strText, 191, "^x03%s", message) } case 4: // Blue { copy (color, 9, "CT") format (strText, 191, "^x03%s", message) } case 5: // Red { copy (color, 9, "TERRORIST") format (strText, 191, "^x03%s", message) } } } else { get_user_team (id, color, 9) format (strName, 191, "%s^x03%s", alive, name) format (strText, 191, "%s", message) } format (message, 191, "%s^x01: %s", strName, strText) sendMessage (color, isAlive) return PLUGIN_CONTINUE } public hook_teamsay(id) { new playerTeam = get_user_team(id) new playerTeamName[19] switch (playerTeam) { case 1: copy (playerTeamName, 11, "Terrorists") case 2: copy (playerTeamName, 18, "Counter-Terrorists") default: copy (playerTeamName, 9, "Spectator") } read_args (message, 191) remove_quotes (message) if (message[0] == '@' || message[0] == '/' || message[0] == '!' || equal (message, "")) return PLUGIN_CONTINUE new name[32] get_user_name (id, name, 31) new bool:steam = false if (is_user_steam(id)) steam = true new isAlive if (is_user_alive (id)) { isAlive = 1 alive = "^x01" } else { isAlive = 0 alive = "^x01" } static color[10] if (steam) { switch (get_pcvar_num (g_NameColor)) { case 1: format (strName, 191, "%s^x03%s ^x04[STEAM]", alive, name) case 2: format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name) case 3: { color = "SPECTATOR" format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name) } case 4: { color = "CT" format (strName, 191, "%s^x03%s ^x04[STEAM]", alive, name) } case 5: { color = "TERRORIST" format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name) } case 6: { get_user_team (id, color, 9) format (strName, 191, " ^x04[STEAM] %s^x03%s", alive, name) } } switch (get_pcvar_num (g_MessageColor)) { case 1: // Yellow format (strText, 191, "%s", message) case 2: // Green format (strText, 191, "^x04%s", message) case 3: // White { copy (color, 9, "SPECTATOR") format (strText, 191, "^x03%s", message) } case 4: // Blue { copy (color, 9, "CT") format (strText, 191, "^x03%s", message) } case 5: // Red { copy (color, 9, "TERRORIST") format (strText, 191, "^x03%s", message) } } } else { get_user_team (id, color, 9) format (strName, 191, "%s^x03%s", alive, name) format (strText, 191, "%s", message) } format (message, 191, "%s^x01: %s", strName, strText) sendTeamMessage (color, isAlive, playerTeam) return PLUGIN_CONTINUE } public set_color (id, level, cid) { if (!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED new arg[1], newColor read_argv (1, arg, 1) newColor = str_to_num (arg) if (newColor >= 1 && newColor <= 5) { set_cvar_num ("amx_color", newColor) set_pcvar_num (g_MessageColor, newColor) if (get_pcvar_num (g_NameColor) != 1 && ((newColor == 3 && get_pcvar_num (g_NameColor) != 3) || (newColor == 4 && get_pcvar_num (g_NameColor) != 4) || (newColor == 5 && get_pcvar_num (g_NameColor) != 5))) { set_cvar_num ("amx_namecolor", 2) set_pcvar_num (g_NameColor, 2) } } return PLUGIN_HANDLED } public set_name_color (id, level, cid) { if (!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED new arg[1], newColor read_argv (1, arg, 1) newColor = str_to_num (arg) if (newColor >= 1 && newColor <= 6) { set_cvar_num ("amx_namecolor", newColor) set_pcvar_num (g_NameColor, newColor) if ((get_pcvar_num (g_MessageColor) != 1 && ((newColor == 3 && get_pcvar_num (g_MessageColor) != 3) || (newColor == 4 && get_pcvar_num (g_MessageColor) != 4) || (newColor == 5 && get_pcvar_num (g_MessageColor) != 5))) || get_pcvar_num (g_NameColor) == 6) { set_cvar_num ("amx_color", 2) set_pcvar_num (g_MessageColor, 2) } } return PLUGIN_HANDLED } public set_listen (id, level, cid) { if (!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED new arg[1], newListen read_argv(1, arg, 1) newListen = str_to_num (arg) set_cvar_num ("amx_listen", newListen) set_pcvar_num (g_AdminListen, newListen) return PLUGIN_HANDLED } public sendMessage (color[], alive) { new teamName[10] for (new player = 1; player < maxPlayers; player++) { if (!is_user_connected(player)) continue if (alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN) { get_user_team (player, teamName, 9) changeTeamInfo (player, color) writeMessage (player, message) changeTeamInfo (player, teamName) } } } public sendTeamMessage (color[], alive, playerTeam) { new teamName[10] for (new player = 1; player < maxPlayers; player++) { if (!is_user_connected(player)) continue if (get_user_team(player) == playerTeam || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN) { if (alive && is_user_alive(player) || !alive && !is_user_alive(player) || get_pcvar_num(g_AdminListen) && get_user_flags(player) & ADMIN_LISTEN) { get_user_team (player, teamName, 9) changeTeamInfo (player, color) writeMessage (player, message) changeTeamInfo (player, teamName) } } } } public changeTeamInfo (player, team[]) { message_begin (MSG_ONE, teamInfo, _, player) write_byte (player) write_string (team) message_end() } public writeMessage (player, message[]) { message_begin (MSG_ONE, sayText, {0, 0, 0}, player) write_byte (player) write_string (message) message_end () } stock bool:is_user_steam(id) { static dp_pointer; if (dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider"))) { server_cmd("dp_clientinfo %d", id); server_exec(); return (get_pcvar_num(dp_pointer) == 2) ? true : false; } return false; }
Ha azt szeretnéd, hogy ne írjon 2x akkor vedd ki az admin_chat_colors plugint és mindent ami chatet használ Admin előtag: /* Copyright 2011 - 2012, m0skVi4a ;] Plugin created in Rousse, Bulgaria Plugin thread 1: Plugin thread 2: Original posted by m0skVi4a ;] Description: With this plugin you can set prefixes to Admins with special flags. Also Admins can put custom prefixes to them or to other players if they want, but only if they have the required flag. Commands: ap_reload_prefixes Reloads Prefixes' file from console without restarting the server. ap_reload_badprefixes Reloads Bad Prefixes' file from console without restarting the server. ap_put "prefix" Puts your prefix if you have the special flag. Or if there is no prefix typed, removes the prefix which you have. ap_put_player "name" "prefix" Puts prefix to the name you type if you have the special flag. Or if there is no prefix typed, removes the prefix which the player has. CVARS: "ap_bad_prefixes" - Is the Bad Prefixes option on(1) or off(0). Default: 1 "ap_listen" - Is the Admin Listen option on(1) or off(0). Default: 1 "ap_listen_flag" - The flag, needed for Listen option. Default: a "ap_custom_current" - Is the Custom Prefix option for each Admin is on(1) or off(0). Default: 1 "ap_custom_current_flag" - The flag, needed for setting custom prefix. Default: b "ap_custom_others" - Is the Custom Prefix Change option is on(1) or off(0). Default: 1 "ap_custom_others_flag" - The flag, needed for setting custom prefix to other players. Default: c "ap_say_characters" - Is the Start Say Characters option on(1) or off(0). Default: 1 "ap_prefix_characters" - Is the Checker for Characters in Custom Prefixes' Options on(1) or off(0). Default: 1 All CVARS are without quotes Credits: m0skVi4a ;] - for the idea, making and testing the plugin SpeeDeeR - for little help with the plugin Ant1Lamer - for testing the plugin Vasilii-Zaicev - for testing the plugin Changelog: April 22, 2012 - V1.0: - First Release May 19, 2012 - V2.0: - Full optimization - Added Bad Prefixes' file - Added Multi-Lingual file - Added IP and Name support in ap_prefixes.ini - Added Forbidden Say characters - New CVARS for setting the flags for each of the options May 29, 2012 - V2.1: - Fixed bug with some say or say_team commands are not executed June 26, 2012 - V2.2: - Fixed bug which blocks the default name change message in CS - Fixed bug with the white chat plugin which does not worked Visit: Contact me on: SKYPE: pa7ohin */ #include <amxmodx> #include <amxmisc> #include <nvault> #define FLAG_LOAD ADMIN_CFG #define MAX_PREFIXES 33 #define MAX_BAD_PREFIXES 100 new g_bad_prefix, g_listen, g_listen_flag, g_custom_current, g_custom_current_flag, g_custom_others, g_custom_others_flag, g_say_characters, g_prefix_characters; new pre_ips_count = 0, pre_names_count = 0, pre_flags_count = 0, bad_prefix_count = 0, i, temp_cvar[2]; new configs_dir[64], file[128], text[128], prefix[32], type[2], acc_type[32], length, line = 0, error[256]; new g_saytxt, g_maxplayers, g_nvault, g_team; new g_typed[192], g_message[192], g_name[32], typed_prefix[33]; new pre_ips_collect[MAX_PREFIXES][33], ips_collect[MAX_PREFIXES][32], pre_names_collect[MAX_PREFIXES][33], names_collect[MAX_PREFIXES][33], pre_flags_collect[MAX_PREFIXES][33], flags_collect[MAX_PREFIXES][2], bad_prefixes_collect[MAX_BAD_PREFIXES][33], client_prefix[33][33]; new const forbidden_say_symbols[] = { "/", "!", "%", "$" } new const forbidden_prefixes_symbols[] = { "/", "\", "%", "$", ".", ":", "?", "!", "@", "#", "%" } new const separator[] = "************************************************" new const in_prefix[] = "[AdminPrefixes]" public plugin_init() { register_plugin("Admin Prefixes", "2.2", "m0skVi4a ;]") g_bad_prefix = register_cvar("ap_bad_prefixes", "1") g_listen = register_cvar("ap_listen", "1") g_listen_flag = register_cvar("ap_listen_flag", "a") g_custom_current = register_cvar("ap_custom_current", "1") g_custom_current_flag = register_cvar("ap_custom_current_flag", "b") g_custom_others = register_cvar("ap_custom_others", "1") g_custom_others_flag = register_cvar("ap_custom_others_flag", "c") g_say_characters = register_cvar("ap_say_characters", "1") g_prefix_characters = register_cvar("ap_prefix_characters", "1") g_saytxt = get_user_msgid ("SayText") g_maxplayers = get_maxplayers() g_nvault = nvault_open("CustomAdminPrefixes") register_concmd("ap_reload_prefixes", "LoadPrefixes") register_concmd("ap_reload_badprefixes", "LoadBadPrefixes") register_concmd("ap_put", "SetPrefix") register_concmd("ap_put_player", "SetPlayerPrefix") register_clcmd("say", "HookSay") register_clcmd("say_team", "HookSayTeam") register_dictionary("admin_prefixes.txt") get_configsdir(configs_dir, charsmax(configs_dir)) LoadPrefixes(0) LoadBadPrefixes(0) } public LoadPrefixes(id) { if(!(get_user_flags(id) & FLAG_LOAD)) { console_print(id, "%L", LANG_SERVER, "PREFIX_PERMISSION", in_prefix) return PLUGIN_HANDLED } line = 0, pre_flags_count = 0, pre_ips_count = 0, pre_names_count = 0; formatex(file, charsmax(file), "%s/ap_prefixes.ini", configs_dir) if(!file_exists(file)) { formatex(error, charsmax(error), "%L", LANG_SERVER, "PREFIX_NOT_FOUND", in_prefix, file) set_fail_state(error) } server_print(separator) while(read_file(file, line++ , text, charsmax(text), length) && pre_flags_count <= MAX_PREFIXES) { if(!text[0] || text[0] == '^n' || text[0] == ';') continue parse(text, type, charsmax(type), prefix, charsmax(prefix), acc_type, charsmax(acc_type)) trim(prefix) if(!type[0] || !prefix[0] || !acc_type[0]) continue replace_all(prefix, charsmax(prefix), "!g", "^x04") replace_all(prefix, charsmax(prefix), "!t", "^x03") replace_all(prefix, charsmax(prefix), "!n", "^x01") switch(type[0]) { case 'i': { pre_ips_count++ pre_ips_collect[pre_ips_count] = prefix ips_collect[pre_ips_count] = acc_type server_print("%L", LANG_SERVER, "PREFIX_LOAD_IP", in_prefix, prefix, acc_type) } case 'n': { pre_names_count++ pre_names_collect[pre_names_count] = prefix names_collect[pre_names_count] = acc_type server_print("%L", LANG_SERVER, "PREFIX_LOAD_NAME", in_prefix, prefix, acc_type) } case 'f': { pre_flags_count++ pre_flags_collect[pre_flags_count] = prefix flags_collect[pre_flags_count][0] = acc_type[0] server_print("%L", LANG_SERVER, "PREFIX_LOAD_FLAG", in_prefix, prefix, acc_type[0]) } default: { continue } } } if(pre_flags_count <= 0 && pre_ips_count <= 0 && pre_names_count <= 0) { server_print("%L", LANG_SERVER, "PREFIX_NO", in_prefix) } get_user_name(id, g_name, charsmax(g_name)) server_print("%L", LANG_SERVER, "PREFIX_LOADED_BY", in_prefix, g_name) console_print(id, "%L", LANG_SERVER, "PREFIX_LOADED", in_prefix) server_print(separator) for(new i = 1; i <= g_maxplayers; i++) { client_prefix[id] = "" CheckNvaultPrefix(i) } return PLUGIN_HANDLED } public LoadBadPrefixes(id) { if(!get_pcvar_num(g_bad_prefix)) { console_print(id, "%L", LANG_SERVER, "BADP_OFF", in_prefix) return PLUGIN_HANDLED } if(!(get_user_flags(id) & FLAG_LOAD)) { console_print(id, "%L", LANG_SERVER, "BADP_PERMISSION", in_prefix) return PLUGIN_HANDLED } line = 0, bad_prefix_count = 0; formatex(file, charsmax(file), "%s/ap_bad_prefixes.ini", configs_dir) if(!file_exists(file)) { console_print(id, "%L", LANG_SERVER, "BADP_NOT_FOUND", in_prefix, file) return PLUGIN_HANDLED } server_print(separator) while(read_file(file, line++ , text, charsmax(text), length) && bad_prefix_count <= MAX_BAD_PREFIXES) { if(!text[0] || text[0] == '^n' || text[0] == ';') continue parse(text, prefix, charsmax(prefix)) if(!prefix[0]) continue bad_prefix_count++ bad_prefixes_collect[bad_prefix_count] = prefix server_print("%L", LANG_SERVER, "BADP_LOAD", in_prefix, prefix) } if(bad_prefix_count <= 0) { server_print("%L", LANG_SERVER, "BADP_LOAD", in_prefix) } get_user_name(id, g_name, charsmax(g_name)) server_print("%L", LANG_SERVER, "BADP_LOADED_BY", in_prefix, g_name) console_print(id, "%L", LANG_SERVER, "BADP_LOADED", in_prefix) server_print(separator) for(new i = 1; i <= g_maxplayers; i++) { CheckNvaultPrefix(i) } return PLUGIN_HANDLED } public client_putinserver(id) { client_prefix[id] = "" CheckNvaultPrefix(id) } public HookSay(id) { read_args(g_typed, charsmax(g_typed)) remove_quotes(g_typed) if(equal(g_typed, "") || !is_user_connected(id)) return PLUGIN_HANDLED_MAIN if((client_prefix[id][0] && get_pcvar_num(g_say_characters) == 1) || (!client_prefix[id][0] && get_pcvar_num(g_say_characters) == 2) || get_pcvar_num(g_say_characters) == 3) { if(check_say_characters(g_typed)) return PLUGIN_HANDLED_MAIN } get_user_name(id, g_name, charsmax(g_name)) g_team = get_user_team(id) new const team_info[2][][] = { {"*SPEC* ", "*DEAD* ", "*DEAD* ", "*SPEC* "}, {"", "", "", ""} } if(client_prefix[id][0]) { formatex(g_message, charsmax(g_message), "^1%s^4%s^3 %s :^4 %s", team_info[is_user_alive(id)][g_team], client_prefix[id], g_name, g_typed) } else { formatex(g_message, charsmax(g_message), "^1%s^3%s :^1 %s", team_info[is_user_alive(id)][g_team], g_name, g_typed) } get_pcvar_string(g_listen_flag, temp_cvar, charsmax(temp_cvar)) for(new i = 1; i <= g_maxplayers; i++) { if(!is_user_connected(i)) continue if(is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i) || get_pcvar_num(g_listen) && get_user_flags(i) & read_flags(temp_cvar)) { send_message(g_message, id, i) } } return PLUGIN_HANDLED_MAIN } public HookSayTeam(id) { read_args(g_typed, charsmax(g_typed)) remove_quotes(g_typed) if(equal(g_typed, "") || !is_user_connected(id)) return PLUGIN_HANDLED_MAIN if((client_prefix[id][0] && get_pcvar_num(g_say_characters) == 1) || (!client_prefix[id][0] && get_pcvar_num(g_say_characters) == 2) || get_pcvar_num(g_say_characters) == 3) { if(check_say_characters(g_typed)) return PLUGIN_HANDLED_MAIN } get_user_name(id, g_name, charsmax(g_name)) g_team = get_user_team(id) new const team_info[2][][] = { {"(Spectator) ", "*DEAD*(Terrorist) ", "*DEAD*(Counter-Terrorist) ", "(Spectator) "}, {"(Spectator) ", "(Terrorist) ", "(Counter-Terrorist) ", "(Spectator) "} } if(client_prefix[id][0]) { formatex(g_message, charsmax(g_message), "^1%s^4%s^3 %s :^4 %s", team_info[is_user_alive(id)][g_team], client_prefix[id], g_name, g_typed) } else { formatex(g_message, charsmax(g_message), "^1%s^3%s :^1 %s", team_info[is_user_alive(id)][g_team], g_name, g_typed) } get_pcvar_string(g_listen_flag, temp_cvar, charsmax(temp_cvar)) for(new i = 1; i <= g_maxplayers; i++) { if(!is_user_connected(i)) continue if(get_user_team(id) == get_user_team(i) || get_pcvar_num(g_listen) && get_user_flags(i) & read_flags(temp_cvar)) { if(is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i) || get_pcvar_num(g_listen) && get_user_flags(i) & read_flags(temp_cvar)) { send_message(g_message, id, i) } } } return PLUGIN_HANDLED_MAIN } public SetPrefix(id) { if(!get_pcvar_num(g_custom_current) || !get_pcvar_string(g_custom_current_flag, temp_cvar, charsmax(temp_cvar))) { console_print(id, "%L", LANG_SERVER, "CUSTOM_OFF", in_prefix) return PLUGIN_HANDLED } if(!(get_user_flags(id) & read_flags(temp_cvar))) { console_print(id, "%L", LANG_SERVER, "CUSTOM_PERMISSION", in_prefix) return PLUGIN_HANDLED } read_args(typed_prefix, charsmax(typed_prefix)) remove_quotes(typed_prefix) trim(typed_prefix) if(get_pcvar_num(g_bad_prefix) && is_bad_prefix(typed_prefix)) { console_print(id, "%L", LANG_SERVER, "CUSTOM_FORBIDDEN", in_prefix, typed_prefix) return PLUGIN_HANDLED } if(get_pcvar_num(g_prefix_characters) && check_prefix_characters(typed_prefix)) { console_print(id, "%L", LANG_SERVER, "CUSTOM_SYMBOL", in_prefix, typed_prefix, forbidden_prefixes_symbols[i]) return PLUGIN_HANDLED } get_user_name(id, g_name, charsmax(g_name)) if(equal(typed_prefix, "")) { nvault_remove(g_nvault, g_name) console_print(id, "%L", LANG_SERVER, "CUSTOM_REMOVE", in_prefix) server_print("%L", LANG_SERVER, "CUSTOM_REMOVE_INFO", in_prefix, g_name) PutPrefix(id) return PLUGIN_HANDLED } nvault_set(g_nvault, g_name, typed_prefix) client_prefix[id] = typed_prefix console_print(id, "%L", LANG_SERVER, "CUSTOM_CHANGE", in_prefix, typed_prefix) server_print("%L", LANG_SERVER, "CUSTOM_CHANGE_INFO", in_prefix, g_name, typed_prefix) return PLUGIN_HANDLED } public SetPlayerPrefix(id) { if(!get_pcvar_num(g_custom_current) || !get_pcvar_string(g_custom_current_flag, temp_cvar, charsmax(temp_cvar)) || !get_pcvar_num(g_custom_others) || !get_pcvar_string(g_custom_others_flag, temp_cvar, charsmax(temp_cvar))) { console_print(id, "%L", LANG_SERVER, "CO_OFF", in_prefix) return PLUGIN_HANDLED } if(!(get_user_flags(id) & read_flags(temp_cvar))) { console_print(id, "%L", LANG_SERVER, "CO_FORBIDDEN", in_prefix) return PLUGIN_HANDLED } new name_tag[64], typed_name[32]; read_args(name_tag, charsmax(name_tag)) remove_quotes(name_tag) parse(name_tag, typed_name, charsmax(typed_name), typed_prefix, charsmax(typed_prefix)) trim(typed_prefix) if(get_pcvar_num(g_bad_prefix) && is_bad_prefix(typed_prefix)) { console_print(id, "%L", LANG_SERVER, "CUSTOM_FORBIDDEN", in_prefix, typed_prefix) return PLUGIN_HANDLED } if(get_pcvar_num(g_prefix_characters) && check_prefix_characters(typed_prefix)) { console_print(id, "%L", LANG_SERVER, "CUSTOM_SYMBOL", in_prefix, typed_prefix, forbidden_prefixes_symbols[i]) return PLUGIN_HANDLED } get_user_name(id, g_name, charsmax(g_name)) new target = cmd_target(id, typed_name, 1) if(!target) return PLUGIN_HANDLED if(equal(typed_prefix, "")) { nvault_remove(g_nvault, typed_name) console_print(id, "%L", LANG_SERVER, "CO_REMOVE", in_prefix, typed_name) server_print("%L", LANG_SERVER, "CO_REMOVE_INFO", in_prefix, g_name, typed_name) PutPrefix(target) return PLUGIN_HANDLED } nvault_set(g_nvault, typed_name, typed_prefix) client_prefix[id] = typed_prefix console_print(id, "%L", LANG_SERVER, "CO_CHANGE", in_prefix, typed_name, typed_prefix) server_print("%L", LANG_SERVER, "CO_CHANGE_INFO", in_prefix, g_name, typed_name, typed_prefix) return PLUGIN_HANDLED } public client_infochanged(id) { if(!is_user_connected(id)) return PLUGIN_CONTINUE new g_old_name[32]; get_user_info(id, "name", g_name, charsmax(g_name)) get_user_name(id, g_old_name, charsmax(g_old_name)) if(!equal(g_name, g_old_name)) { client_prefix[id] = "" set_task(0.5, "CheckNvaultPrefix", id) return PLUGIN_HANDLED } return PLUGIN_CONTINUE } public CheckNvaultPrefix(const id) { new nvault_prefix[33]; get_user_name(id, g_name, charsmax(g_name)) get_pcvar_string(g_custom_current_flag, temp_cvar, charsmax(temp_cvar)) new data = nvault_get(g_nvault, g_name, nvault_prefix, charsmax(nvault_prefix)) if(data && get_pcvar_num(g_custom_current) && get_user_flags(id) & read_flags(temp_cvar)) { if((get_pcvar_num(g_bad_prefix) && is_bad_prefix(nvault_prefix)) || (get_pcvar_num(g_prefix_characters) && check_prefix_characters(nvault_prefix))) { PutPrefix(id) return PLUGIN_HANDLED } client_prefix[id] = nvault_prefix return PLUGIN_HANDLED } else { PutPrefix(id) return PLUGIN_HANDLED } return PLUGIN_HANDLED } stock PutPrefix(const id) { new temp_ip[16]; get_user_ip(id, temp_ip, charsmax(temp_ip), 1) for(new i = 0; i <= pre_ips_count; i++) { if(equal(temp_ip, ips_collect[i])) { client_prefix[id] = pre_ips_collect[i] return PLUGIN_HANDLED } } get_user_name(id, g_name, charsmax(g_name)) for(new i = 0; i <= pre_names_count; i++) { if(equal(g_name, names_collect[i])) { client_prefix[id] = pre_names_collect[i] return PLUGIN_HANDLED } } for(new i = 0; i <= pre_flags_count; i++) { if(get_user_flags(id) & read_flags(flags_collect[i])) { client_prefix[id] = pre_flags_collect[i] return PLUGIN_HANDLED } } return PLUGIN_HANDLED } stock send_message(const message[], const id, const i) { message_begin(MSG_ONE, g_saytxt, {0, 0, 0}, i) write_byte(id) write_string(message) message_end() } bool:check_say_characters(const check_message[]) { for(new i = 0; i < charsmax(forbidden_say_symbols); i++) { if(check_message[0] == forbidden_say_symbols[i]) { return true } } return false } bool:check_prefix_characters(const check_prefix[]) { for(i = 0; i < charsmax(forbidden_prefixes_symbols); i++) { if(containi(check_prefix, forbidden_prefixes_symbols[i]) != -1) { return true } } return false } bool:is_bad_prefix(const check_prefix[]) { for(new i = 0; i <= bad_prefix_count; i++) { if(equali(check_prefix, bad_prefixes_collect[i])) { return true } } return false }
Gomb jöhet
|
|