• 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 {Advanced} Jail system

gigastar

Member
Joined
Jan 25, 2009
Messages
252
Reaction score
15
I know its a released system, but this is mine.


Talkaction:
Lua:
local jailpositions = {
 [1] = {x = 1000, y = 1000, z = 7, stackpos = 253},
 [2] = {x = 1000, y = 1000, z = 7, stackpos = 253},
 [3] = {x = 1000, y = 1000, z = 7, stackpos = 253},
 [4] = {x = 1000, y = 1000, z = 7, stackpos = 253},
 [5] = {x = 1000, y = 1000, z = 7, stackpos = 253},
 [6] = {x = 1000, y = 1000, z = 7, stackpos = 253}
 }

local allowed_to_jail = 3

function onSay(cid, words, param, channel)
if getPlayerAccess(cid) >= allowed_to_jail then

if (param == "/jail") then
		t = string.explode(param, ",")
		local t[1] = jailTime
			if (t[1] == true) then
			if t[2] == true then
				for i, position in ipairs(jailposition) do
					if (not isPlayer(position)) then
							doTeleportThing(param, position)
							setPlayerStorageValue(param, Jailed, 1)
							doPlayerSendTextMessage(param, MESSAGE_STATUS_CONSOLE_RED, "You have been jailed for " .. jailTime .. " with comment: " .. comment .. "")
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Player Jailed.")
						end
					return false
				end
else
		for i, position in ipairs(jailposition) do
			if (not isPlayer(position)) then
				    doTeleportThing(param, position) 
					setPlayerStorageValue(param, Jailed, 1)
					doPlayerSendTextMessage(param, MESSAGE_STATUS_CONSOLE_RED, "You have been jailed for " .. jailTime .. ".")
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Player Jailed.")
				end
			return false
			end
		end

else
	doPlayerSendCancel(cid, "You must type a players name")
	return false
end

elseif (param == "/unjail") then
t = string.explode(param, ",")
	if (t[1] == true) then
		if getPlayerStorageValue(param, Jailed) == 1 then
		doTeleportThing(param, getPlayerTownId(param))
		setPlayerStorageValue(param, Jailed, 0)
	else
		doPlayerSendCancel(cid, "This player is not jailed.")
	return false
	end
	else
		doPlayerSendCancel(cid, "You must type a player name.")
		return false
	end
end
end
return true
end


Code:
<globalevent name="check jail" interval="60000" event="script" value="checkjail.lua"/>

60000 if 1 minute i believe, thats why its set like this.

60 * 1000ms 1000ms is 1 second so 60 * 1 second = 60 seconds = 1 minute.. I think this is how it goes.

Anyway, enjoy. The script checks for open jail position.


[EDITED]

Code:
<talkaction log="yes" access="3" words="/jail;/unjail" event="script" value="jail system.lua"/>

Usage: /jail noob, 35, being a noob

Edited the talkaction script. Saw flaws. Hopefully 100% now.
 
Last edited:
Thanks mate. Waiting you on skype :)

Btw, post the rows on talkactions.xml. Small confusing
 
awsome, :)

- - - Updated - - -

I'll test it later but if it works makes jail systems much better because can have more then one jail
 
Back
Top