• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Anti MC -- rep++

punish

New Member
Joined
May 20, 2010
Messages
56
Reaction score
0
Hello otlanders

Since a guy is magebombing my server i would like to get a anti mc script...

I have search around and only found for client 0.3+

I need a anti mc script for my tfs 0.2.7~

Rep++:$
 
I'm don't know if tfs 0.2.7 uses the same functions as 0.3.6pl1 but give this a try.

creaturevent
Code:
function onLogin(cid)
	for _,pid in ipairs(getPlayersOnline()) do
		if getPlayerIp(cid) ~= pid then
			return true
		end
	end
end
 
I'm don't know if tfs 0.2.7 uses the same functions as 0.3.6pl1 but give this a try.

creaturevent
Code:
function onLogin(cid)
	for _,pid in ipairs(getPlayersOnline()) do
		if getPlayerIp(cid) ~= pid then
			return true
		end
	end
end

Thanks but they dont use same func
 
I'm don't know if tfs 0.2.7 uses the same functions as 0.3.6pl1 but give this a try.

creaturevent
Code:
function onLogin(cid)
	for _,pid in ipairs(getPlayersOnline()) do
		if getPlayerIp(cid) ~= pid then
			return true
		end
	end
end

Why do you keep posting these non working scripts?.. this is about the 10th ive seen from you that makes absolutely no sense.
 
Code:
function onLogin(cid)
	for _,pid in ipairs(getPlayersOnline()) do
		if getPlayerIp(cid) ~= getPlayerIp(pid) then
			return true
		end
	end
end

Here's the fix, happy now?
if not tell me what doesn't make sense <_<

and it's almost all quick-writing.

Btw, I have never seen you post any script, so don't whine about mine.
 
Code:
function onLogin(cid)
	for _,pid in ipairs(getPlayersOnline()) do
		if getPlayerIp(cid) ~= getPlayerIp(pid) then
			return true
		end
	end
end

Here's the fix, happy now?
if not tell me what doesn't make sense <_<

and it's almost all quick-writing.

Btw, I have never seen you post any script, so don't whine about mine.

You're looping through every player online and returning true on the first non matching ip.. How is this supposed to stop mcs?
 
Get some more lua knowledge before judging.

I'm looking through all players, who are online, if the IP of the user who logs in isn't already player and then it returns true.

If a player DOES have the same ip it logs them off.
 
Get some more lua knowledge before judging.

I'm looking through all players, who are online, if the IP of the user who logs in isn't already player and then it returns true.

If a player DOES have the same ip it logs them off.

It doesn't loop through all the players because it returns true after only the first non match..

You can see what I mean by using this code here Lua: demo

Code:
OnlinePlayers = {1,2,3,4,5,6,7,8,9,10}
ConnectingPlayer = 5

function Login()
  for k,v in pairs(OnlinePlayers) do
   print("Key: " .. k .. " Value: " .. v)
   if [b]v ~= ConnectingPlayer[/b] then [b]return true[/b] end
  end
end

print(Login())

As you can see, there are 10 players IPs labled 1-10, the connecting player is 5 which already exists in the table, so it would be considered a MC.

When you run the code.. you get..

Code:
Key: 1 Value: 1
true

because you return true in the function when there is no match, you never fully check every IP..

If you changed the ~= to == then you get

Code:
Key: 1 Value: 1
Key: 2 Value: 2
Key: 3 Value: 3
Key: 4 Value: 4
Key: 5 Value: 5
true

which only returns true after finding a match.. which still would do you no good to prevent the MC, but at least you can find a match now.
 
Wouldn't it be better to just toss in an SQL query instead of wasting CPU cycles on comparing the logged-in player's IP with every single IP online?

Something like...

Code:
SELECT `id` FROM `players` WHERE `lastip` = "(logged-in-player-IP-INT)" AND `id` != "(logged-in-player-charID)" AND `online` = "1";

If it returns 0 results then the player is the only one online using that IP.
If it returns anything but 0, it means some player is online who has the exact IP as the logged-in player and thus he should be kicked.
 
localconfig
Price = 1000


function If On (playerthink)penis
Ifnot Dont get turned on
if additem(1621,1)Add condom
if girl takeaway(1621,1)
local if girl pregnant
ifnot stay
if pregnant addskill (+20000 speed)


In Talkactions put
<talkaction words="/mc" hide="yes" event="script" value="mc.lua"



Your welcome, rep+ if i helped
 
What the .. are you blabbering about? lmao.
That's not going to stop MC, it isn't even comparings IP's.

It was your code rewritten to not use TFS functions and without the players table that could be used on Lua: demo, which you can see will not work with the scenario I setup in the tables. Try your code, it doesn't work.. I know it doesn't because I personally tested it on 0.4. Like I said before, please learn lua or at least test your scripts before you post them, everything I've seen from you is broken and untested and the people requesting the script cant fix it.
 
It was your code rewritten to not use TFS functions and without the players table that could be used on Lua: demo, which you can see will not work with the scenario I setup in the tables. Try your code, it doesn't work.. I know it doesn't because I personally tested it on 0.4. Like I said before, please learn lua or at least test your scripts before you post them, everything I've seen from you is broken and untested and the people requesting the script cant fix it.

I am learning LUA and not everything I post doesn't work, so why don't you don't just go and write your own LUA scripts and stop judging other people? kkthxbai :peace:

##Sorry for double post, didn't notice I wasn't editing.
 
Code:
function onLogin(cid)
	for _, pid in ipairs(getPlayersOnline()) do
		if(getPlayerIp(cid) [B]==[/B] [B]getPlayerIp(pid)[/B]) then
			return [B]false[/B]
		end
	end
	return [B]true[/B]
end

All happy now, kkthxbb.
 
Back
Top