local c = {
storage = 12012, -- empty storage
remove_time = 0.3, -- minutes interval of time to remove soul
soul_removed = 50, --number of soul point resmover every interval of time
teleport = true, -- i thought this could help you out, if you dont want it just set it to false this tp player to a certain place when his soul finished out.
place = {x=1,y=1,z=1}, -- the place player will be tped to when his soul is out
dont_allow = true -- This dont allow player to get into training tile if her dont have enough soul
}
function removeSoul(cid,value) -- removeing soul
if getPlayerByNameWildcard(getCreatureName(cid)) ~= nil then
if getPlayerStorageValue(cid,c.storage) > 0 then
if getPlayerSoul(cid) > 0 then
doPlayerAddSoul(cid, - value)
doPlayerSendTextMessage(cid,27,"Training system : "..c.soul_removed.." soul point removed.")
addEvent(removeSoul , c.remove_time*60*1000, cid, value)
else
if c.teleport == true then
doTeleportThing(cid,c.place,false)
doSendMagicEffect(c.place,10)
doPlayerSendTextMessage(cid,21,"You have been teleported outside training spot as you soul have finished.")
setPlayerStorageValue(cid,c.storage,-1)
end
end
else
doPlayerSendTextMessage(cid,27,"You didnt have right storage.")
end
else
doPlayerSendTextMessage(cid,27,"Seems your name is not correct ??!!.")
end
end
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getPlayerSoul(cid) > c.soul_removed then
doPlayerSendTextMessage(cid,25,"Training system started, every "..c.remove_time.." minutes "..c.soul_removed.." soul point will be removed from you, untill your soul end and you will be teleported outside.")
setPlayerStorageValue(cid,c.storage,1)
addEvent(removeSoul , c.remove_time*60*1000, cid, c.soul_removed)
elseif c.dont_allow == true and getPlayerSoul(cid) < 1 then
doTeleportThing(cid,fromPosition,false)
doSendMagicEffect(fromPosition,2)
doPlayerSendTextMessage(cid,27,"You can't train while your soul is less than "..c.soul_removed.." points.")
end
return true
end
function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getPlayerStorageValue(cid,c.storage) > 0 then
setPlayerStorageValue(cid,c.storage,-1)
doPlayerSendTextMessage(cid,25,"Training system : disactivated.")
end
return true
end