Forum

> > CS2D > Scripts > my building script not work
Forums overviewCS2D overview Scripts overviewLog in to reply

English my building script not work

2 replies
To the start Previous 1 Next To the start

old my building script not work

MikuAuahDark
User Off Offline

Quote
ok i have lua, but it not work. all is working but only when building not work and there no "Lua error" so how to fix my script, this script not use F3, F4 and F5. to build you must build normally, but in some menus(Example Turret) another menu will displayed(Example There another choice to build turret(Example Triple Turret)) choice triple turret will create triple turret at building site position. ok how to fix my script? here my script code:
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
-- Custom build script by Rian2_idih

if build==nil then build={} end
build.system={}

print("initialising Build Script")

function Array(size,value)
	local array={}
	for i = 1, size do
		array[i]=value
	end
	return array
end

build.system.xpos = Array(32,0)
build.system.ypos = Array(32,0)


print('Set all building limit to 10000!')
parse('mp_building_limit "Teleporter Entrance" 10000')
print('Set Teleporter Entrance limit to 10000 complete!')
parse('mp_building_limit "Teleporter Exit" 10000')
print('Set Teleporter Exit limit to 10000 complete!')
parse('mp_building_limit Barricade 10000')
print('Set Barricade limit to 10000 complete!')
parse('mp_building_limit Turret 10000')
print('Set Turret limit to 10000 complete!')
parse('mp_building_limit "Wall I" 10000')
print('Set Wall I limit to 10000 complete!')
parse('mp_building_limit "Wall II" 10000')
print('Set Wall II limit to 10000 complete!')
parse('mp_building_limit "Wall III" 10000')
print('Set Wall III limit to 10000 complete!')
parse('mp_building_limit Dispenser 10000')
print('Set Dispenser limit to 10000 complete!')
parse('mp_building_limit "Gate Field" 10000')
print('Set Gate Field limit to 10000 complete!')
parse('mp_building_limit "Barbed Wire" 10000')
print('Set Barbed Wire limit to 10000 complete!')
parse('mp_building_limit Supply 10000')
print('Set Supply limit to 10000 complete!')
print('set all building limit to 10000 complete!')

function nomoney(id)
	msg2(id,"©255000000You have insufficient funds@C")
end

-- Menu function

function objectid8(id)
	menu(id,"Turret,Turret|5000 $,Dual Turret|7500 $,Triple Turret|10000 $")
end

function objectid9(id)
	menu(id,"Supply,Supply|5000 $,Super Supply|8000 $")
end
	
addhook("build","build.system.data")
function build.system.data(id,type,x,y,mode,objectid)
	if type==8 then
		build.system.xpos[id] = x
		build.system.ypos[id] = y
		objectid8(id)
		return 1
	elseif type==9 then
		build.pos.xpos[id] = x
		build.pos.ypos[id] = y
		objectid9(id)
		return 1
	else
		parse("spawnobject "..type.." "..x.." "..y.." "..player(id,"rot").." 0 "..player(id,"team").." "..id)
		return 1
	end
	return 0
end

addhook("menu","build.system.menu")
function build.system.menu(id,men,sel)
	if men == Turret then
		if sel == 1 then
			if player(id,"money")>=5000 then
				parse("spawnobject 7 "..build.system.xpos[id].." "..build.system.ypos[id].." "..player(id,"rot").." 0 "..player(id,"team").." "..id)
				parse("setmoney "..id.." "..player(id,"money")-5000)
			else
				nomoney(id)
			end
		end
		if sel == 2 then
			if player(id,"money")>=75000 then
				parse("spawnobject 11 "..build.system.xpos[id].." "..build.system.ypos[id].." "..player(id,"rot").." 0 "..player(id,"team").." "..id)
				parse("setmoney "..id.." "..player(id,"money")-7500)
			else
				nomoney(id)
			end
		end
		if sel == 3 then
			if player(id,"money")>=10000 then
				parse("spawnobject 12 "..build.system.xpos[id].." "..build.system.ypos[id].." "..player(id,"rot").." 0 "..player(id,"team").." "..id)
				parse("setmoney "..id.." "..player(id,"money")-5000)
			else
				nomoney(id)
			end
		end
	end
	if men == Supply then
		if sel == 1 then
			if player(id,"money")>=5000 then
				parse("spawnobject 9 "..build.system.xpos[id].." "..build.system.ypos[id].." "..player(id,"rot").." 0 "..player(id,"team").." "..id)
				parse("setmoney "..id.." "..player(id,"money")-5000)
			else
				nomoney(id)
			end
		end
		if sel == 2 then
			if player(id,"money")>=8000 then
				parse("spawnobject 15 "..build.system.xpos[id].." "..build.system.ypos[id].." "..player(id,"rot").." 0 "..player(id,"team").." "..id)
				parse("setmoney "..id.." "..player(id,"money")-8000)
			else
				nomoney(id)
			end
		end
	end
end

print("initialising Build Script comleted!")
maybe at build.system.xpos = x not work

old Re: my building script not work

Apache uwu
User Off Offline

Quote
Found your errors.

Fixed.

More >


You forgot to add quotations around the menu titles.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview