Forum

> > CS2D > Scripts > What is the,'end' expected (to close 'if' at line)
Forums overviewCS2D overview Scripts overviewLog in to reply

English What is the,'end' expected (to close 'if' at line)

6 replies
To the start Previous 1 Next To the start

old What is the,'end' expected (to close 'if' at line)

Dovahkin
User Off Offline

Quote
near '(eof)'

>addhook("serveraction","shit")
addhook("menu", "mymenu")

function shit(id, sht)
if(sht==1) then
menu(id,"New Shop,Go to Items,Go to Armors")
end
end

function mymenu(id,a,b)
if a=="New Shop" then
if b==1 then
menu(id,"Go to Items,Gas Grenade,Flare,Rpg,He")
end
elseif a == "Go to Item" then
local mon = player(id,"money")
if b==1 and mon>=500 then
parse("equip "..id.." 72")
parse("setmoney "..id.." "..mon-500)
elseif mon<500 then
msg("©000255255You don't have money to buy this")
end
elseif a == "Go to Item" then
local mon = player(id,"money")
if b==2 and mon>=600 then
parse("equip "..id.." 54")
parse("setmoney "..id.." "..mon-600)
elseif mon<600 then
msg("©000255255You don't have money to buy this")
end

elseif a == "Go to Item" then
local mon = player(id,"money")
if b==3 and mon>=700 then
parse("equip "..id.." 47")
parse("setmoney "..id.." "..mon-700)
elseif mon<700 then
msg("©000255255You don't have money to buy this")
end

local mon = player(id,"money")
if b==4 and mon>=900 then
parse("equip "..id.." 51")
parse("setmoney "..id.." "..mon-900)
elseif mon<700 then
msg("©000255255You don't have money to buy this")
end

addhook("serveraction","lick")
addhook("nenu","mynenu")

function lick(id, lck)
if(lck==1) then
menu(id,"Armors,Power Armor/500$")
end
end

function mynenu(id,c,p)
if c=="Armors" then
if p==1 then
menu(id,"Go to Armors,Power Armor,Rpg,He!")
end
elseif c == "Go to Armors" then
local mon = player(id,"money")
if p==1 and mon>=500 then
parse("equip "..id.." 72")
parse("setmoney "..id.." "..mon-500)
elseif mon<500 then
msg("©000255255You don't have money to buy this")
end
end
end

old Re: What is the,'end' expected (to close 'if' at line)

Lee
Moderator Off Offline

Quote
add 2 ends at line 50-51

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
addhook("serveraction","shit")
addhook("menu", "mymenu")
function shit(id, sht)
	if(sht==1) then
		menu(id,"New Shop,Go to Items,Go to Armors")
	end
end
function mymenu(id,a,b)
	if a=="New Shop" then
		if b==1 then
			menu(id,"Go to Items,Gas Grenade,Flare,Rpg,He")
		end
	elseif a == "Go to Item" then
		
		local mon = player(id,"money")
		if b==1 and mon>=500 then
			parse("equip "..id.." 72")
			parse("setmoney "..id.." "..mon-500)
		elseif mon<500 then
			
			msg("©000255255You don't have money to buy this")
		end
	elseif a == "Go to Item" then
		
		local mon = player(id,"money")
		if b==2 and mon>=600 then
			parse("equip "..id.." 54")
			parse("setmoney "..id.." "..mon-600)
		elseif mon<600 then
			
			msg("©000255255You don't have money to buy this")
		end
	elseif a == "Go to Item" then
		
		local mon = player(id,"money")
		if b==3 and mon>=700 then
			parse("equip "..id.." 47")
			parse("setmoney "..id.." "..mon-700)
		elseif mon<700 then
			
			msg("©000255255You don't have money to buy this")
		end
		local mon = player(id,"money")
		if b==4 and mon>=900 then
			parse("equip "..id.." 51")
			parse("setmoney "..id.." "..mon-900)
		elseif mon<700 then
			
			msg("©000255255You don't have money to buy this")
		end
	end -- This is line 50
end
addhook("serveraction","lick")
addhook("nenu","mynenu")
function lick(id, lck)
	if(lck==1) then
		menu(id,"Armors,Power Armor/500$")
	end
end
function mynenu(id,c,p)
	if c=="Armors" then
		if p==1 then
			menu(id,"Go to Armors,Power Armor,Rpg,He!")
		end
	elseif c == "Go to Armors" then
		
		local mon = player(id,"money")
		if p==1 and mon>=500 then
			parse("equip "..id.." 72")
			parse("setmoney "..id.." "..mon-500)
		elseif mon<500 then
			
			msg("©000255255You don't have money to buy this")
		end
	end
end

if you need to check your indents, use http://cs2d.org/validate/ it works from time to time

old Sir lee

Dovahkin
User Off Offline

Quote
when i press the items,etc,it dont work
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview