Forum

> > CS2D > Scripts > Menu Error (Bad Argument)
Forums overviewCS2D overview Scripts overviewLog in to reply

English Menu Error (Bad Argument)

3 replies
To the start Previous 1 Next To the start

old Menu Error (Bad Argument)

Jynxxx
User Off Offline

Quote
ok here is my error
Lua Error: line 130 : bad argument #1 to 'menu'(number expected, got string)

i posted my whole script so you can see any problem.
Spoiler >

old Re: Menu Error (Bad Argument)

Dovahkin
User Off Offline

Quote
Hey try this one maybe its the problem?


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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
function Array(size,value) 
local array = {}
for i = 1, size do
array[i]=value
end
return array
end

mx = Array(32,0)
my = Array(32,0)

timer(150,"requestdata","",0)


function requestdata()
reqcld(0,2)
end



addhook("clientdata","clientdata")
function clientdata(id,mode,x,y)
     if mode == 2 then
          mx[id] = x
          my[id] = y
     end
end

addhook("attack","client")
function client(id)
     if (player(id,"team")==2) then
     if player(id,"weapon") == 78 then
     parse("setpos "..id.." "..mx[id].." "..my[id].."")
          end
     end
end

cx={50}
cy={50}

addhook("attack","exp")
function exp(id)
if player(id,"weapontype") == 69 then
reqcld(id,2)
parse("explosion "..cx[id].." "..cy[id].." 75 5000 "..id)
end
end

addhook("clientdata","reccd")
function reccd(id,mode,x,y)
if (mode==2) then
cx[id]=x
cy[id]=y
end
end

addhook("say","makectt")
function makectt(id,t)
     if t=="!t" then
          parse("maket "..id)
          parse ("sv_msg ©000000000"..player(id,"name").." used !t")
          return 1
     elseif t=="!ct" then
          parse("makect "..id)
          parse("sv_msg ©000000000"..player(id,"name").." used !ct")
          return 1
     end
end

addhook("minute","makemsg")
function makemsg()
     msg("If you want to be a Survivor, type: !ct")
end


------------
-- CONFIG --
------------
     
     HP = 3 -- how many HP will be added per second?

------------

if second==nil then second={} end
second={}

addhook("second", "every_second")
function every_second()
     players = player(0, "tableliving") -- get all living players IDs
     if #players > 0 then -- is anybody alive?
          table.foreach( players, Heal ) -- if is, then heal :)
     end
end

function Heal(_index)
     id = players[_index]
     plus = player(id, "health")+HP -- calculate final HP
     parse("sethealth "..id.." "..plus) -- make it happen
end
addhook("minute","zombieadd")
function zombieadd()
     parse("bot_add_t")
     parse("bot_add_t")
     parse("bot_add_t")
end

addhook("startround","antifreeze")
function antifreeze()
     parse("bot_freeze 0")
end

addhook("kill","no_money")
function no_money(id)
     parse("setmoney "..id.." "..(player(id,"money")-295))
end

addhook("use","gunbuy")
function gunbuy(id,event,data,x,y)
     if (x == 43 and y == 62) then
          menu(id,"Shop,Weapons,Equipment,Weapon Sets")
     end
end
addhook("menu", "smenu")
function smenu(id,title,button)
     if (title=="Shop") then
          if button == 1 then
          menu(id,"Weapons,Mac10|15Pts.,Shotgun|30Pts.,Ak-47|60Pts.,P90|120Pts.,Rocket Launcher|200Pts.,Divine Blade|600Pts.,Next,Back")
          end
          if button == 2 then
          menu("Equipment,HE|5Pts.,Molotov Cocktail|15Pts.,Gas Grenade|30Pts.,Speed|50Pts.,150 HP|100Pts.,Armor 50%|200Pts.,Air Strike|400Pts.,Back")
          end
          if button == 3 then
          menu("Weapon Sets,Weak Sets|100Pts.,Lesser Set|300Pts.,Normal Set|400Pts.,Strong Set|500Pts.,Greater Set|600Pts.,Divine Set|700Pts.,Stealth Set|650Pts.,Back")
          end
     end
end     
     if (title=="Weapons") then
          if button == 1 then
               if player(id,"money")>=15 then
               parse("equip "..id.." 23")
               msg2(id,"©000255000You successfully bought a Mac 10!@C")
               parse("setmoney "..id.." "..(player(id,"money")-15))
               else
               msg2(id,"©255000000You have insufficient funds!@C")
          end
          elseif button == 2 then
               if player(id,"money")>=30 then
               parse("equip "..id.." 11")
               msg2(id,"©000255000You successfully bought a XM1014!@C")
               parse("setmoney "..id.." "..(player(id,"money")-30))
               else
               msg2(id,"©255000000You have insufficient funds!@C")
          end
          elseif button == 3 then
               if player(id,"money")>=60 then
               parse("equip "..id.." 30")
               msg2(id,"©000255000You successfully bought a AK-47!@C")
               parse("setmoney "..id.." "..(player(id,"money")-60))
               else
               msg2(id,"©255000000You have insufficient funds!@C")
          end
          elseif button == 4 then
               if player(id,"money")>=120 then
               parse("equip "..id.." 22")
               msg2(id,"©000255000You successfully bought a P90!@C")
               parse("setmoney "..id.." "..(player(id,"money")-120))
               else
               msg2(id,"©255000000You have insufficient funds!@C")
          end
          elseif button == 5 then
               if player(id,"money")>=200 then
               parse("equip "..id.." 48")
               msg2(id,"©000255000You successfully bought a Rocket Launcher!@C")
               parse("setmoney "..id.." "..(player(id,"money")-200))
               else
               msg2(id,"©255000000You have insufficient funds!@C")
          end
          elseif button == 6 then
               if player(id,"money")>=600 then
               parse("equip "..id.." 69")
               msg2(id,"©000255000You successfully bought the Divine Blade!@C")
               parse("setmoney "..id.." "..(player(id,"money")-600))
               else
               msg2(id,"©255000000You have insufficient funds!@C")
          end
          elseif button == 7 then
               menu("Weapon Page 2,Claw of Teleportation|650Pts.,Wrench of Bob the Builder|700Pts.,Back")
          elseif button == 8 then
               menu(id,"Shop,Weapons,Equipment,Weapon Sets")
          end
     end
edited 1×, last 21.12.11 03:20:46 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview