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

[request]send all players temple - script

xubeiga

New Member
Joined
Jun 17, 2009
Messages
137
Reaction score
1
i have an otserver enforced that have two teams and two temples...
i need a script that send all players to their temples and that make them lose their pz lock...
anyone have it?
 
Goto Talkations/scripts and create a filename called "teleportall.lua"

Lua:
 function onSay(cid, words, param, channel)
	local temple = getPlayerTown(cid)
	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

Lua:
 <talkaction log="yes" words="/tpall" access="script" event="script" value="teleportall.lua"/>
 
Goto Talkations/scripts and create a filename called "teleportall.lua"

Lua:
 function onSay(cid, words, param, channel)
	local temple = getPlayerTown(cid)
	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

Lua:
 <talkaction log="yes" words="/tpall" access="script" event="script" value="teleportall.lua"/>

thanks, but it didnt work...it gave me this error:
[error - talkaction interface]
data/talkactions/scripts/teleportall.lua:eek:nSay Description:
attempt to index a number value
stack traceback:
[C]: in function 'doTeleportThing'
data/talkactions/scripts/teleportall.lua:4: in function <data/talkactions/scripts/teleportall.lua:1>

what now? ;x
 
This
Lua:
	local temple = getPlayerTown(cid)
Replace
Lua:
	local temple = getTownTemplePosition(getPlayerTown(cid))

thanks so much, it solved the problem!

doRemoveCondition(cid, CONDITION_INFIGHT)

and thanks so much for you too, cause without this the players didnt lose their pz lock.


--------------------

there is just one more problem...all players are sended to the same temple, players of acc 1/1 and 2/2...
i need that the players of account 1/1 be sended to their temple and that players of 2/2 be sended to their temple too...
can anyone help me out ?
 
that should be a problem with the map, did you set those temples as different citys?
if you did, then you have to set town to those players.

if you give me some details about how do they get into a team (how do they choose)

i can give you some code to set the town.

glad i could help :)
 
that should be a problem with the map, did you set those temples as different citys?
if you did, then you have to set town to those players.

if you give me some details about how do they get into a team (how do they choose)

i can give you some code to set the town.

glad i could help :)

well i checked the map, and there was just one town...and then i created the other one with the other temple, but the problem is still hapenning...i use /tpall and players from acc 1/1 and 2/2 are sended to the same temple, in case temple of acc 2/2...
they get into a team using acc 1/1 or 2/2...it is players choice!
:)
 
then you should do this,

in /data/creatuscript/scripts/login.lua

just below the function on login ()

local asd = getAccountNumberByPlayerName(getPlayerName(cid))
if asd = 1 then
doPlayerSetTown(cid, 1)
elseif asd = 2 then
doPlayerSetTown(cid, 2)
end

i think thats all :)
 
then you should do this,

in /data/creatuscript/scripts/login.lua

just below the function on login ()

local asd = getAccountNumberByPlayerName(getPlayerName(cid))
if asd = 1 then
doPlayerSetTown(cid, 1)
elseif asd = 2 then
doPlayerSetTown(cid, 2)
end

i think thats all :)

it gave me this:

[error - luascriptinterface::loadfile] data/creaturescripts/scripts/login.lua:7: 'then' expected near '='
[warning - event::loadscript] cannot load script <data/creaturescripts/scripts/login.lua> data/creaturescripts/login.lua:7: 'then' expected near '='
 
local asd = getAccountNumberByPlayerName(getPlayerName(cid))
if asd == 1 then
doPlayerSetTown(cid, 1)
elseif asd == 2 then
doPlayerSetTown(cid, 2)
end


like this not in the first one!!!
 
local asd = getAccountNumberByPlayerName(getPlayerName(cid))
if asd == 1 then
doPlayerSetTown(cid, 1)
elseif asd == 2 then
doPlayerSetTown(cid, 2)
end


like this not in the first one!!!

haha it worked now, but...now all players are sended to account 1/1 temple! omg
actually i configured in map:
town id 1 - temple of acc 1/1
town id 2 - temple of acc 2/2
and still not working...all players are sended to the same temple :s i think i will left it behind hah
 
Last edited:
weird, all that should be working,

the script send players to their temples.
the one i gave you sets the town id to each band.
so there may be 2 thing that are wrong
first: check if in the map editor the temples are set as different towns with the right coordinates.
second: check if the script i gave you its working, that can be made like this:
add this line to login.lua

local twn = getPlayerTown(cid)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,twn)

log in into a player of band 1 and see what the msg is
then
log in into a player of band 2 and see what the msg is

if the band 1 gets a msg 1 then its ok
if the band 2 gets a msg 2 then its ok
if not!

then by some reason they have no town set yet! and thats what you should work on!
 
why not enter
phpmyadmin and execute this query

Lua:
UPDATE players SET posx = 793, posy = 1014, posz = 7;

edit positions

or need script for other option?
 
weird, all that should be working,

the script send players to their temples.
the one i gave you sets the town id to each band.
so there may be 2 thing that are wrong
first: check if in the map editor the temples are set as different towns with the right coordinates.
second: check if the script i gave you its working, that can be made like this:
add this line to login.lua

local twn = getPlayerTown(cid)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,twn)

log in into a player of band 1 and see what the msg is
then
log in into a player of band 2 and see what the msg is

if the band 1 gets a msg 1 then its ok
if the band 2 gets a msg 2 then its ok
if not!

then by some reason they have no town set yet! and thats what you should work on!

i added that line in login.lua
and in players of both accounts (1/1 and 2/2) it showed up: 1
:/

EDIT:
IT IS NOT WORKING...i give up!
i changed the town id in database, changed acc id in script...i did all i could.
and the players ALWAYS are sended to the same temple.
well let it go, this is rly pissing me off
thanks all
 
Last edited:
well i checked the map, and there was just one town...and then i created the other one with the other temple, but the problem is still hapenning...i use /tpall and players from acc 1/1 and 2/2 are sended to the same temple, in case temple of acc 2/2...
they get into a team using acc 1/1 or 2/2...it is players choice!
:)

Obious you have to make a Citizen teleport, they have to be citizen of that town..
 
Back
Top