JDB
OtLand Veteran
- Joined
- Jun 1, 2009
- Messages
- 4,145
- Solutions
- 2
- Reaction score
- 115
Here is a script I made that can be used for training areas.
It is great actually, I thought I would release it here.
Please do not release it on other forums.
Reputation is always welcome, hope you like it.
Movements:
Script:
How It Works: (Quick Example)
Good Luck :thumbup:
It is great actually, I thought I would release it here.
Please do not release it on other forums.
Reputation is always welcome, hope you like it.
Movements:
Lua:
<movevent type="StepIn" itemid="XXXX" event="script" value="training tile.lua"/>
<movevent type="StepOut" itemid="XXXX" event="script" value="training tile.lua"/>
Script:
Lua:
local config = {
new_Pos = {x=95, y=117, z=7}, -- Players New Position (After teleported)
storage = 12345, -- Players Storage
timeToRemove = 15, -- MINUTES
timeToResolve = 60 -- SECONDS
}
local event = 0
function onStepIn(cid, item, frompos, item2, topos)
local playerPos = getCreaturePosition(cid)
if(playerPos ~= config.new_Pos) then
doPlayerPopupFYI(cid, "Training Moderator: \n \nYou now have [".. config.timeToRemove .." minutes] to train without disturbance. \nYou are noted that botting is illegal.")
setPlayerStorageValue(cid, config.storage, 1)
event = addEvent(_doTeleportThing, config.timeToRemove * 60000, cid)
end
end
function onStepOut(cid, item, frompos, item2, topos)
if(playerPos ~= config.new_Pos) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your training session has ended.")
setPlayerStorageValue(cid, config.storage, -1)
stopEvent(event)
end
end
local event2 = 0
function _doTeleportThing(cid)
if(getPlayerStorageValue(cid, config.storage) == 1) then
doPlayerPopupFYI(cid, "Training Moderator: \n \nStep [OFF and ON] the tile to continue training. \nYou have [".. config.timeToResolve .." seconds] to complete this request.")
event2 = addEvent(expireTime, config.timeToResolve * 1000, cid)
end
end
function expireTime(cid)
if(isPlayer(cid) == TRUE) then
setPlayerStorageValue(cid, config.storage, -1)
doPlayerPopupFYI(cid, "Training Moderator: \n \nYou did not comply with the request. \nTherefor you were teleported.")
doTeleportThing(cid, config.new_Pos)
stopEvent(event2)
end
end
How It Works: (Quick Example)
- You step on the tile, it starts a timed session.
- After the time is up, a message will appear.
- It will tell you to step off and on the tile, to restart the time.
- If you do not respond within 60 seconds, it will teleport you out.
- If decide to stop training, when you step off, a message will appear.
Good Luck :thumbup: