• 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!

Lua Auto Kick trainer

matthewbro

New Member
Joined
Jun 11, 2011
Messages
10
Reaction score
0
Hello, i am using this script to kick players from the trainers, but i get error luaDoRemoveCreature-creature not found and luaDoTeleportThing - thing not found.

Script:

kick.lua
Code:
local config = {  
tempo = 30, -- Tempo em minutos  
storage = 20000, -- não mexa aqui  
teleport = {x=32360, y=31782, z=7} -- coordenadas do seu templo  
}  
  
function onStepIn(cid, item, frompos, topos)
if isPlayer(cid) == TRUE then 
if getPlayerStorageValue(cid, config.storage) <= 0 then  
kick1 = addEvent(setPlayerStorageValue, config.tempo*60*1000-1000, cid, config.storage, -1)  
kick2 = addEvent(doTeleportThing, config.tempo*60*1000-500, cid, config.teleport)  
kick = addEvent(doRemoveCreature, config.tempo*60*1000, cid)  
doPlayerSendTextMessage(cid, 22, "[Trainer]: Movimente-se a cada " .. config.tempo .. " minutos, caso contrário, seu char será deslogado.")  
setPlayerStorageValue(cid, config.storage, 1)  
end  
end
end  
  
function onStepOut(cid, item, frompos, topos)
if isPlayer(cid) == TRUE then 
if getPlayerStorageValue(cid, config.storage) >= 1 then  
setPlayerStorageValue(cid, config.storage, -1)  
doPlayerSendTextMessage(cid, 23, "System kick off!")  
stopEvent(kick)  
stopEvent(kick1)  
stopEvent(kick2)  
end  
end
end
 
If the event to kick the player or to teleport him is called and the player logged out (maybe because he was idle) you will get that error.
You need to check if the player exists before teleporting him..
 
Back
Top