Forum

> > CS2D > Scripts > If you press E then menu appears!
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch If you press E then menu appears!

14 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt If you press E then menu appears!

Obviously Exactly Myself
User Off Offline

Zitieren
Can one of you make me script of when you "use" or press E in a specific spot, a menu appears and I can put parses and stuff.

Just tell me where to put:
If X, put "mom"
If Y, put "dad"
For the menu title, put "children"
For items, put "son"
For items description (the gray text), put "daughter"
And just tell me where I'll put the parse commands like equip,sethealth,etc.
lol, I'm not making fun of those above.

Sorry for too many lua requests because I suck at lua but I know it a bit.

EDIT: Changed the title...
1× editiert, zuletzt 22.12.11 11:22:28

Admin/Mod Kommentar

do not use pointless more or spoiler tags please.. thanks. removed

alt Re: If you press E then menu appears!

Obviously Exactly Myself
User Off Offline

Zitieren
I REPEAT:

Can one of you make me script of when you "use" or press E in a specific spot, a menu appears and I can put parses and stuff.

Just tell me where to put:
If X, put "mom"
If Y, put "dad"
For the menu title, put "children"
For items, put "son"
For items description (the gray text), put "daughter"
And just tell me where I'll put the parse commands like equip,sethealth,etc.
lol, I'm not making fun of those above.

Sorry for too many lua requests because I suck at lua but I know it a bit.

alt This?

EP
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
dadx=1 --Tile X
momy=1 --Tile Y

addhook("use","son")
function son(id)
	if player(id,"tilex")==dadx and player(id,"tiley")==momy then
menu(id,"Grandmother,Grandfather,Mom,Son,Daughter,Dad")
end -- Close IF
end -- Close Function
Good luck.

alt Re: If you press E then menu appears!

Obviously Exactly Myself
User Off Offline

Zitieren
I mean when you use E while standing on a spot, it will show up a menu, and I know how the menu appears but I don't know where to put the commands after pressing an item in the menu.

By spot I mean:
1
if player(id, 'tilex') == 42 and player(id, 'tiley') == 21 then

--EDIT--

I got this but it won't work
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
addhook('use','zj_use')
function zj_use(id,x,y)
	if player(id, 'tilex') == 42 and player(id, 'tiley') == 21 then
		menu(id,"Restaurant,Food (+10hp)|$10,Meat (Gut Bomb)|$10")
	elseif player(id, 'tilex') == 59 and player(id, 'tiley') == 143 then
		menu(id,"Buy Handgun,Pistol|$55,Deagle|$60")
	end
end

addhook("menu", "zj_buy")
function zj_buy(id,title,button)
	if (title=="Restaurant") then
		if button == 1 then
			if player(id, 'money') >= 10 then
				parse('sethealth '.. id ..' '.. (player(id, 'health') + 10))
				parse('setmoney '.. id ..' '.. (player(id, 'money') - 10))
				msg2(id,'You successfully bought food for $10!')
			else
				msg2(id,'You need at least $10 to buy food!')
			end
		elseif button == 2 then
			if player(id, 'money') >= 10 then
				parse('equip '..id..' 86')
				parse('setweapon '..id..' 86')
				parse('setmoney '.. id ..' '.. (player(id, 'money') - 10))
				msg2(id,'You successfully bought meat for $10!')
			else
				msg2(id,'You need at least $10 to buy meat!')
			end
	elseif (title=="Buy Handgun") then
		if button == 1 then
			if player(id, 'money') >= 55 then
				parse('equip '..id..' 6')
				parse('setweapon '..id..' 6')
				parse('setmoney '.. id ..' '.. (player(id, 'money') - 55))
				msg2(id,'You successfully bought this weapon for $55!')
			else
				msg2(id,'You need at least $55 to buy this weapon!')
			end
		elseif button == 2 then
			if player(id, 'money') >= 60 then
				parse('equip '..id..' 3')
				parse('setweapon '..id..' 3')
				parse('setmoney '.. id ..' '.. (player(id, 'money') - 60))
				msg2(id,'You successfully bought this weapon for $60!')
			else
				msg2(id,'You need at least $60 to buy this weapon!')
			end
		end
	end
end

LUA ERROR: maps/ZJ's City.lua:82: 'end' expected (to close 'function' at line 17) near '<eof>'
3× editiert, zuletzt 22.12.11 10:23:32

alt E = MENU "Response"

Dovahkin
User Off Offline

Zitieren
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
addhook('use','zj_use')
function zj_use(id,x,y)
     if (x == 42 and y == 21) then
          menu(id,"Restaurant,Food (+10hp)|$10,Meat (Gut Bomb)|$10")
     if (x == 59 and  == 143) then
          menu(id,"Buy Handgun,Pistol|$55,Deagle|$60")
     end
end

addhook("menu", "zj_buy")
function zj_buy(id,title,button)
	if (title=="Restaurant") then
	if button == 1 then
		if player(id, 'money')>= 10 then
                    parse("sethealth ".. id .." ".. (player(id, "health|) + 10))
                    parse("setmoney ".. id .." ".. (player(id, "money") - 10))
                    msg2(id,'You successfully bought food for $10!')
               else
                    msg2(id,"You need at least $10 to buy food")
               end
	elseif button == 2 then
               if player(id, 'money') >= 10 then
                    parse('equip '..id..' 86')
                    parse('setweapon '..id..' 86')
                    parse('setmoney '.. id ..' '.. (player(id, 'money') - 10))
                    msg2(id,'You successfully bought meat for $10!')
               else
                    msg2(id,'You need at least $10 to buy meat!')
               end
	end

     	if(title=="Buy Handgun") then
          	if button == 1 then
               	if player(id, 'money') >= 55 then
                    parse('equip '..id..' 6')
                    parse('setweapon '..id..' 6')
                    parse('setmoney '.. id ..' '.. (player(id, 'money') - 55))
                    msg2(id,'You successfully bought this weapon for $55!')
               else
                    msg2(id,'You need at least $55 to buy this weapon!')
               end
		elseif button == 2 then
               		if player(id, 'money') >= 60 then
                    parse('equip '..id..' 3')
                    parse('setweapon '..id..' 3')
                    parse('setmoney '.. id ..' '.. (player(id, 'money') - 60))
                    msg2(id,'You successfully bought this weapon for $60!')
               else
                    msg2(id,'You need at least $60 to buy this weapon!')
			end
		end
	end
end


Try this i fixed alot of things :))

alt LOL

Dovahkin
User Off Offline

Zitieren
Phew! I repeated it and so many errors! here its cool for now!

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
addhook("use","useme")
function useme(id,event,data,x,y)
	if (x == 42 and y == 21) then
		menu(id,"Restaurant,Food (+10hp)|$10,Meat (Gut Bomb)|$10")
	elseif (x == 59 and y == 143) then
		menu(id,"Buy Handgun,Pistol|$55,Deagle|$60")
	end
end

addhook("menu", "zj_buy")
	function zj_buy(id,title,button)
	if title == "Restaurant" then
		if button == 1 then
         		if player(id, 'money')>= 10 then
			parse("sethealth ".. id .." ".. (player(id, "health") + 10))
			parse("setmoney ".. id .." ".. (player(id, "money") - 10))
			msg2(id,'You successfully bought food for $10!')
			else
			msg2(id,"You need at least $10 to buy food")
		end
		elseif button == 2 then
		if player(id, 'money') >= 10 then
			parse('equip '..id..' 86')
			parse('setweapon '..id..' 86')
			parse('setmoney '.. id ..' '.. (player(id, 'money') - 10))
			msg2(id,'You successfully bought meat for $10!')
			else
			msg2(id,'You need at least $10 to buy meat!')
		end
	end

     		if title == "Buy Handgun" then
     		if button == 1 then
			if player(id, 'money') >= 55 then
				parse('equip '..id..' 6')
				parse('setweapon '..id..' 6')
				parse('setmoney '.. id ..' '.. (player(id, 'money') - 55))
				msg2(id,'You successfully bought this weapon for $55!')
				else
				msg2(id,'You need at least $55 to buy this weapon!')
			end

          			elseif button == 2 then
          			if player(id, 'money') >= 60 then
				parse('equip '..id..' 3')
				parse('setweapon '..id..' 3')
				parse('setmoney '.. id ..' '.. (player(id, 'money') - 60))
				msg2(id,'You successfully bought this weapon for $60!')
				else
				msg2(id,'You need at least $60 to buy this weapon!')
			end
		end
	end
end
end
1× editiert, zuletzt 22.12.11 14:15:31
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht