Logging bans
#1

Hai all,i've this code to auto ban cheaters /minigun/rpg/armor spawn,and i need to log every bans in a single file.

I explain:

rpg bans go to rpgbans.log file
minigun bans go to minigunbans.log
armor spawn bans go to armorspawnbans.log

So i need to create the file,writing it and close it after has been writed with a ban.

Код:
	if(w == 44)
		{
			new name[24];
			GetPlayerName(i,name,sizeof name);
			new reason[128];
  			format(reason,sizeof(reason),"Player %s(ID: %i) has nightvision goggles (Check before ban!!)", name,i);
   			SendClientMessageToAdmins(RED, reason, 1);
	    	new msg[128];
			format(msg,sizeof msg,"0,4Player %s (ID:%d) Might have NVG's Detected them (never bofore).",name,i);
			IRC_Say(ACBot,"#***",msg);
			IRC_Say(ACBot,"#***",msg);
		}

		if(w == 45)
		{
			new name[24];
			GetPlayerName(i,name,sizeof name);
			new reason[128];
  			format(reason,sizeof(reason),"Player %s(ID: %i) might have thermal goggles (check before ban!!)", name,i);
   			SendClientMessageToAdmins(RED, reason, 1);
	    	new msg[128];
			format(msg,sizeof msg,"0,4Player %s (ID:%d) might have TG's (Never detected them before)",name,i);
			IRC_Say(ACBot,"#",msg);
			IRC_Say(ACBot,"#",msg);
		}

		if(w == 43)
		{
			new name[24];
			GetPlayerName(i,name,sizeof name);
			new reason[128];
  			format(reason,sizeof(reason),"Player %s has a camera (Autoban)", name);
   			SendClientMessageToAdmins(RED, reason, 1);
			format(reason,sizeof(reason),"Player %s has been banned for camera cheat (Camera)", name);
   			SendClientMessageToAll(COLOR_RED,reason);
	    	new msg[128];
			format(msg,sizeof msg,"0,4Auto-Ban: %s banned for camera.");
			IRC_Say(ACBot,"#",msg);
			IRC_Say(ACBot,"#",msg);
			AddPlayerBan(i,"AutoCameraBan","AC");
			BanEx(i,"Auto Ban Camera Cheat");
			PlaySoundForAll(1009);
		}
		
				if(w == 35)
		{
			new name[24];
			GetPlayerName(i,name,sizeof name);
			new reason[128];
  			format(reason,sizeof(reason),"Player %s has a Rocket Launcher RPG (Autoban)", name);
   			SendClientMessageToAdmins(RED, reason, 1);
			format(reason,sizeof(reason),"Player %s has been banned for Rocket Launcher RPG (Auto Ban RPG)", name);
   			SendClientMessageToAll(COLOR_RED,reason);
	    	new msg[128];
			format(msg,sizeof msg,"0,4Auto-Ban: %s banned for rocket launcher RPG.");
			IRC_Say(ACBot,"#",msg);
			IRC_Say(ACBot,"#",msg);
			AddPlayerBan(i,"AutoRPGBan","AC");
			BanEx(i,"Auto Ban Rocket Launcher RPG");
			PlaySoundForAll(1009);
		}
		
				if(w == 38)
		{
			new name[24];
			GetPlayerName(i,name,sizeof name);
			new reason[128];
  			format(reason,sizeof(reason),"Player %s has a minigun (Autoban)", name);
   			SendClientMessageToAdmins(RED, reason, 1);
			format(reason,sizeof(reason),"Player %s has been banned for minigun (Anti Cheat)", name);
   			SendClientMessageToAll(COLOR_RED,reason);
	    	new msg[128];
			format(msg,sizeof msg,"0,4Auto-Ban: %s banned for minigun.");
			IRC_Say(ACBot,"#",msg);
			IRC_Say(ACBot,"#",msg);
			AddPlayerBan(i,"AutoMinigunBan","AC");
			BanEx(i,"Auto Ban Minigun");
			PlaySoundForAll(1009);
		}


		if(armor > 100 || armor == 250 || armor < 0)
		{
			if(a == 1)
			{
	  			new name[24];
				GetPlayerName(i,name,sizeof name);
    			new reason[128];
		    	format(reason,sizeof(reason),"ALERT: Player %s (ID:%d) has been banned for Armor cheat.", name);
			    SendClientMessageToAdmins(RED, reason, 1);
			    new msg[128];
   				format(msg,sizeof(msg),"0,4ALERT: Player %s (ID:%d) has been banned for Armor cheat.", name);
				IRC_GroupSay(IRC_Group, EchoChan, msg);
				IRC_GroupSay(IRC_Group,"#",msg);
				AddPlayerBan(i,"AutoArmourBan","AC");
				BanEx(i,"Auto Ban Armour");
				PlaySoundForAll(1009);
			}
			else
			{
				new name[24];
				GetPlayerName(i,name,sizeof name);
    			new reason[128];
		    	format(reason,sizeof(reason),"Report From Anticheat: %s (ID:%d) has armor above the SA-MP Limit.", name,i);
			    SendClientMessageToAdmins(RED, reason, 1);
			    new msg[128];
   				format(msg,sizeof(msg),"0,4Report From Anticheat: %s (ID:%d) has armor above the SA-MP Limit.", name,i);
				IRC_GroupSay(IRC_Group, EchoChan, msg);
				IRC_GroupSay(IRC_Group,"#",msg);
				PlaySoundForAdmins(1054);
				SetPVarInt(i,"Alerts",a+1);
			}

		}
			}
	return 1;
}
Thanks.
Reply
#2

maybe tried searching and scripting it yourself? File functions are so easy, just search on wiki for function fwrite()
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)