Kinda like a speed-build for fortress making?
Forum
Scripts
[Request]Instauild-button
[Request]Instauild-button
8 replies
1

Kinda like a speed-build for fortress making?
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
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
function Array(s,v)
local array = {}
	for i = 1,s do
	array[i] = v
	end
	return array
end
wall = Array(32,false) addhook("join","lol") function lol(id) wall[id] = false end
addhook("clientdata","asd")
function asd(id,mode,x,y)
	if mode == 2 then
		if wall[id] == true then
			parse("spawnobject 3 "..(x/32).." "..(y/32).." "..player(id,"rot").." 0 "..player(id,"team").." "..id)
			wall[id] = false
		end
	end
end
addhook("use","a")
function a(id)
	if player(id,"health") > 0 then
		wall[id] = true
		reqcld(id,2)
	end
end
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
29
30
31
32
33
34
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
29
30
31
32
33
34
addhook("serveraction","_serveraction")
addhook("always","_always")
addhook("clientdata","_clientdata")
function _serveraction(id,action)
	local objid=objectid(mouse[id][1],mouse[id][2])
	if objid and action==2 then
		if object(objid,"type")==3 then
			parse("killobject "..objid)
		end
	elseif not objid and action==1 then
		parse("spawnobject 3 "..mouse[id][1].." "..mouse[id][2].." 0 0 "..player(id,"team").." "..id)
	end
end
function _always()
	reqcld(0,2)
end
function _clientdata(id,mode,x,y)
	mouse=mouse or {}
	if mode==2 then
		mouse[id]={math.floor(x/32),math.floor(y/32)}
	end
end
function objectid(x,y)
	for _,id in pairs(object(0,"table")) do
		if object(id,"tilex")==x and object(id,"tiley")==y then
			return id
		end
	end
	return false
end
F2: Build 'Wall I' under cursor
F3: Delete 'Wall I' under cursor
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
29
30
31
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
29
30
31
addhook("serveraction","_serveraction")
addhook("clientdata","_clientdata")
function _serveraction(id,action)
	reqcld(0,2)
local objid=objectid(mouse[id][1],mouse[id][2])
if objid and action==2 then
if object(objid,"type")==3 then
parse("killobject "..objid)
end
elseif not objid and action==1 then
parse("spawnobject 3 "..mouse[id][1].." "..mouse[id][2].." 0 0 "..player(id,"team").." "..id)
end
end
function _clientdata(id,mode,x,y)
mouse=mouse or {}
if mode==2 then
mouse[id]={math.floor(x/32),math.floor(y/32)}
end
end
function objectid(x,y)
for _,id in pairs(object(0,"table")) do
if object(id,"tilex")==x and object(id,"tiley")==y then
return id
end
end
return false
end
People with say 200+ ping will have their mouse position taken from seconds after the button is pressed. By saving their mouse positions every frame -- fastest as possible, it's saving time.
It's really how you balance server power and speed. I've not noticed any difference in bandwidth usage or connection rates. However I have seen a difference in speed. Thus, I have chosen to use my method simply for that reason.
edited 1×, last 08.04.12 12:10:27 pm
ctrl-h --> replace 3 with 8
1

Offline