Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include <amxmodx>
- #include <amxmisc>
- new const PLUGIN[] = "Restricted Names";
- new const VERSION[] = "1.0";
- new file[128];
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, "Adventx");
- // Add your code here...
- register_cvar("restricted_name_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY);
- set_cvar_string("restricted_name_version", VERSION);
- }
- public plugin_cfg()
- {
- // get cfg dir
- new cfgdir[64];
- get_configsdir(cfgdir, sizeof(cfgdir) - 1);
- // formatex
- formatex(file, sizeof file - 1, "%s/restricted_names.ini", cfgdir);
- // file exists
- if(!file_exists(file))
- {
- write_file(file, "// ----------------", -1);
- write_file(file, "// Restricted Names", -1);
- write_file(file, "// ----------------", -1);
- }
- }
- public client_putinserver(id)
- {
- new szName[32];
- get_user_info(id, "name", szName, sizeof szName -1);
- if(is_string_in_file(szName))
- set_user_info(id, "name", "unnamed");
- }
- // Thanks to Askhanar (https://forums.alliedmods.net/member.php?u=174947)
- stock bool:is_string_in_file(const String[])
- {
- static szBuffer[32];
- new iFile = fopen(file, "rt");
- if(!iFile)
- return false;
- while(!feof(iFile))
- {
- fgets(iFile, szBuffer, sizeof(szBuffer) - 1);
- if(!szBuffer[0] || szBuffer[0] == ';')
- continue;
- if(equali(szBuffer, String, strlen(String)))
- return true;
- }
- fclose(iFile);
- return false;
- }
- /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
- *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
- */
Advertisement
Add Comment
Please, Sign In to add comment