• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Jail System Need Help *No errors*

patriciou

Member
Joined
Dec 26, 2009
Messages
180
Reaction score
6
Hello Otlanders, Ive got Jail system on My OT but

The problem is That when i Do /Jail *players name*

then always sends the Player to the Same Cage ( Prison Cage )

Basically what i wanted is that when the Person gets Jailed Then it Randomly Picks one of the Cages and Teleport Person to it

" It teleports player to the same Cage ! "

REP++ FOR HELP !!!



This is My Script of Jail ! :

talkactions/Scripts Jail.lua

PHP:
-- Default jail time in seconds -- 
default_jail = 600 
-- The permission you need to jail someone -- 
grouprequired = 4 
-- StorageValue that the player gets -- 
jailedstoragevalue_time = 1338 
jailedstoragevalue_bool = 1339 
-- Set the position of the jail: -- 
jailpos = { x = 1388, y = 701, z =7 },
{x=1367,y=624,z=7},
{x=1366,y=633,z=7},
{x=1393,y=627,z=7},
{x=1385,y=633,z=7},
{x=1364,y=660,z=7},
{x=1386,y=667,z=7},
{x=1345,y=680,z=7},
{x=1370,y=689,z=7},
{x=1364,y=703,z=7},
{x=1375,y=706,z=7}

-- Set the position once unjailed: -- 
unjailpos = { x = 876, y = 1025, 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! See you later :)') 
            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
 
Test with this:
Code:
-- Jail System Atualizado por CoGames --

default_jail = 30
-- Tempo em segundos que o jogador ficara preso --
grouprequired = 3
-- O god que podera prender, exemplo: 3 para Tutor, 4 para GM, 5 para Cm e 6 para GOD --
jailedstoragevalue_time = 1338
jailedstoragevalue_bool = 1339
jailpos = { x = 451, y = 493, z =7 }
-- Lugar onde fica a Cadeia --
unjailpos = { x = 477, y = 485, z =7 }
-- Lugar onde fica o Templo --
jail_list = {}
jail_list_work = 0
-- Auto Kikador, nao edite!!! --

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,'Você saiu da cadeia, tente não fazer coisas malvadas da próxima vez para não ser preso novamente. Cuide-se amigo.')
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 == '!desprender' or words == '/desprender') then
-- Acima escreva o comando para desprender --
if getPlayerStorageValue(cid, jailedstoragevalue_time) > os.time() then
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'Você foi preso até ' .. os.date("%H:%M:%S", getPlayerStorageValue(cid, jailedstoragevalue_time)) .. ' (agora é: ' .. 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, 'Your leave the prison here 1 second.')
else
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You are not stuck.')
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 == '!prender' or words == '/prender' then
-- Comando para prender --
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, 'Você foi preso '.. getCreatureName(isplayer) ..' ate ' .. os.date("%H:%M:%S", getPlayerStorageValue(isplayer, jailedstoragevalue_time)) .. ' (agora é: ' .. os.date("%H:%M:%S", os.time()) .. ').')
doPlayerSendTextMessage ( isplayer, MESSAGE_INFO_DESCR, 'Voce foi preso por '.. getCreatureName(cid) ..' ate ' .. os.date("%H:%M:%S", getPlayerStorageValue(isplayer, jailedstoragevalue_time)) .. ' (agora é: ' .. os.date("%H:%M:%S", os.time()) .. ').')
return TRUE
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This player does not exist or is offline.")
return FALSE
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are not allowed to hold players.")
return FALSE
end
elseif words == '!desprender' or words == '/desprender' then
-- Comando para tirar da cadeia --
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) .. ' see you soon...')
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You got out of prison'.. getCreatureName(isplayer) ..'.')
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Este jogador não existe ou esta offline.")
return FALSE
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are not allowed to hold players.")
return FALSE
end
end
return FALSE
end

but, traduce to english xd..
 
Its the Same :/ i Really wanted one that Randomly Picks a Position and Teleports player To it :/
I bet there is one that i cant find but if somebody will help me

REP++ FOR HELP

- - - Updated - - -

++ No its not Exacly what i Wanted :S i Wanted one The pick a Cell and Teleports player to it. Not that When i say /jail *playername* then always teleports player to the same one -.-
 
Code:
--- Created by Choconator (c)----

-- Default jail time in seconds -- 
default_jail = 30 
-- The permission you need to jail someone -- 
grouprequired = 4 
-- StorageValue that the player gets -- 
jailedstoragevalue_time = 1338 
jailedstoragevalue_bool = 1339 
-- Set the position of the jail: -- 
jailpos = { x = 1000, y = 1000, z =15 } 
-- Set the position once unjailed: -- 
unjailpos = { x = 1000, y = 1000, 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! See you later :)') 
            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
Change only position jail and back
 
I did as You said !

THats what i did :

PHP:
--- Created by Choconator (c)----


default_jail = 30 

grouprequired = 4 

jailedstoragevalue_time = 1338 
jailedstoragevalue_bool = 1339 

jailpos = { x = 1394, y = 628, z =7 },
{ x = 1367, y = 624, z =7 }
-- Set the position once unjailed: -- 
unjailpos = { x = 876, y = 1025, 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! See you later :)') 
            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


And it Still teleports the Player only to the First Position ! :/


REP++ For HELP !
 
wft very positions for send all not? I edit script by master-m
just now only need edit jail position for where jail and unjail, i edit positions in script for you here you go
You say /jail "Playername to jail someone or
You say /unjail "Playername to unjail someone

First open Talkactions.xml
LUA:
    <talkaction words="/jail" script="jailing.lua" />
    <talkaction words="/unjail" script="jailing.lua" />
now jailing.lua
LUA:
--[[
OTLAND.NET / CREDITS
  CREATED BY:
    master-m
  EDITED BY:
    Lithium: Shorten.
    Velik: Missing parts. Tested code.
    Colandus: Missing end. Works for both TFS and Evolutions. Added more "checks". Shorten alot.
]]
function onSay ( cid, words, param )
	grouprequired = 4
	jailedstoragevalue = 1338
	jailpos = { x = 1367, y = 624, z =7  }
	unjailpos = { x = 876, y = 1025, z = 7 } 
	if words == '/jail' then	
    if getPlayerGroupId ( cid ) >= grouprequired and param ~= "" and getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) == -1 then 
			jailer = getPlayerName ( cid ) 
			doTeleportThing ( getPlayerByName ( param ), jailpos, 0 )
			doPlayerSendTextMessage ( getPlayerByName ( param ), 25, 'You have been jalied by '..jailer..'' ) 
			doPlayerSendTextMessage ( cid, 21, "You just jailed "..param.."." )
			setPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue, 1 )
		elseif getPlayerGroupId ( cid ) < grouprequired then
			doPlayerSendTextMessage ( cid, 21, "You don't have access to unjail other players." )
		elseif getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) ~= -1 then
			doPlayerSendTextMessage ( cid, 21, "This Player is already jailed." )		
		else
				doPlayerSendTextMessage ( cid, 21, "You need to fill in a playername!" )
		end
	elseif words == '/unjail' then
		if getPlayerGroupId ( cid ) >= grouprequired and param ~= "" and getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) == 1 then 
			unjailer = getPlayerName ( cid )
			doTeleportThing ( getPlayerByName ( param ), unjailpos, 0 )
			doPlayerSendTextMessage ( getPlayerByName ( param ), 25, 'You have been unjailed by '..unjailer..'' )
			doPlayerSendTextMessage ( cid, 21,"You just unjailed "..param.."." )
			setPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue, -1 )
		
		elseif getPlayerGroupId ( cid ) < 4 then
			doPlayerSendTextMessage ( cid, 21, "You cannot unjail someone!" )
		elseif getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) ~= 1 then
			doPlayerSendTextMessage ( cid, 21, "This Player is already unjailed." )
		else
			doPlayerSendTextMessage ( cid, 21, "You need to fill in a playername!" )
		end	
	end		
end
 
Hey i DId that ! :

PHP:
--[[
OTLAND.NET / CREDITS
  CREATED BY:
    master-m
  EDITED BY:
    Lithium: Shorten.
    Velik: Missing parts. Tested code.
    Colandus: Missing end. Works for both TFS and Evolutions. Added more "checks". Shorten alot.
]]
function onSay ( cid, words, param )
	grouprequired = 4
	jailedstoragevalue = 1338
	jailpos = { x = 1367, y = 624, z =7 },
	{ x = 1392, y = 628, z =7 },
	{ x = 1386, y = 634, z =7 },
	{ x = 1365, y = 661, z =7 },
	{ x = 1382, y = 669, z =7 },
	{ x = 1346, y = 682, z =7 },
	{ x = 1369, y = 689, z =7 },
	{ x = 1365, y = 702, z =7 },
	{ x = 1375, y = 705, z =7 },
	{ x = 1387, y = 700, z =7 }
	unjailpos = { x = 876, y = 1025, z = 7 } 
	if words == '/jail' then	
    if getPlayerGroupId ( cid ) >= grouprequired and param ~= "" and getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) == -1 then 
			jailer = getPlayerName ( cid ) 
			doTeleportThing ( getPlayerByName ( param ), jailpos, 0 )
			doPlayerSendTextMessage ( getPlayerByName ( param ), 25, 'You have been jalied by '..jailer..'' ) 
			doPlayerSendTextMessage ( cid, 21, "You just jailed "..param.."." )
			setPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue, 1 )
		elseif getPlayerGroupId ( cid ) < grouprequired then
			doPlayerSendTextMessage ( cid, 21, "You don't have access to unjail other players." )
		elseif getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) ~= -1 then
			doPlayerSendTextMessage ( cid, 21, "This Player is already jailed." )		
		else
				doPlayerSendTextMessage ( cid, 21, "You need to fill in a playername!" )
		end
	elseif words == '/unjail' then
		if getPlayerGroupId ( cid ) >= grouprequired and param ~= "" and getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) == 1 then 
			unjailer = getPlayerName ( cid )
			doTeleportThing ( getPlayerByName ( param ), unjailpos, 0 )
			doPlayerSendTextMessage ( getPlayerByName ( param ), 25, 'You have been unjailed by '..unjailer..'' )
			doPlayerSendTextMessage ( cid, 21,"You just unjailed "..param.."." )
			setPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue, -1 )
 
		elseif getPlayerGroupId ( cid ) < 4 then
			doPlayerSendTextMessage ( cid, 21, "You cannot unjail someone!" )
		elseif getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) ~= 1 then
			doPlayerSendTextMessage ( cid, 21, "This Player is already unjailed." )
		else
			doPlayerSendTextMessage ( cid, 21, "You need to fill in a playername!" )
		end	
	end		
end


But it Only teleports Players to the First Position :/ ( jailpos = { x = 1367, y = 624, z =7 } ) << To there :/

REP++ FOR FIxing IT :/
 
try this
LUA:
--[[
OTLAND.NET / CREDITS
  CREATED BY:
    master-m
  EDITED BY:
    Lithium: Shorten.
    Velik: Missing parts. Tested code.
    Colandus: Missing end. Works for both TFS and Evolutions. Added more "checks". Shorten alot.
]]
local jpos = { 
    [1] = {x = 1102, y = 824, z = 7},
    [2] = {x = 1102, y = 824, z = 7},
    [3] = {x = 1102, y = 824, z = 7},
    [4] = {x = 1102, y = 824, z = 7},
    [5] = {x = 1102, y = 824, z = 7},
    [6] = {x = 1102, y = 824, z = 7},
    [7] = {x = 1102, y = 824, z = 7},    
    [8] = {x = 1102, y = 824, z = 7},
    [9] = {x = 1102, y = 824, z = 7},
    [10] = {x = 1151, y= 874, z = 7}
}
function onSay ( cid, words, param )
    grouprequired = 4
    jailedstoragevalue = 1338
    unjailpos = { x = 876, y = 1025, z = 7 } 
    if words == '/jail' then    
    if getPlayerGroupId ( cid ) >= grouprequired and param ~= "" and getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) == -1 then 
            jailer = getPlayerName ( cid ) 
            doTeleportThing ( getPlayerByName ( param ), jpos[1], jpos[2], jpos[3], jpos[4], jpos[5], jpos[6], jpos[7], jpos[8], jpos[9], jpos[10])
            doPlayerSendTextMessage ( getPlayerByName ( param ), 25, 'You have been jalied by '..jailer..'' ) 
            doPlayerSendTextMessage ( cid, 21, "You just jailed "..param.."." )
            setPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue, 1 )
        elseif getPlayerGroupId ( cid ) < grouprequired then
            doPlayerSendTextMessage ( cid, 21, "You don't have access to unjail other players." )
        elseif getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) ~= -1 then
            doPlayerSendTextMessage ( cid, 21, "This Player is already jailed." )        
        else
                doPlayerSendTextMessage ( cid, 21, "You need to fill in a playername!" )
        end
    elseif words == '/unjail' then
        if getPlayerGroupId ( cid ) >= grouprequired and param ~= "" and getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) == 1 then 
            unjailer = getPlayerName ( cid )
            doTeleportThing ( getPlayerByName ( param ), unjailpos, 0 )
            doPlayerSendTextMessage ( getPlayerByName ( param ), 25, 'You have been unjailed by '..unjailer..'' )
            doPlayerSendTextMessage ( cid, 21,"You just unjailed "..param.."." )
            setPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue, -1 )
 
        elseif getPlayerGroupId ( cid ) < 4 then
            doPlayerSendTextMessage ( cid, 21, "You cannot unjail someone!" )
        elseif getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) ~= 1 then
            doPlayerSendTextMessage ( cid, 21, "This Player is already unjailed." )
        else
            doPlayerSendTextMessage ( cid, 21, "You need to fill in a playername!" )
        end    
    end        
end
 
Hey i Pasted Your code in But when i Try to Jail somebody I get this Error :

PHP:
[Error - TalkAction Interface]
data/talkactions/scripts/jail system/jail.lua:onSay
Description:
(luaDoTeleportThing) Thing not found

REP ++ For HELP !
 
try this
LUA:
--[[
OTLAND.NET / CREDITS
  CREATED BY:
    master-m
  EDITED BY:
    Lithium: Shorten.
    Velik: Missing parts. Tested code.
    Colandus: Missing end. Works for both TFS and Evolutions. Added more "checks". Shorten alot.
]]
local jpos = { 
    [1] = {x = 1102, y = 824, z = 7},
    [2] = {x = 1102, y = 824, z = 7},
    [3] = {x = 1102, y = 824, z = 7},
    [4] = {x = 1102, y = 824, z = 7},
    [5] = {x = 1102, y = 824, z = 7},
    [6] = {x = 1102, y = 824, z = 7},
    [7] = {x = 1102, y = 824, z = 7},    
    [8] = {x = 1102, y = 824, z = 7},
    [9] = {x = 1102, y = 824, z = 7},
    [10] = {x = 1151, y= 874, z = 7}
}
function onSay ( cid, words, param )
local rand = math.random(#jpos)
    grouprequired = 4
    jailedstoragevalue = 1338
    unjailpos = { x = 876, y = 1025, z = 7 } 
    if words == '/jail' then    
    if getPlayerGroupId ( cid ) >= grouprequired and param ~= "" and getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) == -1 then 
            jailer = getPlayerName ( cid ) 
            doTeleportThing(cid, jpos[rand], true)
            doPlayerSendTextMessage ( getPlayerByName ( param ), 25, 'You have been jalied by '..jailer..'' ) 
            doPlayerSendTextMessage ( cid, 21, "You just jailed "..param.."." )
            setPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue, 1 )
        elseif getPlayerGroupId ( cid ) < grouprequired then
            doPlayerSendTextMessage ( cid, 21, "You don't have access to unjail other players." )
        elseif getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) ~= -1 then
            doPlayerSendTextMessage ( cid, 21, "This Player is already jailed." )        
        else
                doPlayerSendTextMessage ( cid, 21, "You need to fill in a playername!" )
        end
    elseif words == '/unjail' then
        if getPlayerGroupId ( cid ) >= grouprequired and param ~= "" and getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) == 1 then 
            unjailer = getPlayerName ( cid )
            doTeleportThing ( getPlayerByName ( param ), unjailpos, 0 )
            doPlayerSendTextMessage ( getPlayerByName ( param ), 25, 'You have been unjailed by '..unjailer..'' )
            doPlayerSendTextMessage ( cid, 21,"You just unjailed "..param.."." )
            setPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue, -1 )
 
        elseif getPlayerGroupId ( cid ) < 4 then
            doPlayerSendTextMessage ( cid, 21, "You cannot unjail someone!" )
        elseif getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) ~= 1 then
            doPlayerSendTextMessage ( cid, 21, "This Player is already unjailed." )
        else
            doPlayerSendTextMessage ( cid, 21, "You need to fill in a playername!" )
        end    
    end        
end
 
I tried You Script again But Now What happens is :

When i Will say /Jail (Player Name) Then it Doesnt Jail the Person but it Jails Me

So Basically :

Me : Admin Cintravia
Player : Person that is Being Jailed

Admin Cintravia Says a Command /Jail Player
but it Doesnt Jail the Player
it Jails Admin Cintravia

(Explaining it More)

Person that Will say the Command /jail *playername*
That person will get jailed himself and the Player will stay in the Same place ! :/

REPP +++ FOR HELp
 
Its ok Because it Teleports To Random Positions But what i Mean is That when Ill say Command /jail Player then it doesnt jail the Player but it jails Me (ADMIN)


It Jails the Person That Said the Command
 
made by is why not have function isplayer?
try this
LUA:
--[[
OTLAND.NET / CREDITS
  CREATED BY:
    master-m
  EDITED BY:
    Lithium: Shorten.
    Velik: Missing parts. Tested code.
    Colandus: Missing end. Works for both TFS and Evolutions. Added more "checks". Shorten alot.
]]
local jpos = { 
    [1] = {x = 1102, y = 824, z = 7},
    [2] = {x = 1102, y = 824, z = 7},
    [3] = {x = 1102, y = 824, z = 7},
    [4] = {x = 1102, y = 824, z = 7},
    [5] = {x = 1102, y = 824, z = 7},
    [6] = {x = 1102, y = 824, z = 7},
    [7] = {x = 1102, y = 824, z = 7},    
    [8] = {x = 1102, y = 824, z = 7},
    [9] = {x = 1102, y = 824, z = 7},
    [10] = {x = 1151, y= 874, z = 7}
}

function onSay ( cid, words, param )
local rand = math.random(#jpos)
    grouprequired = 4
    jailedstoragevalue = 1338
    unjailpos = { x = 876, y = 1025, z = 7 } 
    if words == '/jail' then    
    if getPlayerGroupId ( cid ) >= grouprequired and param ~= "" and getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) == -1 then 
            jailer = getPlayerName ( cid ) 
            doTeleportThing(isplayer, jpos[rand], TRUE)
            doPlayerSendTextMessage ( getPlayerByName ( param ), 25, 'You have been jalied by '..jailer..'' ) 
            doPlayerSendTextMessage ( cid, 21, "You just jailed "..param.."." )
            setPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue, 1 )
        elseif getPlayerGroupId ( cid ) < grouprequired then
            doPlayerSendTextMessage ( cid, 21, "You don't have access to unjail other players." )
        elseif getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) ~= -1 then
            doPlayerSendTextMessage ( cid, 21, "This Player is already jailed." )        
        else
                doPlayerSendTextMessage ( cid, 21, "You need to fill in a playername!" )
        end
    elseif words == '/unjail' then
        if getPlayerGroupId ( cid ) >= grouprequired and param ~= "" and getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) == 1 then 
            unjailer = getPlayerName ( cid )
            doTeleportThing ( getPlayerByName ( param ), unjailpos, 0 )
            doPlayerSendTextMessage ( getPlayerByName ( param ), 25, 'You have been unjailed by '..unjailer..'' )
            doPlayerSendTextMessage ( cid, 21,"You just unjailed "..param.."." )
            setPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue, -1 )
 
        elseif getPlayerGroupId ( cid ) < 4 then
            doPlayerSendTextMessage ( cid, 21, "You cannot unjail someone!" )
        elseif getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) ~= 1 then
            doPlayerSendTextMessage ( cid, 21, "This Player is already unjailed." )
        else
            doPlayerSendTextMessage ( cid, 21, "You need to fill in a playername!" )
        end    
    end        
end
 
Ive done as you said but i get This Error when im trying to jail somebody !:

PHP:
[Error - TalkAction Interface]
data/talkactions/scripts/jail system/jail.lua:onSay
Description:
(luaDoTeleportThing) Thing not found
 
Back
Top