Forum

> > CS2D > Scripts > Lua Problem!
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Problem!

10 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Lua Problem!

pereznico123
User Off Offline

Zitieren
The problem is :

°{eof}expected near 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
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
Dollar={}

-------------------------
-- Original Setup   --
-------------------------
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end
Dollar.money=initArray(32)
Dollar.moneyshow(id)
	parse('hudtxt2 '..id..' 1 "©3413934Dollar$: '..Dollar.money[id]..' " 13 200')
end

------------------------------
-- SHOP                    --
-- LOLLOLO
------------------------------
function Dollar.nica(id)
	menu(id,"Dollar Shop@b,Chocolate Cost:|45$,Chocolate3x Cost:|67$,Apple 

Cost:|92$,Mango Cost:|124$,Poison Meat Cost:|250$,Bacon Cost:|342$")
end

------------------------------
-- SHOP FUNCTIONS   --
------------------------------
addhook("menu","lol")
function lol(id,title,sel)
	if title == "Dollar Shop" then
		if sel == 1 then
			if Dollar.money[id] > 44 then
				parse("sethealth "..id.." 125")
				msg2(id,"©000255000You've Bought Chocolate!@C")
				Dollar.money[id]=Dollar.money[id]-45
				Dollar.moneyshow(id)
			else
				msg2(id,"©255000000You dont have enough 

dollars!@C")
			end
		end
		if sel == 2 then
			if Dollar.money[id] > 66 then
				parse("sethealth "..id.." 154")
				msg2(id,"©000255000You've Bought Chocolate3x!@C")
				Dollar.money[id]=Dollar.money[id]-67
				Dollar.moneyshow(id)
			else
				msg2(id,"©255000000You dont have enough 

dollars!@C")
			end
		end
		if sel == 3 then
			if Dollar.money[id] > 91 then
				parse("setmaxhealth "..id.." 120")
				parse("sethealth "..id.." 120")
				msg2(id,"©000255000You've Bought Apple!@C")
				Dollar.money[id]=Dollar.money[id]-92
				Dollar.moneyshow(id)
			else
				msg2(id,"©255000000You dont have enough 

dollars!@C")
			end
		end
		if sel == 4 then
			if Dollar.money[id] > 123 then
				parse("setmaxhealth "..id.." 150")
				parse("sethealth "..id.." 150")
				msg2(id,"©000255000You've Bought Mango!@C")
				Dollar.money[id]=Dollar.money[id]-124
				Dollar.moneyshow(id)
			else
				msg2(id,"©255000000You dont have enough 

dollars!@C")
			end
		end
		if sel == 5 then
			if Dollar.money[id] > 249 then
				parse("setmaxhealth "..id.." 185")
				parse("sethealth "..id.." 185")
				parse("equip "..id.." 72")
				msg2(id,"©000255000You've Bought Poison meat@C")
				Dollar.money[id]=Dollar.money[id]-250
				Dollar.moneyshow(id)
			else
				msg2(id,"©255000000You dont have enough 

dollars!@C")	
			end
		end
		if sel == 6 then
			if Dollar.money[id] > 341 then
				parse("equip "..id.." 88")
				parse("equip "..id.." 41")
				parse("setmaxhealth 250")
				parse("sethealth "..id.." 250")
				msg2(id,"©000255000You've Bought Bacon!@C")
				Dollar.money[id]=Dollar.money[id]-342
				Dollar.moneyshow(id)
			else
				msg2(id,"©255000000You dont have enough 

dollars!@C")
			end
		end
	end
end

-----------------------
-- Serveractions     --
-----------------------
addhook("serveraction","Dollar.action")
function Dollar.action(id,action)
	if action == 1 then
		Dollar.nica(id)
	end
end

------------------------
-- Kill and spawn     --
------------------------
addhook("spawn","Dollar.spawn")
function Dollar.spawn(id)
	Dollar.moneyshow(id)
end

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

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

thanks

alt Re: Lua Problem!

J4x
User Off Offline

Zitieren
precel is wrong, somewhere you have to delete a unnecessary end.

alt Re: Lua Problem!

Yates
Reviewer Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("menu","lol")
 function lol(id,title,sel)
      if title == "Dollar Shop" then
           if sel == 1 then
                if Dollar.money[id] > 44 then
                     parse("sethealth "..id.." 125")
                     msg2(id,"©000255000You've Bought Chocolate!@C")
                     Dollar.money[id]=Dollar.money[id]-45
                     Dollar.moneyshow(id)
                else
                     msg2(id,"©255000000You dont have enough 

 dollars!@C")
                end
end
Dont you need another end after this?

alt Re: Lua Problem!

J4x
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("menu","lol")
function lol(id,title,sel)
         if title == "Dollar Shop" then
         if sel == 1 then
         if Dollar.money[id] > 44 then
       parse("sethealth "..id.." 125")
  msg2(id,"©000255000You've Bought Chocolate!@C")
Dollar.money[id]=Dollar.money[id]-45
Dollar.moneyshow(id)
else
msg2(id,"©255000000You dont have enough 

dollars!@C")
end
end
end
end
Well, yeah it needs 2 ends.

alt Re: Lua Problem!

Yates
Reviewer Off Offline

Zitieren
Ah, end for the addhook function stuff and the other 3 for the ifs'

alt Re: Lua Problem!

Yates
Reviewer Off Offline

Zitieren
Meh, whatever it's called.
addhook
function
[lua]
end.
That's what I mean.

alt Re: Lua Problem!

Yasday
User Off Offline

Zitieren
Shouldn't Dollar.moneyshow(id) be a function?
1
Dollar.moneyshow = function(id) ... end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht