TalkAction /jail & /unjail V. 3.0

Master-m

Need help? Just ask!
Joined
May 28, 2007
Messages
4,339
Best answers
0
Reaction score
15
Location
The Netherlands
Updated to Version 3.0!
Made it more user-friendly and commented everyline.
I hope some of you can learn something from it.
Thanks MRSheen for the idea ;>

This are 2 talkactions made by me to jail/unjail people on your server :)
You say /jail "Playername to jail someone or
You say /unjail "Playername to unjail someone

First open Talkactions.xml

put this under your other lines but before </talkactions>
Code:
    <talkaction words="/jail" script="jailing.lua" />
    <talkaction words="/unjail" script="jailing.lua" />
now go to the folder called scripts and create a new .lua file.
Call the new .lua file jailing.lua and paste this in it:

jailing.lua
Code:
--[[
OTLAND.NET / CREDITS
  CREATED BY:
    master-m
  EDITED BY:
    Lithium: Shorten.
    Velik: Missing parts. Tested code.
    Colandus: Missing end. Works for both TFS and Evolutions. Added more "checks". Shorten alot.
]]

-- Start the function --
function onSay ( cid, words, param )

-- Edit these positions bewlow --

	-- The permission you need to jail someone --
	grouprequired = 4
	
	-- StorageValue that the player gets --
	jailedstoragevalue = 1338

	-- Set the position of the jail: --
	jailpos = { x = 500, y = 1441, z =4  }
	
	-- Set the position once unjailed: --
	unjailpos = { x = 487, y = 1445, z = 4 } 

-- Stop edting unless you know what you are doing --	

	-- Executes the code below if it is the word is /jail --
	if words == '/jail' then	
	
		-- Checks if the player is allowed to jail someone, said a playername to jail and looks if the player isn't in jail already --
		if getPlayerGroupId ( cid ) >= grouprequired and param ~= "" and getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) == -1 then 
		
			-- The actual code --
			
			-- Gets the name of the one who jails someone --
			jailer = getPlayerName ( cid ) 
			
			-- Teleporting the person to jail --
			doTeleportThing ( getPlayerByName ( param ), jailpos, 0 )
			
			-- Sends a message to the jailed person --
			doPlayerSendTextMessage ( getPlayerByName ( param ), 25, 'You have been jalied by '..jailer..'' ) 
			
			-- Sends a message to the one who jails someone --
			doPlayerSendTextMessage ( cid, 21, "You just jailed "..param.."." )
			
			-- Gives the player a storage value to remember that he is jailed --
			setPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue, 1 )
			
		-- end of the actual code --
			
			
		-- What to do if the player don't have the permission --
		elseif getPlayerGroupId ( cid ) < grouprequired then
		
			-- Sends the player a message that he doesn't have permission to jail someone --
			doPlayerSendTextMessage ( cid, 21, "You are not permitted to jail anyone." )
			
		-- What to do if the player is already jailed --
		elseif getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) ~= -1 then
		
			-- Sends the player a message if the player is already jailed --
			doPlayerSendTextMessage ( cid, 21, "This Player is already jailed." )
		
		-- What to do if the player didn't fill in a name --		
		else
				-- Sends the player a message that he forgot to fill in a playername --
				doPlayerSendTextMessage ( cid, 21, "You need to fill in a playername!" )
		
		-- Ends the checks --
		end
		
	-- Executes the code below if it is the word is /unjail --
	elseif words == '/unjail' then
	
		-- Checks if the player is allowed to unjail someone, said a playername to unjail and looks if the player isn't in unjailed already --
		if getPlayerGroupId ( cid ) >= grouprequired and param ~= "" and getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) == 1 then 
		
			-- The actual code --
			
			-- Gets the name of the one who unjails someone --
			unjailer = getPlayerName ( cid )
			
			-- Teleporting the person outside the jail --
			doTeleportThing ( getPlayerByName ( param ), unjailpos, 0 )
			
			-- Sends a message to the unjailed person --
			doPlayerSendTextMessage ( getPlayerByName ( param ), 25, 'You have been unjailed by '..unjailer..'' )
			
			-- Sends a message to the one who unjailed someone --
			doPlayerSendTextMessage ( cid, 21,"You just unjailed "..param.."." )
			
			-- Removes the players  storage value so we know that he isn't jailed anymore. --
			setPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue, -1 )
			
			-- end of the actual code --
			
		
		-- What to do if the player don't have the permission --		
		elseif getPlayerGroupId ( cid ) < 4 then
		
			-- Sends the player a message that he doesn't have permission to unjail someone --
			doPlayerSendTextMessage ( cid, 21, "You cannot unjail someone!" )
		
		-- What to do if the player is already unjailed --
		elseif getPlayerStorageValue ( getPlayerByName ( param ), jailedstoragevalue ) ~= 1 then
		
			-- Sends the player a message if the player is already unjailed --
			doPlayerSendTextMessage ( cid, 21, "This Player is already unjailed." )
			
		-- What to do if the player didn't fill in a name --	
		else
		
			-- Sends the player a message that he forgot to fill in a playername --
			doPlayerSendTextMessage ( cid, 21, "You need to fill in a playername!" )
			
		-- Ends the checks --	
		end
		
	-- Ends the ( un ) jailing part --	
	end		
	
-- Ends the function --	
end
Post any bugs/suggestions in this thread :)
I think that was all :D
 
Last edited:

TheMask

World of Comodato Owner
Joined
May 28, 2007
Messages
80
Best answers
0
Reaction score
0
Location
Brasil
RE: [Talkaction][7.92]/jail , /unjail

Nice :)
But why you not post too how make the players unjail automatic after X times????
 

Delirium

OTLand veteran
Staff member
Global Moderator
Joined
May 28, 2007
Messages
3,335
Best answers
1
Reaction score
196
Location
Athens, Greece
RE: [Talkaction][7.92]/jail , /unjail

Nice script master-m


@up

Cummonism is better than democracy
 
OP
M

Master-m

Need help? Just ask!
Joined
May 28, 2007
Messages
4,339
Best answers
0
Reaction score
15
Location
The Netherlands
RE: [Talkaction][7.92]/jail , /unjail

@themask
Lol Look what it says on the Todo list..

thnx
 

Delirium

OTLand veteran
Staff member
Global Moderator
Joined
May 28, 2007
Messages
3,335
Best answers
1
Reaction score
196
Location
Athens, Greece
RE: [Talkaction][7.92]/jail , /unjail

---Update by Wynden---


By Wynden the Second?
 
OP
M

Master-m

Need help? Just ask!
Joined
May 28, 2007
Messages
4,339
Best answers
0
Reaction score
15
Location
The Netherlands
RE: [Talkaction][7.92]/jail , /unjail

Yes he made that bookstoreage and multiplejail support for me, because i was busy with exams:p
 

ZoOorO

Member
Joined
May 28, 2007
Messages
3,632
Best answers
0
Reaction score
14
RE: [Talkaction][7.92]/jail , /unjail

nice :D show a screen how it looks like :p
 
OP
M

Master-m

Need help? Just ask!
Joined
May 28, 2007
Messages
4,339
Best answers
0
Reaction score
15
Location
The Netherlands
RE: [Talkaction][7.92]/jail , /unjail

ZoOorO said:
nice :D show a screen how it looks like :p
I will update it tommorrow I think then i will provide some screenshots also:)
 

ZoOorO

Member
Joined
May 28, 2007
Messages
3,632
Best answers
0
Reaction score
14
RE: [Talkaction][7.92]/jail , /unjail

master-m said:
ZoOorO said:
nice :D show a screen how it looks like :p
I will update it tommorrow I think then i will provide some screenshots also:)
nice i want to see how it works ^^
 

Delirium

OTLand veteran
Staff member
Global Moderator
Joined
May 28, 2007
Messages
3,335
Best answers
1
Reaction score
196
Location
Athens, Greece
RE: [Talkaction][7.92]/jail , /unjail

master-m said:
Yes he made that bookstoreage and multiplejail support for me, because i was busy with exams:p

Wynden the Second is my friend too,he helps me with scripts :D
 

Henkieman

New Member
Joined
May 28, 2007
Messages
36
Best answers
0
Reaction score
0
RE: [Talkaction][7.92]/jail , /unjail

i not really understand
 

TheMask

World of Comodato Owner
Joined
May 28, 2007
Messages
80
Best answers
0
Reaction score
0
Location
Brasil
RE: [Talkaction][7.92]/jail , /unjail

@master-m

I see it dude, you say secret but can you post it for us plz?
When you post some code, post the full code plz.

Or if you dont want post all code no post nothing.. :)

Make we happy and post the addevent to unjail players automatic

Thx for listen and try understand what we need :)

Cya good luck
 
OP
M

Master-m

Need help? Just ask!
Joined
May 28, 2007
Messages
4,339
Best answers
0
Reaction score
15
Location
The Netherlands
RE: [Talkaction][7.92]/jail , /unjail

TheMask said:
@master-m

I see it dude, you say secret but can you post it for us plz?
When you post some code, post the full code plz.

Or if you dont want post all code no post nothing.. :)

Make we happy and post the addevent to unjail players automatic

Thx for listen and try understand what we need :)

Cya good luck
It is the full code, But there will come some nice new features when I have time to make. And I dont want to say what the new features are,Yet.
 

Lithium

Ex-TFS Developer
Joined
Jun 2, 2007
Messages
334
Best answers
0
Reaction score
0
RE: [Talkaction][7.92]/jail , /unjail

nice work man, make automatic jail for killing ;)
 

TheMask

World of Comodato Owner
Joined
May 28, 2007
Messages
80
Best answers
0
Reaction score
0
Location
Brasil
RE: [Talkaction][7.92]/jail , /unjail

@MASTER

Plz can you or someone, help me to make a addEvent() to unjail the players after some time???

Plz i realy need it

Thx for all
 

crimson master

New Member
Joined
Jun 30, 2007
Messages
10
Best answers
0
Reaction score
0
RE: [Talkaction][7.92]/jail , /unjail

very nice, i am going to use it for my server
 

JayBeee

Retired Global Mod
Joined
Jun 2, 2007
Messages
5,225
Best answers
0
Reaction score
13
Location
Sweden
RE: [Talkaction][7.92]/jail , /unjail

Nice code! I'm gonna use it too!
 

michael

New Member
Joined
Jun 2, 2007
Messages
122
Best answers
0
Reaction score
0
Location
Netherlands
RE: [Talkaction][7.92]/jail , /unjail

nice I will use this script for sure
 

JayBeee

Retired Global Mod
Joined
Jun 2, 2007
Messages
5,225
Best answers
0
Reaction score
13
Location
Sweden
RE: [Talkaction][7.92]/jail , /unjail

Hmm, does it really work for TFS? Mine just says: "luaDoTeleportThing: Can not teleport thing". Any idea?

EDIT: NVM, got it to work :D
 
Top