Forum

> > CS2D > Scripts > Admin Jail Script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Admin Jail Script

5 replies
To the start Previous 1 Next To the start

old Admin Jail Script

Marcell
Super User Off Offline

Quote
Welcome!

I would like to get some help or idea how to create an admin jail script. I did a jail on my map and when somebody do something which break rules, i can put he into the jail, where he need to reach checkpoints, if he wants to decrease his time in the jail.. then of course he spawn at specific place, what i defined

old Re: Admin Jail Script

Rainoth
Moderator Off Offline

Quote
That part about checkpoints isn't really clear to me but uhm. The "put in jail" is just a normal say command that will set pos a person to your jail, you can add him some kind of status if you want so it decreases the time spent in jail when a person does a "checkpoint"

old Re: Admin Jail Script

Marcell
Super User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
CP = {
	{12,56},
	{32,26}
}


adminjailsec = {26,27,28}
function admseconds()
for num, val in ipairs(adminjailsec) do
random (adminjailsec)
end
end

local admsec = admseconds()

addhook("movetile","check")
function check(id, x, y)
	for num, val in ipairs(CP) do
		if x==val[1] and y==val[2] then
		msg2(id, "You decrease your time in Adminjail with -"..admsec.." sec")
		end
	end
end

btw it's not working
edited 2×, last 27.03.14 02:58:23 pm

old Re: Admin Jail Script

Dousea
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function initarray (limit, value)
	local array = {}
	
	for rep = 1, limit do
		array[rep] = value
	end

	return array
end

jail = {}
jail.seconds = {26, 27, 29}
jail.chekpoints = {
	{12, 56},
	{32, 26}
}

jail.second = initarray (32, jail.seconds[math.random (1, #jail.seconds)])

addhook ("movetile", "movetilehook")
function movetilehook (id, x, y)
	for key, value in pairs (jail.checkpoints) do
		if (x == value[1] and y == value[2]) then
			msg2 (id, "You decrease your time spent in jail with " .. jail.second[id] .. " seconds")
		end
	end
end
Use this script. It will decrease the time spent in jail when player's tile X and tile Y are the same as selected tile X and Y. You can decrease the time in jail variable with jail.second[id], jail.second is for 32 players in the server, so it using [id]. Delete initarray function if you does have any related function with it.
edited 1×, last 28.03.14 10:37:37 am

old Re: Admin Jail Script

Marcell
Super User Off Offline

Quote
It is not jail pos. It is Checkpoints's pos i mean its randomly generated at defined pos and thats is what players needed to reach

old Re: Admin Jail Script

Dousea
User Off Offline

Quote
Actually, it works the same way, it differs only in its variable name. No need to worry about.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview