Forum

> > CS2D > Scripts > Buying wont work
Forums overviewCS2D overview Scripts overviewLog in to reply

English Buying wont work

2 replies
To the start Previous 1 Next To the start

old Buying wont work

Dovahkin
User Off Offline

Quote
I really forgot how to make scripts already. so here it is ;
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
function Array(size,value)
	local array = {}
	for i = 1, size do
		array[i]=value
	end
	return array
end


Dukespeak = {};
Duketold = {};
Dukebuy = {};

addhook("use","shop")
function shop(id, event, data, x, y)
	if (x == 3 and y == 5) then                                   
		menu(id,"Duke@b,Ask on whats the rules,Ask on how to open door,Do 

Job")
	end
end

addhook("join","onJoin")
function onJoin(id)
Dukespeak[id] = 0;
Duketold[id] = 0;
Dukebuy[id] = 0;
end

addhook("menu","lewl")
function lewl(id,title,button)
	if title == "Duke" then
		if button == 1 then
		if Duketold[id] == 0 then
                    		msg2(id,"Duke : Hmmmph... Just teamwork -_-")
                   			Dukespeak[id] = 1
                    		Duketold[id] = 1
               		elseif Duketold[id] == 1 then
                    		msg2(id,"Duke : I just told you. Wtf? Man.")
                    		Duketold[id] = 1
                    		Dukespeak[id] = 0
               		end
         		elseif button == 2 then
               		if Dukebuy[id] == 0 then
                    		msg2(id,"©255000000Sure ill open it for you, It'll cost you 45$. 

Would you like to buy?")
                    		menu(id,"Would you like to buy?, Yes (45$ loss), No.")
               		end
          	end
	if title == "Would you like to buy?" then
		if button == 1 and player(id,"money") >=45 then
			parse("trigger dyn1")
			parse("setmoney "..id.." "..player(id, "money")-45)
			msg2(id,"Door Opened!")
		elseif button == 2 then
			msg2(id,"Ok")
		end
	end
end
end
Whenever i click the YES button it wont work and the money wont decreased. It does nothin.

old Re: Buying wont work

Jynxxx
User Off Offline

Quote
Changed a few things.
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
function Array(size,value)
	local array = {}
	for i = 1, size do
		array[i]=value
	end
	return array
end


Dukespeak = {};
Duketold = {};
Dukebuy = {};

addhook("use","shop")
function shop(id, event, data, x, y)
	if (x == 3 and y == 5) then                                   
		menu(id,"Duke@b,Ask on whats the rules,Ask on how to open door,Do Job")
	end
end

addhook("join","onJoin")
function onJoin(id)
	Dukespeak[id] = 0;
	Duketold[id] = 0;
	Dukebuy[id] = 0;
end

addhook("menu","lewl")
function lewl(id,title,button)
	if title == "Duke" then
		if button == 1 then
			if Duketold[id] == 0 then
				msg2(id,"Duke : Hmmmph... Just teamwork -_-")
				Dukespeak[id] = 1
				Duketold[id] = 1
			elseif Duketold[id] == 1 then
				msg2(id,"Duke : I just told you. Wtf? Man.")
				Duketold[id] = 1
				Dukespeak[id] = 0
			end
		elseif button == 2 then
			if Dukebuy[id] == 0 then
				msg2(id,"©255000000Sure ill open it for you, It'll cost you 45$. Would you like to buy?")
				menu(id,"Would you like to buy?, Yes (45$ loss), No.")
			end
		end
	elseif title == "Would you like to buy?" then
		if button == 1 then
			if player(id,"money") >=44 then
				parse("trigger dyn1")
				parse("setmoney "..id.." "..player(id, "money")-45)
				msg2(id,"Door Opened!")
			end
		elseif button == 2 then
			msg2(id,"Ok")
		end
	end
end

old Team up

Dovahkin
User Off Offline

Quote
Hey Jynxxx. Would you help make scripts? Because im making a map where its an adventure world :)). I used to make scripts the last 6 months but i forgot XD. So help me?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview