• 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!

TalkAction Jail System with auto kick by Gesior

Jaedy yes work for 3.5 i use...and Gesior
can make on jail ppl by slot. when ejecute command "!jail" use empty slot?
 
Hello,

much opinions here about the script. The idea is very good but it's working now? I'm reading all pages but I don't know if it's working?

btw.: Using 0.3.5pl1


best regards

Pep
 
Is it possible to make so that the "You are jailed until...blabla" popups with a "fyi" info box?
 
Try this:
Code:
	<talkaction words="!jail;!unjail;/jail;/unjail" access="4" event="script" value="jailsystem.lua"/>
Code:
-- Default jail time in seconds --
local default_jail = 30
-- The permission you need to jail someone --
local grouprequired = 4
-- StorageValue that the player gets --
local jailedstoragevalue_time = 1338
local jailedstoragevalue_bool = 1339
-- Set the position of the jail: --
local jailpos = { x = 1037, y = 1004, z =7 }
-- Set the position once unjailed: --
local unjailpos = { x = 1029, y = 1005, z =7 }
-- auto kicker, dont edit
local jail_list = {}
local jail_list_work = 0

function checkJailList(param)
	addEvent(checkJailList, 1000, {})
	for targetID, player in ipairs(jail_list) do
		if isPlayer(player) then
			if getPlayerStorageValue(player, jailedstoragevalue_time) < os.time() then
				doTeleportThing(player, unjailpos)
				setPlayerStorageValue(player, jailedstoragevalue_time, 0)
				setPlayerStorageValue(player, jailedstoragevalue_bool, 0)
				doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, 'You were kicked from jail! See you later :)')
			end
		end
		table.remove(jail_list, targetID)
	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 not isPlayer(isplayer) then
		isplayer = getPlayerByName(param:sub(jail_time:len()+1))
		if not isPlayer(isplayer) then
			isplayer = getPlayerByName(param:sub(jail_time:len()+2))
			if not isPlayer(isplayer) then
				isplayer = getPlayerByName(param:sub(jail_time:len()+3))
			end
		end
	end
	local jail_time = jail_time ~= -1 and jail_time * 60 or default_jail
	if words == '!jail' or words == '/jail' then
		if getPlayerGroupId(cid) >= grouprequired then
			if isPlayer(isplayer) then
				doTeleportThing(isplayer, jailpos)
				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) then
				doTeleportThing(isplayer, unjailpos)
				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
 
Can you fix like Jail.php so it shows who is jailed on site?

If jailed in-game so in site it shows.. instead of banishments..
 
Back
Top