TalkAction Jail System with auto kick by Gesior

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,026
Best answers
19
Reaction score
1,061
Location
PLand
Functions:
* GM jail player for X minutes [0 - unlimited] (!jail "4,Nick or !jail "30 Nick or !jail "15, Nick) or fast jail (!jail "Nick) for default_time (config)
* GM unjail player (!unjail "Nick)
* player check jail time (show unjail date)
* auto unjail players
* kick all players from jail after crash/restart [teleport to player temple]
in file data/talkactions/talkactions.xml under:
PHP:
<talkactions>
add:
PHP:
	<talkaction words="!jail" script="jailsystem.lua"/>
	<talkaction words="!unjail" script="jailsystem.lua"/>
	<talkaction words="/jail" script="jailsystem.lua"/>
	<talkaction words="/unjail" script="jailsystem.lua"/>
in folder data/talkactions/scripts/ make file jailsystem.lua and paste in this file:
PHP:
-- Default jail time in seconds --
default_jail = 30
-- 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 = 1037, y = 1004, z =7 }
-- Set the position once unjailed: --
unjailpos = { x = 1029, y = 1005, 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
About jail on map:
* all jail tiles must be: "pz" and "no logout" tiles
* unjail position should be: "pz" tile - block pks combo
* player can't go out from jail building (!) :) (no doors)
 
OP
Gesior.pl

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,026
Best answers
19
Reaction score
1,061
Location
PLand
Now I make swargrond 'arena' script like RL or better.
-----------------------------
player can use teleport only if he killed monster
if you die you must start from first monster in your level of arena
max. one player in one room
max. one monster (full hp when player appear) in one room
second player can wait 1 room behind first player (i saw script where only one player can enter arena in same time :p )
-------------------
All based on UIDs and AIDs on map, global and player storage values. You don't have to make loong config.
You will see :p
 

clone

New Member
Joined
Jun 16, 2007
Messages
412
Best answers
0
Reaction score
1
PLEASE make svargrond arena i would luv u!
 

Fare

Well-Known Member
Joined
Apr 3, 2008
Messages
2,386
Best answers
0
Reaction score
92
Location
Ukraine
o.0 ROX;] will be waiting for arena ;> and thanks for this one
 

justin234

New Member
Joined
Jan 22, 2008
Messages
999
Best answers
0
Reaction score
3
The !jail 15, nick Doesnt work for me...
nor does /jail 15, nick.


Only "/jail "Nick"
 
OP
Gesior.pl

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,026
Best answers
19
Reaction score
1,061
Location
PLand
The !jail 15, nick Doesnt work for me...
nor does /jail 15, nick.


Only "/jail "Nick"
/jail "15,Nick
:>
talkactions need " before parameters
-------------------------------------------------------
About arena:
- 10 rooms
- 30 monsters
- no problem with double monsters
- monsters always with full HP
- map almost like on RL
- auto kick players who are more then XX seconds in one room (count from 10 before kick)
- RL goblets (you walk on tile and item appear):
12:34 You see a silver goblet.
It weighs 15.00 oz.
It is given to the courageous victor of the barbarian arena scrapper difficulty.
Awarded to GOD Gesior.
- RL chests (5 chests, you can choose 1, bp/present/weapon) - first level ready
- 10 players can do diffrent arena levels in same time :)
- you can enter teleport only when you kill monster
TODO:
- 2 and 3 level arena chests
- NPC who get cash and let you enter arena (check level)
- test all with 10-20 players
 

pirre55

New Member
Joined
Oct 22, 2008
Messages
4
Best answers
0
Reaction score
0
It doesent work for me !jail and /jail dont work only !unjail /unjail
 

JayBeee

Retired Global Mod
Joined
Jun 2, 2007
Messages
5,225
Best answers
0
Reaction score
13
Location
Sweden
More info? It already says everything you need to know.
 

Don Daniello

/root
Staff member
Administrator
Joined
Apr 11, 2008
Messages
3,523
Best answers
15
Reaction score
931
Location
Proland
Anti logout zone should work, but you can also make wall and behind it some devil creatures :D
They look nice and try to attack player so he cannot logout :)
 

EhabG

New Member
Joined
Jun 1, 2008
Messages
99
Best answers
0
Reaction score
0
Location
Denmark
When I say !jail "sirr its says 21:40 You don't have access to unjail other players.
 

Don Daniello

/root
Staff member
Administrator
Joined
Apr 11, 2008
Messages
3,523
Best answers
15
Reaction score
931
Location
Proland
My account has access 5 and my group has access 5 and everything is ok, try this.
 

EhabG

New Member
Joined
Jun 1, 2008
Messages
99
Best answers
0
Reaction score
0
Location
Denmark
You can use access 3 too
But can I ask you for something else , you know if I wont to make my own site i tryied but its says that when I try


Welcome to XAMPP for Windows Version 1.6.6a !
Congratulations:
You have successfully installed XAMPP on this system!
Now you can start using Apache and Co. You should first try »Status« on the left navigation to make sure everything works fine.



For OpenSSL support please use the test certificate with https://127.0.0.1 or https://localhost

For this release a special thanks to Uwe Steinmann for his excellent development and compilation of all current "Special" modules!

Good luck, Kay Vogelgesang + Kai 'Oswald' Seidler
 
Top