Kod PHP:
-- [( Edited by DoidinMapper )] --
default_jail = 10800
grouprequired = 3
jailedstoragevalue_time = 1338
jailedstoragevalue_bool = 1339
jailpos1 = { x = 9, y = 9, z = 9 }
jailpos2 = { x = 9, y = 9, z = 9 }
jailpos3 = { x = 9, y = 9, z = 9 }
jailpos4 = { x = 9, y = 9, z = 9 }
jailpos5 = { x = 9, y = 9, z = 9 }
jailpos6 = { x = 9, y = 9, z = 9 }
jailpos7 = { x = 9, y = 9, z = 9 }
unjailpos = { x = 9, y = 10, z = 9 }
rd = math.random(1, 7)
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_CONS OLE_ORANGE,'You were kicked from arrest! 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 == '!unarrest' or words == '/unarrest') then
if getPlayerStorageValue(cid, jailedstoragevalue_time) > os.time() then
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You are arrested 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 arrest in one second.')
else
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You are not arrested.')
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 == '!arrest' or words == '/arrest' then
if getPlayerGroupId ( cid ) >= grouprequired then
if isPlayer(isplayer) == TRUE then
if rd == 1 then
doTeleportThing(isplayer, jailpos1)
elseif rd == 2 then
doTeleportThing(isplayer, jailpos2)
elseif rd == 3 then
doTeleportThing(isplayer, jailpos3)
elseif rd == 4 then
doTeleportThing(isplayer, jailpos4)
elseif rd == 5 then
doTeleportThing(isplayer, jailpos5)
elseif rd == 6 then
doTeleportThing(isplayer, jailpos6)
elseif rd == 7 then
doTeleportThing(isplayer, jailpos7)
end
setPlayerStorageValue(isplayer, jailedstoragevalue_time, os.time()+jail_time)
setPlayerStorageValue(isplayer, jailedstoragevalue_bool, 1)
table.insert(jail_list,isplayer)
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You arrested '.. 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, 'In the name of law you have been arrested 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 unarrest other players.")
return FALSE
end
elseif words == '!unarrest' or words == '/unarrest' 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_CO NSOLE_ORANGE,getCreatureName(cid) .. ' let you go out from arrest! See you later')
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You unarrested '.. 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 unarrest other players.")
return FALSE
end
end
return FALSE
end
dodałem:
Kod PHP:
if rd == 1 then
doTeleportThing(isplayer, jailpos1)
elseif rd == 2 then
doTeleportThing(isplayer, jailpos2)
elseif rd == 3 then
doTeleportThing(isplayer, jailpos3)
elseif rd == 4 then
doTeleportThing(isplayer, jailpos4)
elseif rd == 5 then
doTeleportThing(isplayer, jailpos5)
elseif rd == 6 then
doTeleportThing(isplayer, jailpos6)
elseif rd == 7 then
doTeleportThing(isplayer, jailpos7)
end
Kod PHP:
jailpos1 = { x = 9, y = 9, z = 9 }
jailpos2 = { x = 9, y = 9, z = 9 }
jailpos3 = { x = 9, y = 9, z = 9 }
jailpos4 = { x = 9, y = 9, z = 9 }
jailpos5 = { x = 9, y = 9, z = 9 }
jailpos6 = { x = 9, y = 9, z = 9 }
jailpos7 = { x = 9, y = 9, z = 9 }
zawwsze losuje tą samę lokacje
Zakładki