Why does my script not work?
10 replies



20.06.18 06:09:26 pm
Why does my script not work?
Help me?
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
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
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 "©255255255Money: ©255000000'..ms.money[id]..' " 12 408')
end
addhook ("serveraction","ser2")
function ser2(id,action)
if action == 1 then
ms.shophm(id)
end
end
function ms.shophm(id)
menu(id,"Menu Player,M4A1|200,M3|100,Shield|300,Armor%50|150,Stealth Suit|50")
end
addhook ("menu","ms.buy")
function ms.buy(id,title,button)
if title == "Menu Player" then
if button == 1 then
if ms.money[id] > 199 then
parse("equip "..id.." 32")
msg2(id,"©000255000You've buy M4A1!")
ms.money[id]=ms.money[id]-200
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Money!")
end
end
end
end
elseif button == 2 then
if ms.money[id] > 99 then
parse("speedmod "..id.." 10")
msg2(id,"©000255000You've buy M3!")
ms.money[id]=ms.money[id]-100
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Money!")
end
elseif button == 3 then
if ms.money[id] > 299 then
parse("speedmod "..id.." 41")
msg2(id,"©000255000You've buy Shield!")
ms.money[id]=ms.money[id]-300
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Money!")
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]+20
ms.moneyshow(id)
end
addhook("die","ms.die")
function ms.die(id)
ms.money[id]=ms.money[id]-5
ms.moneyshow(id)
end
addhook("minute","minute_shop")
function minute_shop()
msg("©255255255Thank you for playing on the server!")
end
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 "©255255255Money: ©255000000'..ms.money[id]..' " 12 408')
end
addhook ("serveraction","ser2")
function ser2(id,action)
if action == 1 then
ms.shophm(id)
end
end
function ms.shophm(id)
menu(id,"Menu Player,M4A1|200,M3|100,Shield|300,Armor%50|150,Stealth Suit|50")
end
addhook ("menu","ms.buy")
function ms.buy(id,title,button)
if title == "Menu Player" then
if button == 1 then
if ms.money[id] > 199 then
parse("equip "..id.." 32")
msg2(id,"©000255000You've buy M4A1!")
ms.money[id]=ms.money[id]-200
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Money!")
end
end
end
end
elseif button == 2 then
if ms.money[id] > 99 then
parse("speedmod "..id.." 10")
msg2(id,"©000255000You've buy M3!")
ms.money[id]=ms.money[id]-100
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Money!")
end
elseif button == 3 then
if ms.money[id] > 299 then
parse("speedmod "..id.." 41")
msg2(id,"©000255000You've buy Shield!")
ms.money[id]=ms.money[id]-300
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Money!")
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]+20
ms.moneyshow(id)
end
addhook("die","ms.die")
function ms.die(id)
ms.money[id]=ms.money[id]-5
ms.moneyshow(id)
end
addhook("minute","minute_shop")
function minute_shop()
msg("©255255255Thank you for playing on the server!")
end
Help me?

you should also indent your code with tabs. This way you can easily see in any editor if your code is structured correctly. Without tabs it is very hard and annoying to read and understand code.
The problem with this script is that it does not open and all these functions do not work I tried to "elseif" change to "if" well, only worked m4a1 everything else I could not buy why?
And Yates your script no work!
And Yates your script no work!
edited 2×, last 21.06.18 06:34:14 am
If you change an elseif to an if you need another end.
And please post an error report (the red line in your console)
And please post an error report (the red line in your console)
Share time limited free games here

@
Bowlinghead: You want me to showed a mistake?
[LUA ERROR:sys/lua/server.lua:43:'<eof>' expected near 'elseif'

[LUA ERROR:sys/lua/server.lua:43:'<eof>' expected near 'elseif'
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
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
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 "©255255255Money: ©255000000'..ms.money[id]..' " 12 408')
end
addhook("serveraction","ser2")
function ser2(id,action)
if action == 1 then
ms.shophm(id)
end
end
function ms.shophm(id)
menu(id,"Menu Player,M4A1|200,M3|100,Shield|300,Armor%50|150,Stealth Suit|50")
end
addhook("menu","ms.buy")
function ms.buy(id,title,button)
if title == "Menu Player" then
if button == 1 then
if ms.money[id] > 199 then
parse("equip "..id.." 32")
msg2(id,"©000255000You've buy M4A1!")
ms.money[id]=ms.money[id]-200
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Money!")
end
elseif button == 2 then
if ms.money[id] > 99 then
parse("speedmod "..id.." 10")
msg2(id,"©000255000You've buy M3!")
ms.money[id]=ms.money[id]-100
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Money!")
end
elseif button == 3 then
if ms.money[id] > 299 then
parse("speedmod "..id.." 41")
msg2(id,"©000255000You've buy Shield!")
ms.money[id]=ms.money[id]-300
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Money!")
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]+20
ms.moneyshow(id)
end
addhook("die","ms.die")
function ms.die(id)
ms.money[id]=ms.money[id]-5
ms.moneyshow(id)
end
addhook("minute","minute_shop")
function minute_shop()
msg("©255255255Thank you for playing on the server!")
end
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 "©255255255Money: ©255000000'..ms.money[id]..' " 12 408')
end
addhook("serveraction","ser2")
function ser2(id,action)
if action == 1 then
ms.shophm(id)
end
end
function ms.shophm(id)
menu(id,"Menu Player,M4A1|200,M3|100,Shield|300,Armor%50|150,Stealth Suit|50")
end
addhook("menu","ms.buy")
function ms.buy(id,title,button)
if title == "Menu Player" then
if button == 1 then
if ms.money[id] > 199 then
parse("equip "..id.." 32")
msg2(id,"©000255000You've buy M4A1!")
ms.money[id]=ms.money[id]-200
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Money!")
end
elseif button == 2 then
if ms.money[id] > 99 then
parse("speedmod "..id.." 10")
msg2(id,"©000255000You've buy M3!")
ms.money[id]=ms.money[id]-100
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Money!")
end
elseif button == 3 then
if ms.money[id] > 299 then
parse("speedmod "..id.." 41")
msg2(id,"©000255000You've buy Shield!")
ms.money[id]=ms.money[id]-300
ms.moneyshow(id)
else
msg2(id,"©255000000You have not enouch Money!")
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]+20
ms.moneyshow(id)
end
addhook("die","ms.die")
function ms.die(id)
ms.money[id]=ms.money[id]-5
ms.moneyshow(id)
end
addhook("minute","minute_shop")
function minute_shop()
msg("©255255255Thank you for playing on the server!")
end



