• 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 Creator?

ELEM3NT

LUA Status: Beginner
Joined
Mar 12, 2009
Messages
191
Reaction score
0
Location
In your room without you knowing.
Okay, I am asking anyone who is willingly nice enough two make two scripts for me.

Explaining Script 1) [talkactions] First of all I'm going to make more then 1 of this script because the script is about events. Script 1 and Script 2 go along. In this script I want it so I can do use the command "/startevent 1" then a teleporter should appear in a certain pos and broadcast a message saying "The ...... event has started! TP is in depot. 2 Minutes left." That TP should send you to a certain pos where the event actually is. Then after 2 minutes after that, the portal gets removed.

Explaining Script 2) [globalevents] Its an event and so I want the ability to do it manually and to make the server do it automatically. So If you guys can please be nice enough and make me a script that does the talkaction command "/startevent 1" by itself each 30 minutes (I can just put the 30 minutes in globalevents.xml). BUT! Heres the thing. Im going to make more then one events, so I want them randomly chosen. Like for example say I have 3 startevents, /startevent 1, (Pacman Event) /startevent 2, (Snakes Event) and /startevent 3, (Maze Event). I want this script to choose randomly out of those 3 events. It's kinda hard to explain so sorry if you dont understand. Haha!

Sorry so much if I'm asking to much or if some of these words sound bossy... Also, if there are any good scripters out there I'm looking for one for my server, Ragezone OT!

Thank you, goodbye! :peace:
 
This has already been released I think.
Anyways I gave it a try:
globalevents.xml(interval="1800" means 30 min, I think :p)
Code:
<globalevent name="whatEverYouWant" interval="1800" event="script" value="[B]whatEverYouWant.lua[/B]"/>
globalevents/scripts/whatEverYouWant.lua
Code:
local t = {
    [1] = {eventMsg = "Event 1 has started", tpId = 1234, toPos = {x = 123, y = 123, z = 7}, createPos = {x = 123, y = 123, z = y}, removeTp = 30}, -- removeTp in seconds, after 30 sec the script will remove the tp
    [2] = {eventMsg = "Event 2 has started", tpId = 1234, toPos = {x = 123, y = 123, z = 7}, createPos = {x = 123, y = 123, z = y}, removeTp = 30},
    [3] = {eventMsg = "Event 3 has started", tpId = 1234, toPos = {x = 123, y = 123, z = 7}, createPos = {x = 123, y = 123, z = y}, removeTp = 30},
    }
    
function removeTp()
local tp = getThingPos(rr.createPos)
    if getTileItemById(rr.createPos, rr.tpId) then
        doRemoveItem(tp.uid, 1)
    end
end
function onThink(interval, lastExecution, thinkInterval)
local r = t[math.random(#t)
    doCreateTeleport(r.tpId, r.toPos, r.createPos)
    for _, cid in ipairs(getOnlinePlayers()) do
        doPlayerSendTextMessage(cid, TALKTYPE_EVENT_ADVANCE, r.eventMsg)
        addEvent(removeTp, r.removeTp * 1000)
        rr = r
    end
    return true
end
I think this will pretty much do it
 
LUA:
local t = {
	[1] = {name'', tp = {x=1, y=1, z=1}, tpto = {x=1, y=1, z=1}, minutes=2},
	[2] = {name'', tp = {x=1, y=1, z=1}, tpto = {x=1, y=1, z=1}, minutes=2},
	[3] = {name'', tp = {x=1, y=1, z=1}, tpto = {x=1, y=1, z=1}, minutes=2}
}

function onSay(cid, words, param)
local r, m = t[math.random(1,3)], 2
	if r then
		local tr = r
		doCreateTeleport(1387, tp, tpto)
		doBroadcastMessage('The ' .. r.name .. ' teleport has been created and will be removed in' .. r.minutes .. ' minutes.')
		return addEvent(onRemove, r.minutes*60*1000)
	end
end

function onRemove()
		doRemoveItem(getTileItemById(tr.tp, 1387).uid)
		return doBroadcastMessage('The' .. tr.name .. ' teleport has been removed.')
end

talkaction, not tested
 
Last edited:

GoddomotFronk.jpg
 
Haha @Unknown666. GODDOMOT FRONK!

Anyways, thanks everyone for helping me! It works perfectly, I just kinda combined unknowns script and Xeon's script from my other thread. Here's what I got so if anybody needs it:

LUA:
local minutes = 2 -- how many minutes you want before it removes the portal
local tp = {x=952, y=1021, z=7} -- the place where the portal will appear
local tpto = {x=949, y=1025, z=7} -- the pos of where the portal will lead you
local message = 'The Maze Event has started! To begin, enter the portal in depot, 2 minutes remaining.' -- the message that will appear once activated.
local removemessage = 'The Maze Event portal has been removed.' -- the message that will appear once tp is removed.


function onSay(cid, words, param)
	doCreateTeleport(1387, tpto, tp)
		doBroadcastMessage(message)
			return addEvent(onRemove, minutes*60*1000)
end

function onRemove()
        	local it = getTileItemById(tp, 1387).uid
	if it > 0 then
		doRemoveItem(it)
        doBroadcastMessage(removemessage)
return true
end
end

Also, can anybody still make me a globalevent script that selfsays /startevent1, /startevent2, /startevent 3 but randomly? Woah, that rhymed, 3 and randomly haha, anyways... Yeah, I'd appreciate it if you guys made me that script.

PleaseAndThankYou:peace:
 
Nonono, crap.. It's kinda hard to explain this.... umm.. I already have a script that makes a teleporter. Im just looking for a script to make it do that script automatically. So its kinda like saying I need a script to do another script. A globalevents script that uses the command: /startevent1, /startevent2, /startevent3 in random order which are scripts in talkactions. Sorry, I can't just find the right words lol..

PleaseAndThankYou^_^
 
Nonono, crap.. It's kinda hard to explain this.... umm.. I already have a script that makes a teleporter. Im just looking for a script to make it do that script automatically. So its kinda like saying I need a script to do another script. A globalevents script that uses the command: /startevent1, /startevent2, /startevent3 in random order which are scripts in talkactions. Sorry, I can't just find the right words lol..

PleaseAndThankYou^_^

why would you combine them?
And you are horrible at tabbing, lol
 
why would you combine them?
And you are horrible at tabbing, lol

Well, your script wasn't quite working. And some of Xeon's script worked and some didn't so I just combined the two and it worked liked a charm. Damn, I'm glad I'm asian^_^ I forgot all the errors n stuff but I know my tabbing is horrible. I just try to make it look pro. Haha :D!

Pce
 
Back
Top