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

Teleport all players to temple (or pos x y z)

StormRusher

New Member
Joined
Dec 23, 2009
Messages
138
Reaction score
0
I need a talkaction to teleport all players in my ot to the temple, ou a pos x y z...

thx


ps:
I also need some help.
I wanna make an enforced with teams, but not with done chars
Like this, you create a char, and when loged in ot go to X team. With auto-balance (if Y team have 12 players and X 11, go to X, you understand :p )
 
Last edited:
Lua:
function onSay(cid, words, param, channel) 
local temple = { x = 993, y = 996, z = 7 }  
        for _, cid in ipairs(getPlayersOnline()) do 
                        doTeleportThing(cid, temple)
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to the temple.")
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)                
                end
        return TRUE
end
 
THx Very much

but now i need another something to this action

Make all players lost pz or if it is impossible, kick them after teleported
 
Lua:
function onSay(cid, words, param, channel)
local temple = { x = 993, y = 996, z = 7 }  
	for _, cid in ipairs(getPlayersOnline()) do
		if(param == '') then
			doTeleportThing(cid, temple)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to the temple.")
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
		else
		local t = string.explode(param, ",")
			doTeleportThing(cid, { x = t[1], y = t[2], z = t[3] }  )
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to the coords [X:"..t[1].."], [Y:"..t[2].."], [Z:"..t[3].."]")
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
		end
	end
	return TRUE
end
 
Lua:
  function onSay(cid, words, param, channel)
local temple = { x = 993, y = 996, z = 7 }  
        for _, cid in ipairs(getPlayersOnline()) do
		if getPlayerGroupID(cid) < 6 then	
                	if(param == '') then
				doTeleportThing(cid, temple)
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to the temple.")
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			else
				local t = string.explode(param, ",")
				doTeleportThing(cid, { x = t[1], y = t[2], z = t[3] }  )
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to the coords [X:"..t[1].."], [Y:"..t[2].."], [Z:"..t[3].."]")
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			end
                end
        end
        return TRUE
end
 
Mmm this last is not working :(
the following error happen:

[24/12/2009 21:51:52] Lua Script Error: [TalkAction Interface]
[24/12/2009 21:51:52] data/talkactions/scripts/alltemple.lua:eek:nSay

[24/12/2009 21:51:52] data/talkactions/scripts/alltemple.lua:4: attempt to call global 'getPlayerGroupID' (a nil value)
[24/12/2009 21:51:52] stack traceback:
[24/12/2009 21:51:52] data/talkactions/scripts/alltemple.lua:4: in function <data/talkactions/scripts/alltemple.lua:1>
 
- Add talkactions/scripts/tpall.lua
Lua:
function onSay(cid, words, param, channel)
local config = {
          groupID = 6, -- Protect GroupID 1,2,3,4,5,6 = GOD
          carlin = { x = 32360, y = 31782, z = 7 },
          venore = { x = 32957, y = 32076, z = 7 },
          edron = { x = 33217, y = 31814, z = 8 }
          };
 
        for _, cid in ipairs(getPlayersOnline()) do 

if  (getPlayerGroupId(cid) == config.groupID) then
        if(param == '') then
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "HELP: Use !tpall x,y,z or !tpall carlin or !tpall venore or !tpall edron.")
        return TRUE
end

for _, cid in ipairs(getPlayersOnline()) do
if  (getPlayerGroupId(cid) < config.groupID) then
                    if(param == 'carlin') then
                        doTeleportThing(cid, config.carlin)
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to carlin.")
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)

                elseif(param == 'venore') then
                        doTeleportThing(cid, config.venore)
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to venore.")
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)

                elseif(param == 'edron') then
                        doTeleportThing(cid, config.edron)
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to edron.")
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)


                else
                local t = string.explode(param, ",")
                        doTeleportThing(cid, { x = t[1], y = t[2], z = t[3] }  )
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to the coords [X:"..t[1].."], [Y:"..t[2].."], [Z:"..t[3].."]")
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)
end
end
end
end
end
        return TRUE
end

- Add talkactions/talkactions.xml
Lua:
<talkaction log="yes" words="!tpall" access="5" event="script" value="tpall.lua"/>

:peace:
 
Last edited:
Code:
 Description:
attempt to index a nil value
stack traceback:
[C]: in function 'doTeleportThing'
data/talkactions/scripts/alltemple.lua:21: in function <data/talkactions/scripts/alltemple.lua:1>
We know what i can do?

@edit
OK forgot :D
Code:
doTeleportThing(cid, config.thais)
I don't change "cid, config.carlin" when i have save teleport to Thais... all working on dev 0.4 xd Thanks!
 
Last edited:
Back
Top