• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Spell Jail Rune.

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,941
Solutions
11
Reaction score
352
Oi.

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"/>
 
Tell me, with this script have you set a certain access to use the rune? because lets be honest, a player gets this rune... it could be mayhem?
 
nice script
but i think the ones with talk actions its better
there's no need for you to look for the player
 
How can i change this from a rune to a spell, like exura sio "players name but instead it traps them for 10 seconds?
 
Back
Top