Forum

> > CS2D > Scripts > [Request] JailGun
Forums overviewCS2D overview Scripts overviewLog in to reply

English [Request] JailGun

9 replies
To the start Previous 1 Next To the start

old [Request] JailGun

ItsLullas
User Off Offline

Quote
Hi guys,
I was searching for a JailGun Mod, but I didn't find one.
So now I'm asking you to help me.

The JailMod should work like this:

• The JailGun should teleport you into a Jail, for a certain amout of time
• The position of the Cell(s) should be configurable
• There is a defineable weapon that is used as JailGun
• Only Admins can use it of course

> If somebody has/makes a script like this, please PN me.
Thanks!

old Re: [Request] JailGun

Chingy
User Off Offline

Quote
Do you mean a script made for a specific gun (Laser as example) which teleports a player to a preset XY when the gun hits him?

old Re: [Request] JailGun

EngiN33R
Moderator Off Offline

Quote
I won't PM you the script, I will write it here, for the sake of other people who will visit this thread. I will also not make a whole administration script for you, use an existing one and incorporate this code into it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
jailgun = 5 --weapon type of the jail gun
jail = {5,5} --position to teleport ot
jaildur = 30 --duration of jail time in seconds

addhook("hit","jailplayer")
function jailplayer(id,src)
	if true then --check if src is an admin here!
		if player(src,"weapontype")==jailgun then
			local oldx,oldy=player(id,"x"),player(id,"y")
			parse("setpos "..id.." "..jail[1]*32+16 .." "..jail[2]*32+16)
			timer(jaildur*1000,"parse","setpos "..id.." "..oldx.." "..oldy)
		end
	end
end

This won't work well if you shoot a player who's already in jail.

old Re: [Request] JailGun

Chingy
User Off Offline

Quote
user EP has written
@user Chingy: No... the prisoner will back to his old position, which is the jail. Read the code

Read his last sentence again.

old Re: [Request] JailGun

EngiN33R
Moderator Off Offline

Quote
user Chingy has written
@user EngiN33R: You mean it will end into a crash?


It won't crash, but if you shoot a player while they're in prison, they will be teleported to the jail position again, then after the initial 30 seconds the player will be teleported back where they were prisoned, and then after a while they'll be teleported back to the prison, this time irreversibly (unless someone manually teleports them away from there). You can try it yourself and see.

That can be avoided by preventing a player from being teleported if they're in jail already, which we can implement by means of an in jail variable.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview