Forum

> > CS2D > Scripts > Noclip with absolute movement
Forums overviewCS2D overview Scripts overviewLog in to reply

English Noclip with absolute movement

9 replies
To the start Previous 1 Next To the start

old Noclip with absolute movement

Alistaire
User Off Offline

Quote
So I need a way to make a player noclip with movement towards the cursor, just like in some server I once saw with classes like 'the noclipper' and the like.

I guess it needs some kind of reqcld of mouse position to make it work with noclip or am I just wrong.

old Re: Noclip with absolute movement

Starkkz
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("always","Always")
function Always()
	for _, id in pairs(player(0,"table")) do
		if player(id,"health") > 0 then
			local Angle = math.rad(player(id,"rot"))
			local x = player(id,"x") + math.sin(Angle) * 5
			local y = player(id,"y") - math.cos(Angle) * 5
			if x > 0 and y > 0 and x < (map("xsize")+1)*32 and y < (map("ysize")+1)*32 then
				parse("setpos "..id.." "..x.." "..y)
			end
		end
	end
end

I had put "5" for the number of pixels for each frame that the player will move, you can change it if you want.

old Re: Noclip with absolute movement

Avo
User Off Offline

Quote
Through walls?

I actually don't get your idea, but maybe you would use sin and cos with mouse clicking. You would be able to move through walls.

Ask admin of server for script which is used.

old Re: Noclip with absolute movement

Alistaire
User Off Offline

Quote
1. YES TROUGH WALLS. THAT'S NOCLIPPING.
2. Starkzz posted that yes.
3. Why the fuck mouse clicking.
4. That's what I want yes.
5. The server is never on.

old Re: Noclip with absolute movement

Starkkz
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
mouse_event = {}

addhook("use","onUse")
function onUse(id)
	mouse_event[id] = 1
	reqcld(id, 2)
end

addhook("clientdata","teleport")
function teleport(id,mode,x,y)
	if mouse_event[id] then
		if mode == 2 and mouse_event[id] == 1 then
			parse("setpos "..id.." "..x.." "..y)
			mouse_event[id] = nil
		ned
	end
end

If you didn't like mine, then I hope this one works.

Edit: Lol, just noticed about your new post.

old Re: Noclip with absolute movement

Avo
User Off Offline

Quote
user Starkkz has written
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("always","Always")
function Always()
	for _, id in pairs(player(0,"table")) do
		if player(id,"health") > 0 then
			local Angle = math.rad(player(id,"rot"))
			local x = player(id,"x") + math.sin(Angle) * 5
			local y = player(id,"y") - math.cos(Angle) * 5
			if x > 0 and y > 0 and x < (map("xsize")+1)*32 and y < (map("ysize")+1)*32 then
				parse("setpos "..id.." "..x.." "..y)
			end
		end
	end
end

Here ---^ you move always, you can't stop moving.

old Re: Noclip with absolute movement

krabob
User Off Offline

Quote
user Avo has written
user Starkkz has written
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("always","Always")
function Always()
	for _, id in pairs(player(0,"table")) do
		if player(id,"health") > 0 then
			local Angle = math.rad(player(id,"rot"))
			local x = player(id,"x") + math.sin(Angle) * 5
			local y = player(id,"y") - math.cos(Angle) * 5
			if x > 0 and y > 0 and x < (map("xsize")+1)*32 and y < (map("ysize")+1)*32 then
				parse("setpos "..id.." "..x.." "..y)
			end
		end
	end
end

Here ---^ you move always, you can't stop moving.


He obviously isn't gonna use this exact script, he probably will customise it to his own use.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview