• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

help adding this line of code!

Cris2387

Member
Joined
Dec 30, 2013
Messages
177
Reaction score
9
hello i added this anti mc system to prevent players from using magebomb or nuking my server with acount manager and this is what i have :
PHP:
local function antiMC(system)
  if #getPlayersByIp(getPlayerIp(system.pid)) >= system.max then
  doRemoveCreature(system.pid)
  end
  return TRUE
end

function onLogin(cid)
  addEvent(antiMC, 4000, {pid = cid, max = 4})
  return TRUE
end
it works perfectly and all i want to do now is to add this
PHP:
  doPlayerPopupFYI(cid, "Multi-client will not be allowed in this server. You will now be kicked!")
i've tried adding it after addEvent and if i put it there then everyone gets the message when they log in, i also tried putting it after
Code:
if #getPlayersByIp(getPlayerIp(system.pid)) >= system.max then
but i get this error:
Code:
[28/5/2015 17:58:47] [Error - CreatureScript Interface]
[28/5/2015 17:58:47] In a timer event called from:
[28/5/2015 17:58:47] data/creaturescripts/scripts/antimc.lua:onLogin
[28/5/2015 17:58:47] Description:
[28/5/2015 17:58:47] (LuaInterface::luaDoPlayerPopupFYI) Player not found
so where do i put it so that when the player logs in they get that message and then after four seconds they get kicked?
 
It's a tough one because if you add it in the antiMC function, it will happen at the same time as they get kicked. I suggest the following:
Code:
local function antiMC(system)
    doRemoveCreature(system.pid)
    return TRUE
end

function onLogin(cid)
    if #getPlayersByIp(getPlayerIp(cid)) >= 4 then
        doPlayerPopupFYI(cid, "Multi-client will not be allowed in this server. You will now be kicked!")
        addEvent(antiMC, 4000, {pid = cid})
    end
    return TRUE
end
 
It's a tough one because if you add it in the antiMC function, it will happen at the same time as they get kicked. I suggest the following:
Code:
local function antiMC(system)
    doRemoveCreature(system.pid)
    return TRUE
end

function onLogin(cid)
    if #getPlayersByIp(getPlayerIp(cid)) >= 4 then
        doPlayerPopupFYI(cid, "Multi-client will not be allowed in this server. You will now be kicked!")
        addEvent(antiMC, 4000, {pid = cid})
    end
    return TRUE
end
thanks mate it worked!
 
Back
Top