Forum

> > CS2D > Scripts > Zone maker
Forums overviewCS2D overview Scripts overviewLog in to reply

English Zone maker

6 replies
To the start Previous 1 Next To the start

old Zone maker

Mora
User Off Offline

Quote
Hello all..
Om.. i wanna ask do you have any examples of this
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
zones = {
 [1] = {
name = "Shot zone",
x = "2",
y = "3,
xx = "5",
yy = "7",
},
 [2] = {
name = "Pvp zone",
x = "11",
y = "13",
xx = "16",
yy = "22",
},
}

addhook movetile,
If ive move on these tiles on the tables then
hudsee(id)
End

Function. Hudsee(id)
Hudtxt2 zones[id].name
Else
nohudtxt2
End
?
And/or maybe links of already maren examples? Bcuz ive tried by self and sure failed. Tried to search - again failure.
Thank u so much
(Sorry if there is mistakes, cuz of my little Phone)

old Re: Zone maker

Talented Doge
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
local list = entitylist()
addhook("movetile", "onm")

function safezone(x, y, x2, y2)
	for _,p in pairs(player(0, "tableliving")) do
		local tilex = player(p,"tilex")
		local tiley = player(p,"tiley")
		if tilex >= x2 and tilex <= x + x2 and tiley >= y2 and tiley <= y + y2 then
			parse ("hudtxt2 "..p..' 1 "Safe Zone" 329 103 1')
		else
			parse ("hudtxt2 "..p.." 1")
		end
	end
end

function onm(p, x, y)
	for _, e in pairs(list) do
		if entity(e.x, e.y, "typename") == "Env_Hurt" then
			if entity(e.x, e.y, "int0") == -100 then
				safezone(entity(e.x, e.y, "int2"), entity(e.x, e.y, "int3"), e.x, e.y)
			end
		end
	end
end

I've written this safe zone code for a challenge from a guy.

old Re: Zone maker

Mora
User Off Offline

Quote
Thank you, but its not that ive search for, ik here is auto safe zone script( by M_ or _M), and it has insert every new zone with the same function(s)

old Re: Zone maker

Talented Doge
User Off Offline

Quote
Ergh, what script you want to have exactly?

If safe zone wouldn't fit you, what kind would fit you? I don't get what you want, sorry.

old Re: Zone maker

Mora
User Off Offline

Quote
@user Talented Doge: it's that my terrible english, but i will get you my failure code, maybe so?:
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
zones = {
	[1] = { --this is zone number
	x = 2, --this is a min x value
	xx = 2, --this is a max x value
	y = 5, --this is a min y value
	yy = 5, --this is a max y value
	name = "\169255190100Shot zone", --this is a name of that value, "\169" it's copyright symbol, "255190100" it's color rgb and "Shot zone" it's name,-you can add more colorful name.
	},
	[2] = {
	x = 7,
	xx = 2,
	y = 10,
	yy = 15,
	name = "\169255000000Root zone",
	},
}

addhook("movetile","muv")
function muv(id,x,y)
 for i in ipairs(zones) do
	if x >= zones[i][1] and x <= zones[i][2] and y >= zones[i][3] and y <= zones[i][4] then
parse('hudtxt2 '..id..' 1 "'..zones[i].name..'" 320 240')
	else
parse('hudtxt2 '..id..' 1 "Unknown place" 320 240')
	end
 end
end
//I mean i need to check these values of zones table and if i've step on'em, then hudtxt2 apear with the name of it.
i will make image, some minutes later and upload here.

old Re: Zone maker

Mora
User Off Offline

Quote
@user Rainoth: but how i can add names of every of these zones?
/ok now it's fixed, thank you very much guys, but i'm really don't think that safe zone will exists it..
but names still in quest.
edited 1×, last 31.05.15 09:42:56 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview