file help please =D
#7

my Forbid-Command:

Код:
dcmd_forbidname(playerid,params[])
{
	if(PlayerData[playerid][Level] >= 2)
	{
	  new name,string[128],bname[128],File:badname;
	  if(sscanf(params,"c",name)) return SendClientMessage(playerid, COLOR_SYSTEM, "Usage: /forbidname [name]");
		badname=fopen("fAdmin/Config/badnames.cfg",io_append);
		format(bname,sizeof(bname),"%s\r\n",params);
		fwrite(badname,bname);
		fclose(badname);
	  format(string,sizeof(string),"[Server] Administrator %s has forbidden the Name %s",PlayerName(playerid),params);
	  SendClientMessageToAll(COLOR_RED,string);
	  return 1;
	}
	else return SendClientMessage(playerid,COLOR_RED,"Admins only!");
}
Код:
if(fexist("fAdmin/Config/badnames.cfg"))
	{
	new File:badname=fopen("fAdmin/Config/badnames.cfg",io_read);
	while(fread(badname, string))
	{
		for(new i = 0; i < strlen(string); i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
		if(!strcmp(PlayerName(playerid),string,true))
		{
			new blacklist[128];
			SendClientMessage(playerid,COLOR_YELLOW,"[Server] Your Name is blacklisted!");
			format(blacklist,sizeof(blacklist),"[Server] %s has been kicked by the Server [Reason: Forbidden Name]",PlayerName(playerid));
			SendClientMessageToAll(COLOR_RED,blacklist);
			KickLog(blacklist);
			Kick(playerid);
		}
	}
	fclose(badname);
	}
	return 1;
it still doesn't work. The name is inthe File but i can still connect with that name
Reply


Messages In This Thread
file help please =D - by Flo_White - 03.04.2009, 19:47
Re: file help please =D - by Jefff - 03.04.2009, 20:01
Re: file help please =D - by Flo_White - 03.04.2009, 20:08
Re: file help please =D - by Donny_k - 03.04.2009, 21:25
Re: file help please =D - by Flo_White - 04.04.2009, 08:49
Re: file help please =D - by Jefff - 04.04.2009, 12:03
Re: file help please =D - by Flo_White - 04.04.2009, 12:31
Re: file help please =D - by Donny_k - 04.04.2009, 13:14
Re: file help please =D - by Flo_White - 04.04.2009, 13:48
Re: file help please =D - by phoenix0120 - 04.04.2009, 14:43

Forum Jump:


Users browsing this thread: 1 Guest(s)