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

kick player after xxx seconds

Captha

New Member
Joined
Aug 29, 2010
Messages
30
Reaction score
0
i need a script that kick a player after xxx seconds. Like a svar arena, but i am doing for a zao arena
i dont know so much thing of script, so tell me where i can put ( like after pull the switch, etc)
thank you
 
Lua:
local seconds = 10
function onUse(cid, item, fromPosition, itemEx, toPosition)
	addEvent(doRemoveCreature, seconds * 1000, cid)
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Lua:
local seconds = 10
function onUse(cid, item, fromPosition, itemEx, toPosition)
	addEvent(doRemoveCreature, seconds * 1000, cid)
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end

I think that will kick the player from the game, he just wants it to 'teleport' the player to another place, just like Svargrond arena quest.
 
Lua:
addEvent(doTeleportThing, seconds * 1000, pos, cid)
There are 2 players.

Here's a basic function:
Lua:
local arena = {
	from = {x=100, y=100, z=7},
	to = {x=200, y=200, z=7}
}

local function kick(t)
	for i = 1, #t do
		if isPlayer(t[i]) and isInRange(getThingPos(t[i]), arena.from, arena.to) then
			doTeleportThing(t[i], {x=500, y=500, z=7})
			doSendMagicEffect({x=500, y=500, z=7}, CONST_ME_TELEPORT)
		end
	end
end
Usage:
Lua:
addEvent(kick, seconds * 1000, {cid of first player, cid of second player})
 
Last edited:
Code:
 local room = {     -- room with demons
        fromX = 33051,
        fromY = 31020,
        fromZ = 3,

        toX = 33076,
        toY = 31045,
        toZ = 3
        }

        local monster_pos = {
        [1] = {pos = {33062, 31035, 3}, monster = "Baron Brute"},
        [2] = {pos = {33064, 31035, 3}, monster = "The Axeorcist"}
        }

        local players_pos = {
        {x=33080, y=31014, z=2, stackpos=253},
        {x=33081, y=31014, z=2, stackpos=253}
        }

        local new_player_pos = {
        {x = 33062, y =31027, z = 3},
        {x = 33064, y =31027, z = 3}
        }

        local playersOnly = "no"
        local questLevel = 80

function onUse(cid, item, fromPosition, itemEx, toPosition)
        local all_ready, monsters, player, level = 0, 0, {}, 0
        if item.itemid == 1945 then
                for i = 1, #players_pos do
                        table.insert(player, 0)
                end
                for i = 1, #players_pos do
                        player[i] = getThingfromPos(players_pos[i])
                        if player[i].itemid > 0 then
                                if string.lower(playersOnly) == "yes" then
                                        if isPlayer(player[i].uid) == TRUE then
                                                all_ready = all_ready+1
                                        else
                                                monsters = monsters+1
                                        end
                                else
                                        all_ready = all_ready+1
                                end
                        end
                end
                if all_ready == #players_pos then
                        for i = 1, #players_pos do
                                player[i] = getThingfromPos(players_pos[i])
                                if isPlayer(player[i].uid) == TRUE then
                                        if getPlayerLevel(player[i].uid) >= questLevel then
                                                level = level+1
                                        end
                                else
                                        level = level+1
                                end
                        end
                        if level == #players_pos then
                                if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then
                                        for _, area in pairs(monster_pos) do
                                                        doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
                                        end
                                        for i = 1, #players_pos do
                                                doSendMagicEffect(players_pos[i], CONST_ME_POFF)
                                                doTeleportThing(player[i].uid, new_player_pos[i], FALSE)
                                                doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
                                                doTransformItem(item.uid,1946)
                                        end
                                else
                                        doPlayerSendTextMessage(cid,19,"Only players can do this quest.")
                                end
                        else
                                doPlayerSendTextMessage(cid,19,"All Players have to be level "..questLevel.." to do this quest.")
                        end
                else
                        doPlayerSendTextMessage(cid,19,"You need "..table.getn(players_pos).." players to do this quest.")
                end
        elseif item.itemid == 1946 then
                local player_room = 0
                for x = room.fromX, room.toX do
                        for y = room.fromY, room.toY do
                                for z = room.fromZ, room.toZ do
                                        local pos = {x=x, y=y, z=z,stackpos = 253}
                                        local thing = getThingfromPos(pos)
                                        if thing.itemid > 0 then
                                                if isPlayer(thing.uid) == TRUE then
                                                        player_room = player_room+1
                                                end
                                        end
                                end
                        end
                end
                if player_room >= 1 then
                        doPlayerSendTextMessage(cid,19,"There is already a team in the quest room.")          
                elseif player_room == 0 then
                        for x = room.fromX, room.toX do
                                for y = room.fromY, room.toY do
                                        for z = room.fromZ, room.toZ do
                                                local pos = {x=x, y=y, z=z,stackpos = 253}
                                                local thing = getThingfromPos(pos)
                                                if thing.itemid > 0 then
                                                        doRemoveCreature(thing.uid)
                                                end
                                        end
                                end
                        end
                        doTransformItem(item.uid,1945)
                end
        end
        return TRUE
end

i have this code, where i can put this script of kick?
i am lost where i would put
 
i am noting finding. My script did this, its a copy of anihi. But i noob with scripts. where i put
addEvent(kick, seconds * 1000, {cid of first player, cid of second player})
and can you copy the script and add the kick event?
 
Back
Top