• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Jail System

freak15

Professional Hoster
Joined
Dec 31, 2008
Messages
356
Reaction score
2
Location
Sweden
Here comes a jail system for rl tibia map or u can change it to ur position..

Add This To data/talkactions/talkactions.xml

HTML:
	<talkaction words="!jail" script="jailsystem.lua"/>
    <talkaction words="!unjail" script="jailsystem.lua"/>
    <talkaction words="/jail" script="jailsystem.lua"/>
    <talkaction words="/unjail" script="jailsystem.lua"/>

And Add This To Our Data/talkactions/scripts
Make A File calld jailsystem.lua

HTML:
-- Default jail time in seconds --
default_jail = 1500
-- The permission you need to jail someone --
grouprequired = 3
-- StorageValue that the player gets --
jailedstoragevalue_time = 1338
jailedstoragevalue_bool = 1339
-- Set the position of the jail: --
jailpos = { x = 32392, y = 32188, z =7 }
-- Set the position once unjailed: --
unjailpos = { x = 32369, y = 32241, z =7 }
-- auto kicker, dont edit
jail_list = {}
jail_list_work = 0

function checkJailList(param)
    addEvent(checkJailList, 1000, {})
    for targetID,player in ipairs(jail_list) do
        if isPlayer(player) == TRUE then
            if getPlayerStorageValue(player, jailedstoragevalue_time) < os.time() then
                doTeleportThing(player, unjailpos, TRUE)
                setPlayerStorageValue(player, jailedstoragevalue_time, 0)
                setPlayerStorageValue(player, jailedstoragevalue_bool, 0)
                table.remove(jail_list,targetID)
                doPlayerSendTextMessage(player,MESSAGE_STATUS_CONSOLE_ORANGE,'You were kicked from jail! Make sure to follow the rules from now on !')
            end
        else
            table.remove(jail_list,targetID)
        end
    end
end

function onSay(cid, words, param)
    if jail_list_work == 0 then
        jail_list_work = addEvent(checkJailList, 1000, {})
    end
    if param == '' and (words == '!unjail' or words == '/unjail') then
        if getPlayerStorageValue(cid, jailedstoragevalue_time) > os.time() then
            doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You are jailed until ' .. os.date("%H:%M:%S", getPlayerStorageValue(cid, jailedstoragevalue_time)) .. ' (now is: ' .. os.date("%H:%M:%S", os.time()) .. ').') 
        else
            if getPlayerStorageValue(cid, jailedstoragevalue_bool) == 1 then
                table.insert(jail_list,cid)
                doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You will be kicked from jail in one second.')
            else
                doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You are not jailed.')
            end
        end
        return TRUE
    end
    local jail_time = -1
    for word in string.gmatch(tostring(param), "(%w+)") do
        if tostring(tonumber(word)) == word then
            jail_time = tonumber(word)
        end
    end
    local isplayer = getPlayerByName(param)
    if isPlayer(isplayer) ~= TRUE then
        isplayer = getPlayerByName(string.sub(param, string.len(jail_time)+1))
        if isPlayer(isplayer) ~= TRUE then
            isplayer = getPlayerByName(string.sub(param, string.len(jail_time)+2))
            if isPlayer(isplayer) ~= TRUE then
                isplayer = getPlayerByName(string.sub(param, string.len(jail_time)+3))
            end
        end
    end
    if jail_time ~= -1 then
        jail_time = jail_time * 60
    else
        jail_time = default_jail
    end
    if words == '!jail' or words == '/jail' then
        if getPlayerGroupId ( cid ) >= grouprequired then
            if isPlayer(isplayer) == TRUE then
                doTeleportThing(isplayer, jailpos, TRUE)
                setPlayerStorageValue(isplayer, jailedstoragevalue_time, os.time()+jail_time)
                setPlayerStorageValue(isplayer, jailedstoragevalue_bool, 1)
                table.insert(jail_list,isplayer)
                doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You jailed '.. getCreatureName(isplayer) ..' until ' .. os.date("%H:%M:%S", getPlayerStorageValue(isplayer, jailedstoragevalue_time)) .. ' (now is: ' .. os.date("%H:%M:%S", os.time()) .. ').') 
                doPlayerSendTextMessage ( isplayer, MESSAGE_INFO_DESCR, 'You have been jailed by '.. getCreatureName(cid) ..' until ' .. os.date("%H:%M:%S", getPlayerStorageValue(isplayer, jailedstoragevalue_time)) .. ' (now is: ' .. os.date("%H:%M:%S", os.time()) .. ').') 
                return TRUE
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player with this name doesn\'t exist or is offline.")
                return FALSE
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have access to unjail other players.")
            return FALSE
        end
    elseif words == '!unjail' or words == '/unjail' then
        if getPlayerGroupId ( cid ) >= grouprequired then
            if isPlayer(isplayer) == TRUE then
                doTeleportThing(isplayer, unjailpos, TRUE)
                setPlayerStorageValue(isplayer, jailedstoragevalue_time, 0)
                setPlayerStorageValue(isplayer, jailedstoragevalue_bool, 0)
                table.remove(jail_list,targetID)
                doPlayerSendTextMessage(isplayer,MESSAGE_STATUS_CONSOLE_ORANGE,getCreatureName(cid) .. ' let you go out from jail! See you later :)')
                doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You unjailed '.. getCreatureName(isplayer) ..'.')
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player with this name doesn\'t exist or is offline.")
                return FALSE
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have access to unjail other players.")
            return FALSE
        end
    end
    return FALSE
end


Rep++ Please Script Is Not Made By me!
 
not work in TFS 0.33 8.42

04/06/2009 16:10:16] [Warning - Event::loadScript] Can not load script (data/talkactions/scripts/jailsystem.lua)
[04/06/2009 16:10:16] data/talkactions/scripts/jailsystem.lua:1: unexpected symbol near 'ÿ'
[04/06/2009 16:10:16] [Warning - Event::loadScript] Can not load script (data/talkactions/scripts/jailsystem.lua)
[04/06/2009 16:10:16] data/talkactions/scripts/jailsystem.lua:1: unexpected symbol near 'ÿ'
[04/06/2009 16:10:16] [Warning - Event::loadScript] Can not load script (data/talkactions/scripts/jailsystem.lua)
[04/06/2009 16:10:16] data/talkactions/scripts/jailsystem.lua:1: unexpected symbol near 'ÿ'
[04/06/2009 16:10:16] [Warning - Event::loadScript] Can not load script (data/talkactions/scripts/jailsystem.lua)
[04/06/2009 16:10:16] data/talkactions/scripts/jailsystem.lua:1: unexpected symbol near 'ÿ'
 
With this can you rescript it to send a player to Temple, for example !temple Daniel and that will send this player to a Position for this matter temple :D
 
- Add talkactions/scripts/tpall.lua
Lua:
function onSay(cid, words, param, channel)
local temple = { x = 32360, y = 31782, z = 7 }  
        for _, cid in ipairs(getPlayersOnline()) do
if  (getPlayerGroupId(cid) < 6) then 
                if(param == 'temple') then
                        doTeleportThing(cid, temple)
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to the temple.")
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)

        elseif(param == '') then
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "HELP: Use !tpall 32360, 31782, 7 or !tpall temple.")

                else

                local t = string.explode(param, ",")
                        doTeleportThing(cid, { x = t[1], y = t[2], z = t[3] }  )
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "All players have been teleported to the coords [X:"..t[1].."], [Y:"..t[2].."], [Z:"..t[3].."]")
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_YELLOW)
end
                end
        end
        return TRUE
end

- Add talkactions/talkactions.xml
Lua:
<talkaction log="yes" words="!tpall" access="5" event="script" value="tpall.lua"/>

:peace:
 
Back
Top