Forum

> > CS2D > Scripts > Portal Creator
Forums overviewCS2D overview Scripts overviewLog in to reply

English Portal Creator

29 replies
Page
To the start Previous 1 2 Next To the start

old Re: Portal Creator

Yates
Reviewer Off Offline

Quote
How about not requesting client data if the equipped weapon is not a portal gun. Client data requests should be used carefully, don't waste a request where it's not necessary.

old Re: Portal Creator

Cure Pikachu
User Off Offline

Quote
@user Yates: Something like this then.
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
28
addhook("ms100","_ms")
function _ms()
	for _, id in pairs(player(0,"tableliving")) do
		if (not player(id,"bot")) and player(id,"weapontype") == 88 then
			reqcld(id,2)
		end
	end
end

addhook("select","_sel")
function _sel(id,t)
	if t ~= 88 then
		parse('hudtxt2 '..id..' 0 "" 0 0 0')
	end
end

addhook("clientdata","_cld")
function _cld(id,m,x,y)
	if m == 2 then
		local tx, ty = math.floor(x/32), math.floor(y/32)
		local oid = math.max(objectat(tx,ty,22),objectat(tx,ty,23))
		if oid > 0 then
			parse('hudtxt2 '..id..' 0 "\169255000000Created by '..player(object(oid,"player"),'name')..'" '..x-player(id,"x")+324 ..' '..y-player(id,"y")+244 ..' 0')
		else
			parse('hudtxt2 '..id..' 0 "" 0 0 0')
		end
	end
end
edited 4×, last 08.05.18 11:38:39 am

old Re: Portal Creator

Yates
Reviewer Off Offline

Quote
Perfect √

You could even check if the player were a bot or not, but I don't know if requesting data from a bot would even work and the bot would have to have a portal gun equipped and hovering over a portal so the chances are quite slim.

old Re: Portal Creator

francis007
BANNED Off Offline

Quote
user Cure Pikachu has written
@user Yates: Something like this then.
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
28
addhook("ms100","_ms")
function _ms()
	for _, id in pairs(player(0,"tableliving")) do
		if (not player(id,"bot")) and player(id,"weapontype") == 88 then
			reqcld(id,2)
		end
	end
end

addhook("select","_sel")
function _sel(id,t)
	if t ~= 88 then
		parse('hudtxt2 0 '..id..' "" 0 0 0')
	end
end

addhook("clientdata","_cld")
function _cld(id,m,x,y)
	if m == 2 then
		local tx, ty = math.floor(x/32), math.floor(y/32)
		local oid = math.max(objectat(tx,ty,22),objectat(tx,ty,23))
		if oid > 0 then
			parse('hudtxt2 0 '..id..' "\169255000000Created by '..player(object(oid,"player"),'name')..'" '..x-player(id,"x")+324 ..' '..y-player(id,"y")+244 ..' 0')
		else
			parse('hudtxt2 0 '..id..' "" 0 0 0')
		end
	end
end


I want to use this script but i want that only who point on portal see the hud and not everyone (like msg2).
edited 3×, last 13.10.16 09:38:15 pm

old Re: Portal Creator

Baloon
GAME BANNED Off Offline

Quote
This is why you didn't see any hud text:
user Rainoth has written
@user francis007:
Step 1: Take my code and put it in a notepad file.
Step 2: Take user Baloon's code and put it in that same notepad file
Step 3: Save the notepad file.
Congratulations! You got the full script

You should insert my code first, before user Rainoth's one.

And, don't forget about hud id.

old Re: Portal Creator

Rainoth
Moderator Off Offline

Quote
Nah m8. I tested my code and it worked fine. If it doesn't work, that's on whoever made the changes. The text is personal because I used hudtxt2 which displays hud for a single person so no problem there.

old Re: Portal Creator

Yates
Reviewer Off Offline

Quote
That's because he switched around the first two parameters of cs2d cmd hudtxt2, player
id
comes first and then the internal hudtxt
id
.

Just switch them around and it's fixed.
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview