Forum

> > CS2D > Scripts > Lua Error
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Error

8 replies
To the start Previous 1 Next To the start

moved Lua Error

Hunter162
User Off Offline

Quote
argh damit
it all went well but one little problem
i become soldier matter which one i clik


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
-----------------------------------------
--  Class   Fight   Script  Made   By  --
------------   Hunter162  ---------------
-----------------------------------------

if sample==nil then sample={} end
sample.classes={}


-- INITIAL SETUP
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end
sample.classes.class=initArray(32)
function sample.classes.classmenu(id)
          menu(id,"Class Menu,Soldier|Machinegun,Defender|Shield,Pyro|Flamethrower,Spy|Stealth,Enginer|Wrench,Equipment Master|All Equipments")
     end



-- TEAM -> CLASS
addhook("team","sample.classes.team")
function sample.classes.team(id,team)
	if (team>0) then
		sample.classes.classmenu(id)
	end
end

-- SERVERACTION
addhook("serveraction","sample.classes.serveraction")
function sample.classes.serveraction(id)
menu(id,"Select your class,Soldier,Defender,Pyro,Spy,Enginer,Equipment Master")
end



-- CLASS SELECTION
addhook("menu","sample.classes.menu")
function sample.classes.menu(id,menu,sel)
        if (menu=="Select your Class") then
             sample.classes.class[id]=sel
                if (player(id,"health")>0) then
                parse("killplayer "..id)
                end
        end
end

-- SPAWN
addhook("spawn","sample.classes.spawn")
function sample.classes.spawn(id)
	-- Soldier
	if (sample.classes.class[id]<=1) then                
                parse ("setmaxhealth "..id.." 250")
                parse ("speedmod "..id.." 1")
                parse ("setarmor "..id.." 100")
                return "40,81,76,5,85";
        end
        -- Defender
	if (scriptclassmenu[id]==2) then
                parse ("speedmod "..id.." 1")
                parse ("setmaxhealth "..id.." 100")
                return "41,83,3,85";
        end
        -- Pyro
	if (scriptclassmenu[id]==3) then
                parse ("speedmod "..id.." 1")
                parse ("setmaxhealth "..id.." 100")
                return "46,4,69,82,73";
        end
        -- Spy
	if (scriptclassmenu[id]==4) then
                parse ("speedmod "..id.." 100")
                parse ("setmaxhealth "..id.." 100")
                return "45,84,6,69,77,87";
        end
        -- Enginer
	if (scriptclassmenu[id]==5) then
                parse("setmaxhealth "..id.." 250")
                parse("setarmor "..id.." 250")
                parse("speedmod "..id.." 40")
                return "74,10,11,5";
        end
        -- Equipment Master
	if (scriptclassmenu[id]==6) then
                parse ("speedmod "..id.." 1")
                parse ("setmaxhealth "..id.." 100")
                return "88,69,85,78,51,52,53,54,55,56,58,59,72,73,75,76,77,86,87";
	end
end




-- NO BUYING
addhook("buy","sample.classes.buy")
function sample.classes.buy()
	return 1
end


-- NO COLLECTING
addhook("walkover","sample.classes.walkover")
function sample.classes.walkover(id,iid,type)
	if (type>=61 and type<=68) then
		return 0
	end
	return 1
end


-- NO DROPPING
addhook("drop","sample.classes.drop")
function sample.classes.drop()
	return 1
end


-- NO DEAD DROPPING
addhook("die","sample.classes.die")
function sample.classes.die()
	return 1
end
edited 3×, last 07.02.11 12:27:40 pm

Admin/mod comment

this post is OBVIOUSLY about Lua so please use the scripting forum! moved!

old Re: Lua Error

Overseer
User Off Offline

Quote
UNFINISHED!!!
finish it
edited 3×, last 07.02.11 11:42:16 am

old Re: Lua Error

Hunter162
User Off Offline

Quote
thks overseer
but what is the unfinidhed string near 40?
i find the number 40 but i donno whats wrong with it

old Re: Lua Error

Cure Pikachu
User Off Offline

Quote
1
parse("speedmod "..id.." 40)
Replace it with
1
parse("speedmod "..id.." 40") -- You forgot to close the 40
EDIT: Do the same for mostly all the parse functions on your script

old Re: Lua Error

Hunter162
User Off Offline

Quote
thks pikachu but still theres more error
the attempt to compare nil one

man my lua relly has alot of errors

i press F2 and the menu got shoe up but what is that compare error thing?

old Re: Lua Error

Cure Pikachu
User Off Offline

Quote
1.
More >

2.
More >

Edit: 3.
More >
edited 1×, last 07.02.11 12:40:00 pm

old Re: Lua Error

Banaan
User Off Offline

Quote
Hunter162 that's certainly not the best source to get to know Lua since it entirely revolves around the game U61. Therefore, it uses functions outside the standard library (just like CS2D Lua does) which might confuse people.

http://luatut.com/ is really useful for the basics, once you get to know it better take a look around at the official Lua tutorials like Reference Manual or the PIL (Programming in Lua).

TKD's tutorial focused on Lua in CS2D is useful too: http://cs2d.com/tut/tkdlua/luatut.html
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview