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

Solved Able to enter a teleport when 30+ online

Ghazer

Member
Joined
Mar 13, 2009
Messages
350
Reaction score
6
Able to enter a teleport when 30+ online

Its possible? what is variables?

TP position: 1000 1000 7... If 30+ players online you can use teleport, but if not message "You may not use this teleport with less than 30 players online"
 
Last edited:
It took me 3min, so i hope it works :/

At Movements/movements.xml add this line:
XML:
<movevent type="StepIn" actionid="1337" event="script" value="onlinetp.lua"/>

Now at Movements/scripts create new lua and name it "onlinetp" and paste this code below:
Lua:
local Cyko = {
	Pos = {x = 1000, y = 1000, z = 7}, --Where they get teleported
	Count = 30, --How many players have to be online, to enter the teleport
}

function onStepIn(cid, item, position, fromPos, fromPosition)
	local Online = getWorldCreatures()
        if isPlayer(cid) then
	if Online < Cyko.Count then
		doPlayerSendTextMessage(cid,27, "Sorry, but its only "..Online.." Players Online. Have to be "..Cyko.Count.."+ Players online, to enter this teleport.")
		doTeleportThing(cid, fromPosition, true)
		doSendMagicEffect(fromPos, CONST_ME_TELEPORT) 
		return true
	elseif Online == Cyko.Count then
		doTeleportThing(cid, Cyko.Pos) 
		doSendMagicEffect(Cyko.Pos, CONST_ME_TELEPORT) 
		doSendMagicEffect(position, CONST_ME_TELEPORT) 
	elseif Online > Cyko.Count then
		doTeleportThing(cid, Cyko.Pos)
		doSendMagicEffect(Cyko.Pos, CONST_ME_TELEPORT) 
		doSendMagicEffect(position, CONST_ME_TELEPORT) 
		end
        end
	return true
end

Enjoy!
 
Last edited:
Dont work... message appear but I can use teleport...
zs9Va.png
 
Last edited:
Okidoki!

- - - Updated - - -

I dont understand you added that it have to be 25 players? how did you expect to enter when its 1 player online?
 
I can enter to teleport... I want if 30 players+ you can use teleport, if -30 (or 25 I change that)you cant
 
I create that based on your script and works... Thank you Cyko! I already give REP to you :)

Lua:
local pos = {x = 986, y = 1116, z = 6}
function onStepIn(cid, item, position, fromPosition)
    local online = getWorldCreatures()
    if isPlayer(cid) then
	if online < 30 then
		doTeleportThing(cid, pos)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
		doPlayerSendTextMessage(cid,22,"Sorry, server need 30 or more players online to enter")
		end
        end
	return true
end

PD: I think this true are bad in your script
doTeleportThing(cid, fromPosition, true)
 
Back
Top