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

Solved Problem Jail system + !teleport. Help

Zielas92

New Member
Joined
Oct 24, 2010
Messages
17
Reaction score
0
Hello.
I have a problem with Jail system and command !teleport. So, how to do that it could not be use the command !teleport in Jail ? This is script on Jail system:

Code:
-- Default jail time in seconds -- 
default_jail = 900 
-- 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 = 1124, y = 1026, z =12 } 
-- Set the position once unjailed: -- 
unjailpos = { x = 1019, y = 1045, 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 this, command on teleport:

Code:
function onSay(cid, words, param) exit = {x=1027, y=1053, z=7, stackpos=253} 
if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then doTeleportThing(cid,exit) broadcastMessage(12, getCreatureName(cid).." ["..getPlayerLevel(cid).." level] is in temple.") doPlayerSendTextMessage(cid,19,"Teleportowales sie.") 
else doPlayerSendTextMessage(cid, 22, "Masz PZ! Nie mozesz sie teleportowac!.") 
end 
return 1 
end

Thanks for help!
 
You add a mute to your jail system? or some line that dont let you tp/logout from it

edit; idk how to do that either xD, just suggesting
 
Lua:
exit = {x=1027, y=1053, z=7, stackpos=253} 

function onSay(cid, words, param)
	if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE and getPlayerStorageValue(cid, 1339) == 0 then
		doTeleportThing(cid,exit)
		broadcastMessage(12, getCreatureName(cid).." ["..getPlayerLevel(cid).." level] is in temple.")
                doPlayerSendTextMessage(cid,19,"Teleportowales sie.") 
	else
		doPlayerSendTextMessage(cid, 22, "Masz PZ! Nie mozesz sie teleportowac!.") 
	end 
return 1 
end
 
Thanks man :D Rep for you. I would not create a new topic and I have more one small problem. I can not do doors which teleport if you have a storage, can You help me ? :p

Sorry for my english :$
 
I mean the close door teleport if we have made quest for some storage. Do you understand ? Really sorry for my english. Idk how to explain.

Hmm example:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == CLOSED_DOOR_ID then
		if getCreatureStorage(cid, 11001) == -1 then
			doTransformItem(item.uid, item.itemid + 1)
			doTeleportThing(cid, toPosition)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
		end
		return true
	end
end

But no doTransformItem just teleport behind the door. ;d
 
Try this.
Set door actionid to 11111.

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cidPosition = getCreaturePosition(cid)
	if item.actionid == 11111 then
		if getCreatureStorage(cid, 11001) == -1 then
			if cidPosition.x < toPosition.x then
				doTransformItem(item.uid, item.itemid + 1)
				doTeleportThing(cid, {x=toPosition.x,y=toPosition.y+1,z=toPosition.z}, TRUE)
			else
				doTransformItem(item.uid, item.itemid + 1)
				doTeleportThing(cid, {x=toPosition.x,y=toPosition.y-1,z=toPosition.z}, TRUE)
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
		end
		return true
	end
end
 
You can just edit a vip door by replacing vipdays with storage.
http://otland.net/f163/best-vip-system-ever-action-movevent-globalevent-71638/
Lua:
function onUse(cid, item, frompos, item2, topos)
         if getPlayerStorageValue(cid, 9201) >= 1 then
            pos = getPlayerPosition(cid)
            if pos.x == topos.x then
               if pos.y < topos.y then
                  pos.y = topos.y + 1
               else
                  pos.y = topos.y - 1
               end
            elseif pos.y == topos.y then
                   if pos.x < topos.x then
                      pos.x = topos.x + 1
                   else
                      pos.x = topos.x - 1
                   end
            else
                doPlayerSendTextMessage(cid,22,"Stand in front of the door.")
            return true
            end
            doTeleportThing(cid,pos)
            doSendMagicEffect(topos,12)
         else
            doPlayerSendTextMessage(cid,22,'Only players who did some quest can go there.')
         end
         return true
end
 
Both scripts are good, thanks guys!

Edit: Ehh, really sorry but first script (!teleport) not working properly:

Code:
exit = {x=1027, y=1053, z=7, stackpos=253} 
 
function onSay(cid, words, param)
	if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE and getPlayerStorageValue(cid, 1338) == 0 then
		doTeleportThing(cid,exit)
		broadcastMessage(12, getCreatureName(cid).." ["..getPlayerLevel(cid).." level] is in temple.")
                doPlayerSendTextMessage(cid,19,"Teleportowales sie.") 
	else
		doPlayerSendTextMessage(cid, 22, "Masz PZ! Nie mozesz sie teleportowac!.") 
	end 
return 1 
end

All the time shows: "Masz PZ! Nie mozesz sie teleportowac!." Even when I'm not in jail. :(
 
Last edited:
Back
Top