Raised This Month: $ Target: $400
 0% 

[REQ] Auto rename players plugin problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Maryan
New Member
Join Date: Jan 2016
Old 01-15-2016 , 17:57   [REQ] Auto rename players plugin problem
Reply With Quote #1

Hello everybody, I have a little problem with this plugin.
Everything it's working fine but from file nickname.ini, if the name "player" is written, the name "player 1" it's not replaced and I have to write too manny combinations of "player" in nickname.ini .
All I want is to rename all names which include the word "player" if I write "player" in nickname.ini.

Quote:
#include <amxmodx>
#include <amxmisc>

new const
PLUGIN[] = "NickChange",
VERSION[] = "1.0",
AUTHOR[] = "Nap";

new const NickName[][] =
{
"BatPeTotiSiIncaUnul",
"Mareana",
"MS4Ever",
"Mousesports"

}
public plugin_init() {
register_plugin(PLUGIN,VERSION,AUTHOR)

new FilePointer,File[125]
get_configsdir(File,charsmax(File))
format(File,charsmax(File),"%s/%s",File,"nickname.ini")

if(!file_exists(File))
{
FilePointer = fopen(File,"w+")
fclose(FilePointer)
}
}
public client_putinserver(id)
{
change(id)
}

public change(id) {
new szName[32]
get_user_name(id,szName,charsmax(szName))

if(IsInFile(szName))
{
new buffer[32]
formatex(buffer,charsmax(buffer),"%s",NickNam e[random_num(0,sizeof(NickName) -1)])
new iPlayers[32],iNum,name[32]
get_players(iPlayers,iNum)
for(new i = 0; i < iNum; i++)
{
get_user_name(iPlayers[i],name,charsmax(name))
if(equal(name,buffer))
{
change(id)
break
}
set_user_info(id,"name",buffer)
}
}
}
public client_infochanged(id) {
new oldname[32],newname[32]
get_user_name(id,oldname,charsmax(oldname))
get_user_info(id,"name",newname,charsmax(newn ame))

if(!equal(newname,oldname))
set_task(0.1,"change",id)
}

stock IsInFile(const sName[])
{
new FilePointer,File[125],FileData[256],name[32]
get_configsdir(File,charsmax(File))
format(File,charsmax(File),"%s/%s",File,"nickname.ini")

FilePointer = fopen(File,"rt")
if(FilePointer)
{
while(!feof(FilePointer))
{
fgets(FilePointer,FileData,charsmax(FileData) )
parse(FileData,name,charsmax(name))
if(equali(sName,name))
{
return true
}
}
fclose(FilePointer)
}
return false
}
Can someone help me with this?

Thanks a lot.
Maryan is offline
Maryan
New Member
Join Date: Jan 2016
Old 01-18-2016 , 08:08   Re: [REQ] Auto rename players plugin problem
Reply With Quote #2

No one?
Maryan is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 01-25-2016 , 11:43   Re: [REQ] Auto rename players plugin problem
Reply With Quote #3

Apply here: https://forums.alliedmods.net/forumdisplay.php?f=11
May be anyone might help you ..!!

Last edited by Alber9091; 01-25-2016 at 11:43.
Alber9091 is offline
Adventx
Member
Join Date: Feb 2014
Location: Romania
Old 01-25-2016 , 14:55   Re: [REQ] Auto rename players plugin problem
Reply With Quote #4

PHP Code:
/* Plugin generated by AMXX-Studio */
 
#include <amxmodx>
#include <amxmisc>
 
new const PLUGIN[] = "Restricted Names";
new const 
VERSION[] = "1.0";
new const 
AUTHOR[] = "Adventx";
 
public 
plugin_init()
{
        
register_plugin(PLUGINVERSIONAUTHOR);
        
        
// Add your code here...
}
 
public 
plugin_cfg()
{
        
// get cfg dir
        
new cfgdir[64], file[128];;
        
get_configsdir(cfgdirsizeof(cfgdir) - 1);
        
        
// formatex
        
formatex(filesizeof 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"szNamesizeof 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(iFileszBuffersizeof(szBuffer) - 1);
                
                if(!
szBuffer[0] || szBuffer[0] == ';')
                        continue;
                if(
equali(szBufferStringstrlen(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 }
*/ 

Last edited by Adventx; 01-25-2016 at 14:57.
Adventx is offline
Send a message via Yahoo to Adventx
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-25-2016 , 18:47   Re: [REQ] Auto rename players plugin problem
Reply With Quote #5

Quote:
Originally Posted by Alber9091 View Post
Apply here: https://forums.alliedmods.net/forumdisplay.php?f=11
May be anyone might help you ..!!
No. Scripting Help is only for people writing their own plugins or editing existing plugin on their own.
__________________
fysiks is offline
Alber9091
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
Old 01-25-2016 , 20:35   Re: [REQ] Auto rename players plugin problem
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
No. Scripting Help is only for people writing their own plugins or editing existing plugin on their own.
Alright man, Got it ..!! Thanks for let me knowing about it ..!!
Alber9091 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:06.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode