Forum

> > CS2D > Scripts > My Shop lua not working!
Forums overviewCS2D overview Scripts overviewLog in to reply

English My Shop lua not working!

8 replies
To the start Previous 1 Next To the start

old My Shop lua not working!

deadlox995
User Off Offline

Quote
i'm need help my shop lua not working,when i'm buy a HE it not doing any thing plz help.
plz test you will khow what wrong and fixed for me plz.

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
------------------Lua make by Deadlox-----------------
------------------USGN: 121114 & Deadlox995----------
 
ms={}
 
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end
ms.money=initArray(32)
 
function ms.moneyshow(id)
     parse('hudtxt2 '..id..' 1 "©255255255Ammo Packs: ©255000000'..ms.money[id]..' " 12 408')
end
 
addhook ("serveraction","ser")
function ser(id,action)
if player(id,"team")== 1 then
if action == 1 then
          ms.shopzm(id)
end
end
end
 
function ms.shopzm(id)
     menu(id,"Zombie Shop,GutBomd|5,Armor|10,Chainsaw|15,Zombie madness|20,RPG|50")
 
end
 
addhook ("menu","ms.buy")
function ms.buy(id,title,button)
     if title == "Zombie Shop" then
          if button == 1 then
               if ms.money[id] > 4 then
                    parse("equip "..id.." 86")
                    msg2(id,"©000255000You've buy GutBomd!")
                    ms.money[id]=ms.money[id]-5
                    ms.moneyshow(id)
               else
                    msg2(id,"©255000000You have not enouch Ammo Packs!")
               end
          end
          if button == 2 then
               if ms.money[id] > 9 then
                    parse("equip "..id.." 80")
                    msg2(id,"©000255000You've buy Armor!")
                    ms.money[id]=ms.money[id]-10
                    ms.moneyshow(id)
               else
                    msg2(id,"©255000000You have not enouch Ammo Pack!")
               end
          end
          if button == 3 then
               if ms.money[id] > 14 then
                    parse("equip "..id.." 85")
                    msg2(id,"©000255000You've buy Chainsaw!")
                    ms.money[id]=ms.money[id]-15
                    ms.moneyshow(id)
               else
                    msg2(id,"©255000000You have not enouch Ammo Pack!")
               end
          end
          if button == 4 then
               if ms.money[id] > 19 then
                    parse("setmaxealth "..id.." 250")
parse("speedmod "..id.." 6")
                    msg2(id,"©000255000You've Zombie madness!")
                    ms.money[id]=ms.money[id]-20
                    ms.moneyshow(id)
               else
                    msg2(id,"©255000000You have not enouch Ammo Pack!")
               end
          end
          if button == 5 then
               if ms.money[id] > 49 then
                    parse("equip "..id.." 47")
                    msg2(id,"©000255000You've buy RPG!")
                    ms.money[id]=ms.money[id]-50
                    ms.moneyshow(id)
               else
                    msg2(id,"©255000000You have not enouch Ammo Packs!")
               end
           end
         
        end
end
 
 
addhook ("serveraction","ser2")
function ser2(id,action)
if player(id,"team")== 2 then
if action == 1 then
          ms.shophm(id)
end
end
end
 
function ms.shophm(id)
     menu(id,"Human Shop,HE|1,Boot Speed|5,Chainsaw|10,Medic Armor|13,FN2000|15")
end
 
 
addhook ("menu","ms.buy")
function ms.buy(id,title,button)
     if title == "human Shop" then
          if button == 1 then
               if ms.money[id] > 0 then
                    parse("equip "..id.." 51")
                    msg2(id,"©000255000You've buy HE!")
                    ms.money[id]=ms.money[id]-1
                    ms.moneyshow(id)
               else
                    msg2(id,"©255000000You have not enouch Ammo Packs!")
               end
          end
          if button == 2 then
               if ms.money[id] > 9 then
                    parse("speedmod "..id.." 85")
                    msg2(id,"©000255000You've buy Chiansaw!")
                    ms.money[id]=ms.money[id]-10
                    ms.moneyshow(id)
               else
                    msg2(id,"©255000000You have not enouch Ammo Pack!")
               end
          end
          if button == 3 then
               if ms.money[id] > 9 then
                    parse("equip "..id.." 85")
                    msg2(id,"©000255000You've buy Chainsaw!")
                    ms.money[id]=ms.money[id]-10
                    ms.moneyshow(id)
               else
                    msg2(id,"©255000000You have not enouch Ammo Pack!")
               end
          end
          if button == 4 then
               if ms.money[id] > 12 then
                    parse("equip "..id.." 83")
msg2(id,"©000255000You've buy Medic Armor!")
                    ms.money[id]=ms.money[id]-13
                    ms.moneyshow(id)
               else
                    msg2(id,"©255000000You have not enouch Ammo Pack!")
               end
          end
          if button == 5 then
               if ms.money[id] > 14 then
                    parse("equip "..id.." 91")
                    msg2(id,"©000255000You've buy FN2000!")
                    ms.money[id]=ms.money[id]-15
                    ms.moneyshow(id)
               else
                    msg2(id,"©255000000You have not enouch Ammo Packs!")
               end
           end
         
     end
end
 
addhook("spawn","ms.spawn")
function ms.spawn(id)
     ms.moneyshow(id)
end
 
addhook("kill","ms.kill")
function ms.kill(id)
     ms.money[id]=ms.money[id]+1
     ms.moneyshow(id)
end
 
addhook("die","ms.die")
function ms.die(id)
     ms.money[id]=ms.money[id]-0
     ms.moneyshow(id)
end
 
addhook("minute","minute_shop")
function minute_shop()
     msg("©255255255Have Fun! Thanks For Playing!")
     msg("©000255000My USGN: 121114")
         msg("©000255000LUA make by Deadlox")
end
edited 2×, last 27.04.14 12:04:18 pm

old Re: My Shop lua not working!

Mora
User Off Offline

Quote
Here is:
tested, work
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
ms={}

function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
ms.money=initArray(32)

function ms.moneyshow(id)
parse('hudtxt2 '..id..' 1 "©255255255Ammo Packs: ©255000000'..ms.money[id]..' " 12 408')
end

addhook ("serveraction","ser")
function ser(id,action)
if player(id,"team")== 1 then
if action == 1 then
ms.shopzm(id)
end
end
end

function ms.shopzm(id)
menu(id,"Zombie Shop,GutBomd|5,Armor|10,Chainsaw|15,Zombie madness|20,RPG|50")

end

addhook ("menu","ms.buy")
function ms.buy(id,title,button)
if title == "Zombie Shop" then
if button == 1 then
if ms.money[id] > 4 then
parse("equip "..id.." 86")
msg2(id,"©000255000You've buy GutBomd!")
ms.money[id]=ms.money[id]-5
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Ammo Packs!")
end
end
elseif button == 2 then
if ms.money[id] > 9 then
parse("equip "..id.." 80")
msg2(id,"©000255000You've buy Armor!")
ms.money[id]=ms.money[id]-10
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Ammo Pack!")
end
elseif button == 3 then
if ms.money[id] > 14 then
parse("equip "..id.." 85")
msg2(id,"©000255000You've buy Chainsaw!")
ms.money[id]=ms.money[id]-15
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Ammo Pack!")
end
elseif button == 4 then
if ms.money[id] > 19 then
parse("setmaxealth "..id.." 250")
parse("speedmod "..id.." 6")
msg2(id,"©000255000You've Zombie madness!")
ms.money[id]=ms.money[id]-20
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Ammo Pack!")
end
elseif button == 5 then
if ms.money[id] > 49 then
parse("equip "..id.." 47")
msg2(id,"©000255000You've buy RPG!")
ms.money[id]=ms.money[id]-50
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Ammo Packs!")
end

end
end


addhook ("serveraction","ser2")
function ser2(id,action)
if player(id,"team")== 2 then
if action == 1 then
ms.shophm(id)
end
end
end

function ms.shophm(id)
menu(id,"Human Shop,HE|1,Boot Speed|5,Chainsaw|10,Medic Armor|13,FN2000|15")
end


addhook ("menu","ms.buy")
function ms.buy(id,title,button)
if title == "Human Shop" then
if button == 1 then
if ms.money[id] > 0 then
parse("equip "..id.." 51")
msg2(id,"©000255000You've buy HE!")
ms.money[id]=ms.money[id]-1
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Ammo Packs!")
end
end
elseif button == 2 then
if ms.money[id] > 9 then
parse("speedmod "..id.." 85")
msg2(id,"©000255000You've buy Chiansaw!")
ms.money[id]=ms.money[id]-10
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Ammo Pack!")
end
elseif button == 3 then
if ms.money[id] > 9 then
parse("equip "..id.." 85")
msg2(id,"©000255000You've buy Chainsaw!")
ms.money[id]=ms.money[id]-10
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Ammo Pack!")
end
elseif button == 4 then
if ms.money[id] > 12 then
parse("equip "..id.." 83")
msg2(id,"©000255000You've buy Medic Armor!")
ms.money[id]=ms.money[id]-13
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Ammo Pack!")
end
elseif button == 5 then
if ms.money[id] > 14 then
parse("equip "..id.." 91")
msg2(id,"©000255000You've buy FN2000!")
ms.money[id]=ms.money[id]-15
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Ammo Packs!")
end

end
end

addhook("spawn","ms.spawn")
function ms.spawn(id)
ms.moneyshow(id)
end

addhook("kill","ms.kill")
function ms.kill(id)
ms.money[id]=ms.money[id]+1
ms.moneyshow(id)
end

addhook("die","ms.die")
function ms.die(id)
ms.money[id]=ms.money[id]-0
ms.moneyshow(id)
end

addhook("minute","minute_shop")
function minute_shop()
msg("©255255255Have Fun! Thanks For Playing!")
msg("©000255000My USGN: 121114")
msg("©000255000LUA make by Deadlox")
end
edited 3×, last 27.04.14 03:05:22 pm

old Re: My Shop lua not working!

Dousea
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
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
ms = {}
ms.money = {}
ms.shop = {
	{
		{"Gut Bomb", 5, function (id) parse ("equip " .. id .. " 86") end},
		{"Armor", 10, function (id) parse ("equip " .. id .. " 80") end},
		{"Chainsaw", 15, function (id) parse ("equip " .. id .. " 85") end},
		{"Zombie Madness", 20, function (id) parse ("setmaxhealth " .. id .. " 250"); parse ("speedmod " .. id .. " 6") end},
		{"RPG", 50, function (id) parse ("equip " .. id .. " 47") end}
	},
	{
		{"HE", 1, function (id) parse ("equip " .. id .. " 51") end},
		{"Boot Speed", 5, function (id) parse ("speedmod " .. id .. " 6") end},
		{"Chainsaw", 10, function (id) parse ("equip " .. id .. " 85") end},
		{"Medic Armor", 12, function (id) parse ("equip " .. id .. " 83") end},
		{"FN F2000", 15, function (id) parse ("equip " .. id .. " 91") end}
	}
}

for id = 1, 32 do
	ms.money[id] = 0
end


local hooks = {"always", "serveraction", "menu", "kill", "die", "minute"}

for key, hook in pairs (hooks) do
	addhook (hook, "ms." .. hook)
end

function ms.always ()
	for key, id in pairs (player (0, "tableliving")) do
		parse ("hudtxt2 " .. id .. " 1 \"\169255255255Ammo Packs: \169255000000" .. ms.money[id] .. "\" 12 408")
	end
end

function ms.serveraction (id, action)
	if (action == 1) then
		if (player (id, "team") == 1 or player (id, "team") == 2) then
			local title = {"Zombie Shop", "Human Shop"}
			local buttons = ""
			
			for key, value in pairs (ms.shop[player (id, "team")]) do
				buttons = buttons .. value[1] .. ","
			end
			
			menu (id, title[player (id, "team")] .. "," .. buttons)
		end
	end
end

function ms.menu (id, title, button)
	local titles = {"Zombie Shop", "Human Shop"}
	
	if (titles[player (id, "team")] and title == titles[player (id, "team")]) then
		if (button ~= 0) then
			if (ms.money[id] >= ms.shop[player (id, "team")][2]) then
				ms.money[id] = (ms.money[id] - ms.shop[player (id, "team")][2])
				_G["shopfunction"] = ms.shop[player (id, "team")][3]
				
				msg2 (id, "\169255000000You have successfully bought " .. ms.shop[player (id, "team")][1])
				_G["shopfunction"] (id)
			else
				msg2 (id, "\169255000000You have not enough Ammo Packs")
			end
		end
	end
end

function ms.kill (killer)
	ms.money[killer] = (ms.money[killer] + 1)
end

function ms.die (victim)
	if (ms.money[victim] > 0) then
		ms.money[victim] = (ms.money[victim] - 1)
	end
end

function ms.minute ()
	msg ("\169255255255Have fun! Thanks for playing!")
	msg ("\169000255000My U.S.G.N.: 121114")
	msg ("\169000255000Lua made by Deadlox")
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview