mayNotMovedoCreatureSetNoMove ?![]()
if getPlayerStorageValue(cid,storage) == value then
doTeleportThing(cid, fromPosition)
doPlayerSendCancel(cid,"You cant train anymore")
return true
end
if getPlayerSkillLevel(cid, skill) == blabla and getPlayerStorageValue(cid,storage) ~= value then then
doTeleportthing(cid,pos)
setPlayerStorageValue(cid,storage,value)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"You have reached the maximum skill for training.")
return true
end
end
The original idea, was making a training room with skill limit, after a X skill, the player is kicked out and is not able to enter again. I did it using creaturescript, but it didn't worked(I can show the script if anyone want). D: D: D:
registerCreatureEvent(cid, "TrainKick")
registerCreatureEvent(cid, "PlayerDeath")
<event type="think" name="TrainKick" event="script" value="TrainingKick.lua"/>
function onThink(cid, interval)
local cfg = {
SkillToTeleport = XXX, -- If this skill or higher you will be teleported to ToPos
storage = XXXX, -- Storage added when entering room. Should be the same as storage in the movement script.
ToPos = { x = XXX, y = YYY, z = ZZZ }, -- The Kick Position.
notAllowedStorage = XXXX, -- Storage given so you cant enter the room again. Should be same as notAllowedStorage in the movement script.
KickMessage = "You have been kicked from the training room due to high skills!",
}
-- DONT EDIT ANYTHING BELOW THIS IF YOU DONT KNOW WHAT YOU ARE DOING! --
if getPlayerSkillLevel(cid, 0) >= cfg.SkillToTeleport or getPlayerSkillLevel(cid, 1) >= cfg.SkillToTeleport or getPlayerSkillLevel(cid, 2) >= cfg.SkillToTeleport or getPlayerSkillLevel(cid, 3) >= cfg.SkillToTeleport or getPlayerSkillLevel(cid, 4) >= cfg.SkillToTeleport or getPlayerSkillLevel(cid, 5) >= cfg.SkillToTeleport then
if getPlayerStorageValue(cid, cfg.storage) == 1 then
doTeleportThing(cid, cfg.ToPos, FALSE)
doSendMagicEffect(cfg.ToPos, 13)
setPlayerStorageValue(cid, cfg.storage, 0)
setPlayerStorageValue(cid, cfg.notAllowedStorage, 1)
doPlayerSendCancel(cid, cfg.KickMessage)
end
end
return TRUE
end
<movevent type="StepIn" actionid="[B]XXXX[/B]" event="script" value="TrainTeleport.lua" />
function onStepIn(cid, item, pos)
local cfg = {
storage = XXXX, -- Should be same storage as the storage in the creaturescript.
ToPos = { x = XXX, y = YYY, z = ZZZ }, -- Pos to get teleported into the training room.
notAllowedStorage = XXXX, -- Storage when not allowed to enter the room again. Should be same as the notAllowedStorage in the creaturescript.
actionid = XXXX, -- The action id used on the teleporting tile.
notAllowedMessage = "You have to high skills to use the training room!",
}
-- DONT EDIT ANYTHING BELOW THIS IF YOU DONT KNOW WHAT YOU ARE DOING! --
if isPlayer(cid) then
if item.actionid == cfg.actionid then
if getPlayerStorageValue(cid, cfg.notAllowedStorage) ~= 1 then
doTeleportThing(cid, cfg.ToPos, FALSE)
doSendMagicEffect(cfg.ToPos, 13)
setPlayerStorageValue(cid, cfg.storage, 1)
else
doPlayerSendCancel(cid, notAllowedMessage)
end
end
end
return TRUE
end