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

Train Problem.

ka9

New Member
Joined
Jul 25, 2009
Messages
32
Reaction score
0
I made a scriptt to train, when the player clik on the door + a player is teleported when other players come and click on the door will say that training is busy.

function onUse(cid, item, pos)
local toPos = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=253}
local tooPos = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=253}

if not isPlayer(getThingfromPos(toPos).uid) then
doTeleportThing(cid, toPos)
doSendMagicEffect(getCreaturePosition(cid), 12)
elseif not isPlayer(getThingfromPos(tooPos).uid) then
doTeleportThing(cid, tooPos)
doSendMagicEffect(getCreaturePosition(cid), 12)
else
doPlayerSendTextMessage(cid,20, "Essa sala de treinamento está ocupada.")
end
return TRUE
end


The problem comes when the player stands in front of the door, the player who is in on the training can not leave, he just quit when the player leaves the front door.
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if not isPlayer(getThingfromPos(fromPosition).uid) then
		doTeleportThing(cid, toPosition, false)
		doSendMagicEffect(toPosition, 12)
	elseif not isPlayer(getThingfromPos(toPosition).uid) then
		doTeleportThing(cid, toPosition, false)
		doSendMagicEffect(toPosition, 12)
	else
		doPlayerSendCancel(cid, "Essa sala de treinamento está ocupada")
	end
	return true
end
i still dont get it what its supposed to do
 
When the player arrives at the door and use it um+ is teleported into the training, when it comes to others and use, the door will say that training is busy.
 
Try it:
Lua:
function onUse(cid, item, pos)
local toPos = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=253}
local tooPos = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=253}
if not isPlayer(getThingfromPos(toPos).uid) then
doTeleportThing(cid, toPos)
doSendMagicEffect(getCreaturePosition(cid), 12)
else
doTeleportThing(cid, tooPos)
doSendMagicEffect(getCreaturePosition(cid), 12)
doPlayerSendTextMessage(cid,20, "Essa sala de treinamento está ocupada.")
end
return TRUE
end
 
Xeon his problem is that when some1 want to exit training he can't do this (when other player is staying in front of the exit) because there is a check isPlayer.
 
wesoly136, your script is a problem when the player out of the train appears "This training room is busy"
 
so?

function onUse(cid, item, pos)
local toPos = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=253}
local tooPos = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=253}
if not isPlayer(getThingfromPos(toPos).uid) then
doTeleportThing(cid, toPos)
doSendMagicEffect(getCreaturePosition(cid), 12)
else
doPlayerSendTextMessage(cid,20, "Essa sala de treinamento está ocupada.")
doTeleportThing(cid, tooPos)
doSendMagicEffect(getCreaturePosition(cid), 12)
end
return TRUE
end
 
function onUse(cid, item, pos)
local tooPos = {x=pos.x,y=pos.y-1,z=pos.z,stackpos=253}
local toPos = {x=pos.x,y=pos.y+1,z=pos.z,stackpos=253}
if not isPlayer(getThingfromPos(toPos).uid) then
doTeleportThing(cid, toPos)
doSendMagicEffect(getCreaturePosition(cid), 12)
else
doPlayerSendTextMessage(cid,20, "Essa sala de treinamento está ocupada.")
doTeleportThing(cid, tooPos)
doSendMagicEffect(getCreaturePosition(cid), 12)
end
return TRUE
end
 
Better I can do it as movement:
Is player1 training then you can't enter this tile, when the training tile you can enter the tile. Look:
Red or blue tile it's the tile which you cannot enter if training "room" is busy
 

Attachments

Back
Top