Forum

> > CS2D > Scripts > help me with my lua script
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch help me with my lua script

20 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt help me with my lua script

Glix
User Off Offline

Zitieren
help me with this script this dont work what wrong?
when i press f2 the menu opens all ok. but it don't work.(when i press teleport yellew nothing happens)

THIS IS MY COMPLETE SCRIPT!

Console says
1
LUA ERROR: maps/propnic_happytown_b0.1.0.lua:78: unfinished string near '")'
No 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
ddhook("serveraction" , "sa")
function sa(id,action)
     if action==1 then
     menu(id,"Main Menu,Extra Shop|Shop,Teleport|Teleports,Extra|+bonus")
end
end

addhook("menu" , "menu_1")
function menu_1(id, title, button)
     if (title=="Main Menu") then
     if button==1 then
     menu(id,"Extra Shop,Deagle|650$,M3|1700$,AK47|2500$")
end
     if button==2 then
     menu(id,"Teleport,Teleport green|2,000$,Teleport yellow|2,000$")
end
end
     if (title=="Buy weapon") then
     if button==1 then
     if (player(id,"money")>=2000) then
parse("setpos "..id.." 400 2608 ")
parse("setmoney "..id.." "..player(id,"money")-2000)
msg2(id,"©000255000You Teleported for 2,000$ !!!")
else
msg2(id,"©000255000Not enough money !")
end
end
     if button==2 then
     if (player(id,"money")>=2000) then
parse("setpos "..id.." 1904 2064 ")
parse("setmoney "..id.." "..player(id,"money")-2000)
msg2(id,"©000255000You Teleported for 2,000$ !!!")
else
msg2(id,"©000255000Not enough money !")
end
end
     if button==3 then
     if (player(id,"money")>=2500) then
parse("equip "..id.." 30 ")
parse("setmoney "..id.." "..player(id,"money")-2500)
parse("setweapon "..id.." 30 ")
msg2(id,"©000255000You buy a AK-47 for 2500$ !!!")
else
msg2(id,"©000255000Not enough money !")
end
end
end

     if (title=="Extra|+bonus") then
     if button==1 then
     if (player(id,"money")>=300) then
parse("equip "..id.." 64 ")
parse("setmoney "..id.." "..player(id,"money")-300)
msg2(id,"©000255000You buy a Medikit for 300$ !!!")
else
msg2(id,"©000255000Not enough money !")
end
end
     if button==2 then
     if (player(id,"money")>=650) then
parse("equip "..id.." 57 ")
parse("setmoney "..id.." "..player(id,"money")-650)
msg2(id,"©000255000You buy a Kevlar for 650$ !!!")
else
msg2(id,"©000255000Not enough money !")
end
end
end
end

addhook("startround",start.round")
function start.round()
parse('hudtxt2 '..id..' 41 "©000255000Text" 240 5')
end
17× editiert, zuletzt 10.05.11 16:50:39

alt Re: help me with my lua script

Homam
User Off Offline

Zitieren
@Yates,
Propnic hat geschrieben
Console says

1
LUA ERROR: maps/propnic_happytown_b0.1.0.lua:11: attempt to con catenate global 'id' (a nil value)

alt Re: help me with my lua script

DannyDeth
User Off Offline

Zitieren
Because they can be there, and can help readability. They can also do shit like:
1
if not ( id == 3 and player(id,"name") == "LolHai" ) then

alt Re: help me with my lua script

Starkkz
Moderator Off Offline

Zitieren
Did someone look at the first line of the script?, because the parameter "id" is not given. Propnic, if you want any help you may give the complete lua script.

alt Re: help me with my lua script

J4x
User Off Offline

Zitieren
i't not shure but try with this:
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
ddhook("serveraction" , "sa")
function sa(id,action)
	if action==1 then
	menu(id,"Main Menu,Extra Shop|Shop,Teleport|Teleports,Extra|+bonus")
end
end

addhook("menu" , "menu_1")
function menu_1(id, title, button)
	if (title=="Main Menu") then
	if button==1 then
	menu(id,"Extra Shop,Deagle|650$,M3|1700$,AK47|2500$")
end
	if button==2 then
	menu(id,"Teleport,Teleport green|2,000$,Teleport yellow|2,000$")
end
end
	if (title=="Buy weapon") then
	if button==1 then
	if (player(id,"money")>=2000) then
parse("setpos "..id.." 400 2608 ")
parse("setmoney "..id.." "..player(id,"money")-2000)
msg2(id,"©000255000You Teleported for 2,000$ !!!")
else
msg2(id,"©000255000Not enough money !")
end
end
	if button==2 then
	if (player(id,"money")>=2000) then
parse("setpos "..id.." 1904 2064 ")
parse("setmoney "..id.." "..player(id,"money")-2000)
msg2(id,"©000255000You Teleported for 2,000$ !!!")
else
msg2(id,"©000255000Not enough money !")
end
end
	if button==3 then
	if (player(id,"money")>=2500) then
parse("equip "..id.." 30 ")
parse("setmoney "..id.." "..player(id,"money")-2500)
parse("setweapon "..id.." 30 ")
msg2(id,"©000255000You buy a AK-47 for 2500$ !!!")
else
msg2(id,"©000255000Not enough money !")
end
end
end

	if (title=="Extra|+bonus") then
	if button==1 then
	if (player(id,"money")>=300) then
parse("equip "..id.." 64 ")
parse("setmoney "..id.." "..player(id,"money")-300)
msg2(id,"©000255000You buy a Medikit for 300$ !!!")
else
msg2(id,"©000255000Not enough money !")
end
end
	if button==2 then
	if (player(id,"money")>=650) then
parse("equip "..id.." 57 ")
parse("setmoney "..id.." "..player(id,"money")-650)
msg2(id,"©000255000You buy a Kevlar for 650$ !!!")
else
msg2(id,"©000255000Not enough money !")
end
end
end
end

addhook("startround",start.round")
function start.round()
     parse('hudtxt2 '..id..' 41 "©000255000Text" 240 5')
end

alt Re: help me with my lua script

Dovahkin
User Off Offline

Zitieren
Ummm......... i change alot you can just copy or edit it and have fun

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
addhook("serveraction","sample")
function sample(id,action)
	if action == 1 then
 		menu(id,"Main Menu@b,Extra 

Shop|Shop,Teleport|Teleports,Extra|+bonus")
	end
end

addhook("menu","menucheck")
function menucheck(id,title,sel)
	if title == "Main Menu" then
		if sel == 1 then
			menu(id,"Extra Shop,Deagle|650$,M3|1700$,AK47|2500$")
		end
		if sel == 2 then
			menu(id,"Teleport,Teleport green|2,000$,Teleport 

yellow|2,000$")
		end
	end
end

addhook("menu","wtf")
function wtf(id,title,sel)
	if title == "Extra Shop" then
		if sel == 1 and player(id,"money") >=649 then
			parse("equip "..id.." 3")
			parse("setmoney "..id.." "..player(id,"money")-650)
			msg2(id,"©000255000You've Succesfully bought Deagle!")
		end
		if sel == 2 and player(id,"money") >=1699 then
			parse("equip "..id.." 10")
			parse("setmoney "..id.." "..player(id,"money")-1700)
			msg2(id,"©000255000You've Succesfully bought M3!")
		end
		if sel == 3 and player(id,"money") >=2499 then
			parse("equip "..id.." 30")
			parse("setmoney "..id.." "..player(id,"money")-2500)
			msg2(id,"©000255000You've Succesfully bought Ak-47!")
		end
	end
	if title == "Teleport" then
		if sel == 1 and player(id,"money") >=1999 then
			parse("setpos "..id.." 400 2608 ")
			parse("setmoney "..id.." "..player(id,"money")-2000)
			msg2(id,"©000255000You Teleported for 2,000$ !!!")
		end
		if sel == 3 and player(id,"money") >=1999 then
			parse("setpos "..id.." 200 200 ")
			parse("setmoney "..id.." "..player(id,"money")-2000)
			msg2(id,"©000255000You Teleported for 2,000$ !!!")
		end
	end

-------------------
-- Spawn       --
-------------------
addhook("spawn","lol")
function lol(id)
	parse('hudtxt2 '..id..' 1 "©000255000Text" 240 5')
end
end


Lol?

and the teleporter thing? of course it wont work its out of bounds! 1918 or blah blah blah!

alt Re: help me with my lua script

Glix
User Off Offline

Zitieren
@FN_Linkin Park it says this in console
1
LUA ERROR: maps/propnic_happytown_b0.1.0.lua:78: unfinished string near '")'
1× editiert, zuletzt 10.05.11 16:52:47

alt Re: help me with my lua script

Homam
User Off Offline

Zitieren
@FN_Linkin Park, Are you blind? You forgot the A -_-'.

1
ddhook("serveraction" , "sa")

It should be:

1
addhook("serveraction" , "sa")

alt Re: help me with my lua script

Yates
Reviewer Off Offline

Zitieren
Wow, he forgot a letter because he was rushing to help someone. You don't have to do this "-_-" shit on it, just a nice comment would do.

alt Re: help me with my lua script

J4x
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
54
55
56
57
58
59
addhook("serveraction","sample")
function sample(id,action)
     if action == 1 then
          menu(id,"Main Menu@b,Extra,Shop|Shop,Teleport|Teleports,Extra|+bonus")
     end
end

addhook("menu","menucheck")
function menucheck(id,title,sel)
     if title == "Main Menu" then
          if sel == 1 then
               menu(id,"Extra Shop,Deagle|650$,M3|1700$,AK47|2500$")
          end
          if sel == 2 then
               menu(id,"Teleport,Teleport green|2,000$,Teleport,yellow|2,000$")
          end
     end
end

addhook("menu","wtf")
function wtf(id,title,sel)
     if title == "Extra Shop" then
          if sel == 1 and player(id,"money") >=649 then
               parse("equip "..id.." 3")
               parse("setmoney "..id.." "..player(id,"money")-650)
               msg2(id,"©000255000You've Succesfully bought Deagle!")
          end
          if sel == 2 and player(id,"money") >=1699 then
               parse("equip "..id.." 10")
               parse("setmoney "..id.." "..player(id,"money")-1700)
               msg2(id,"©000255000You've Succesfully bought M3!")
          end
          if sel == 3 and player(id,"money") >=2499 then
               parse("equip "..id.." 30")
               parse("setmoney "..id.." "..player(id,"money")-2500)
               msg2(id,"©000255000You've Succesfully bought Ak-47!")
          end
     end
     if title == "Teleport" then
          if sel == 1 and player(id,"money") >=1999 then
               parse("setpos "..id.." 400 2608 ")
               parse("setmoney "..id.." "..player(id,"money")-2000)
               msg2(id,"©000255000You Teleported for 2,000$ !!!")
          end
          if sel == 3 and player(id,"money") >=1999 then
               parse("setpos "..id.." 200 200 ")
               parse("setmoney "..id.." "..player(id,"money")-2000)
               msg2(id,"©000255000You Teleported for 2,000$ !!!")
          end
     end

-------------------
-- Spawn --
-------------------
addhook("spawn","lol")
function lol(id)
     parse('hudtxt2 '..id..' 1 "©000255000Text" 240 5')
end
end
*Fixed* @Hoamn don't blame for that i didn't wrote that part of the script
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht