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

[REQUEST] Jail Rune

Awesome Slayer

New Member
Joined
Jul 16, 2008
Messages
58
Reaction score
0
can someone please make a jail rune script that counts how many times a player has been jailed (first time player i jailed send jailer msg "name has been jailed for the fist time")second jail send jailer msg "name has been jailed twice") and after they have been in jail for x minutes (send jailed player msg "you have been jailed for breaking the rules, you will be released after 'x' minutes")and after 'x' minutes it releases them from the jail? i would really appreciate it.

Thanks, Awesome Slayer.
 
Nevermind the old one.

Here is the working one:
data/spells/scripts/custom/jail rune.lua:
Code:
local unjailableGroup = 3
local jailStorage = 100000
local jailTime = 5 -- Minutes, this time will be added upon each jail time e.g player jailed fourth time will have to wait two times longer than the one jailed for the second time.
local teleportTo = { x = 48, y = 48, z = 7 }
local teleportBack = { x = 50, y = 50, z = 7 }
local jailCounter = {
	[1] = "first", [2] = "second", [3] = "third", [4] = "fourth",
	[5] = "fifth", [6] = "sixth", [7] = "seventh", [8] = "eighth",
	[9] = "ninth", [10] = "tenth", [11] = "eleventh", [12] = "twelveth"
	}
	
local function jailPlayer(cid, pos)
	pos.stackpos = 255
	local target = getThingfromPos(pos)
	local pPos = getCreaturePosition(cid)
	if isPlayer(target.uid) == TRUE then
		if getPlayerGroupId(target.uid) < unjailableGroup then
			local function teleportBackF(cid)
				return doTeleportThing(target.uid, teleportBack, 0)
			end
			addEvent(teleportBackF, jailTime * 60000 * getPlayerStorageValue(target.uid, jailStorage), target.uid)
			setPlayerStorageValue(target.uid, jailStorage, getPlayerStorageValue(target.uid, jailStorage) + 1)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, getCreatureName(target.uid).." has been jailed for the "..jailCounter[getPlayerStorageValue(target.uid, jailStorage)].." time and will remain in prison for ".. jailTime * getPlayerStorageValue(target.uid, jailStorage) .." minutes.")
			doTeleportThing(target.uid, teleportTo, 0)
			return LUA_NO_ERROR
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You may not jail this player!")
			return LUA_ERROR
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You may jail only players.")
		return LUA_ERROR
	end
end
	
function onCastSpell(cid, var)
	local pos = variantToPosition(var)
	if(pos.x ~= 0 and pos.y ~= 0 and pos.z ~= 0) then
		return jailPlayer(cid, pos)
	end
	
	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	return LUA_ERROR
end

data/spells/spells.xml: ( I have used id 2295, feel free to change it )
Code:
<rune name="Jail Rune" id="2295" allowfaruse="1" charges="5" lvl="1" maglv="0" exhaustion="2000" needtarget="1" script="custom/jail rune.lua"/>

:D
 
Last edited:
Back
Top