Forum

> > CS2D > Scripts > What is the wrong in this lua?
Forums overviewCS2D overview Scripts overviewLog in to reply

English What is the wrong in this lua?

5 replies
To the start Previous 1 Next To the start

moved What is the wrong in this lua?

BcY
Reviewer 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
addhook("serveraction","meno")
function meno(id,p)
if p==1 then
menu(id,"Car Menu,Bravura|Medium Speed,Hotring Racer|THE FASTEST,Monster|THE SLOWEST,Sultan|Faster,Police|3.Faster,Ambulans|Faster,Cheetah|2.Faster,Turismo|2.Faster,Taxi|3.Faster")
end
end

addhook("menu","meno2")
function meno2(id,title,buton)
if title=="Car Menu" then
if buton==1 then
freeimage(id) 
id=image("gfx/carmod/Bravura.png",1,1,200+id)
parse("speedmod "..id.." 50")
elseif buton==2 then
freeimage(id) 
id=image("gfx/carmod/Hotring Racer.png",1,1,200+id)
parse("speedmod "..id.." 100")
elseif buton==3 then
freeimage(id) 
id=image("gfx/carmod/Monster.png",1,1,200+id)
parse("speedmod "..id.." 5")
elseif buton==4 then
freeimage(id) 
id=image("gfx/carmod/Sultan.png",1,1,200+id)
parse("speedmod "..id.." 65")
elseif buton==5 then
freeimage(id) 
id=image("gfx/carmod/Police.png",1,1,200+id)
parse("speedmod "..id.." 55")
elseif buton==6 then
freeimage(id) 
id=image("gfx/carmod/ambulance.png",1,1,200+id)
parse("speedmod "..id.." 65")
elseif buton==7 then
freeimage(id) 
id=image("gfx/carmod/Cheetah.png",1,1,200+id)
parse("speedmod "..id.." 75")
elseif buton==8 then
freeimage(id) 
id=image("gfx/carmod/Turismo.png",1,1,200+id)
parse("speedmod "..id.." 75")
elseif buton==9 then
freeimage(id) 
id=image("gfx/carmod/Taxi.png",1,1,200+id)
parse("speedmod "..id.." 75")
end
end
end

addhook("serveraction","meno3")
function meno3(id,pp)
if pp==2 then
freeimage(id)
parse("speedmod "..id.." 0")
end
end

2 problem:
when i select a car,it isnt giving speed.
and
when i selected a car,how can i remove it?

please help me.

Admin/mod comment

I can tell you what's wrong: You posted it in "General" instead of "Scripts"! Moved! Please use the right subsection next time! /DC

old Re: What is the wrong in this lua?

Yates
Reviewer Off Offline

Quote
Trying to remove an image without there actual being an image gives an error and stops from executing the rest of the code, that's why you don't get speed.

A lot is wrong in this, mostly done multiple times. And I'm too lazy to redo it.

old Re: What is the wrong in this lua?

Jynxxx
User Off Offline

Quote
try mixing the 2 serveraction functions.

1
2
3
4
5
6
7
8
9
addhook("serveraction","meno")
function meno(id,p)
	if p==1 then
		menu(id,"Car Menu,Bravura|Medium Speed,Hotring Racer|THE FASTEST,Monster|THE SLOWEST,Sultan|Faster,Police|3.Faster,Ambulans|Faster,Cheetah|2.Faster,Turismo|2.Faster,Taxi|3.Faster")
	elseif p==2 then
		freeimage(id)
		parse("speedmod "..id.." 0")
	end
end

and make sure you have the images in the right folder.

old Re: What is the wrong in this lua?

BcY
Reviewer Off Offline

Quote
images are ok.i think the problem isnt in server actions.

look:
when i select a car,it isnt giving "speed".(images are ok)
and
when i selected a car,how can i remove it's image?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview