Jump to content

Why not working antitag script?


Turbe$Z

Recommended Posts

local blockedTags = { "[VIP]", "[UltraVIP]", "[A]", "[M]", "[SM]" };

addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ),
	function ()
		for i, p in ipairs ( getElementsByType ( "player" ) ) do
			local tempName = getPlayerName ( p );

			for x = 1, #blockedTags do
				if ( string.find ( tempName, blockedTags [ i ], 1, true ) ~= nil ) then
					kickPlayer ( source, "Rang tag nem lehet a nevedben! Szedd le! Köszikee :D" );
				end
			end
		end
	end
);

addEventHandler ( "onPlayerJoin", root,
	function ()
		local name = getPlayerName ( source );

		for i = 1, #blockedTags do
			if ( string.find ( name, blockedTags [ i ], 1, true ) ~= nil ) then
				kickPlayer ( source, "Rang tag nem lehet a nevedben! Szedd le! Köszikee :D" );
			end
		end
	end
);

addEventHandler ( "onPlayerChangeNick", root,
	function ( _, newNick )
		for i = 1, #blockedTags do
			if ( string.find ( newNick, blockedTags [ i ], 1, true ) ~= nil ) then
				kickPlayer ( source, "Rang tag nem lehet a nevedben! Szedd le! Köszikee :D" );
			end
		end
	end
);

server.lua:9: bad argument #2 to 'find' (string expected, got nil) why??

Link to comment
  • MTA Anti-Cheat Team

It works fine for me, both that exact code you posted and the original resource for this: https://community.multitheftauto.com/index.php?p=resources&s=details&id=11557

There's also no real difference between the code of both except for your custom defined tags and kick message output, so I was already wondering how your version could break it, which now turns out it doesn't.

So what else can be your problem, is something interfering?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...