I know its a released system, but this is mine.
Talkaction:
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]
Usage: /jail noob, 35, being a noob
Edited the talkaction script. Saw flaws. Hopefully 100% now.
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: