Forum

> > CS2D > Scripts > Multiple Errors
Forums overviewCS2D overview Scripts overviewLog in to reply

English Multiple Errors

21 replies
Page
To the start Previous 1 2 Next To the start

old Multiple Errors

Dovahkin
User Off Offline

Quote
Please help me i got confused in this code im making !!!

You test it and you can see the error's in this code

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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
addhook("use","buyweapon")
function buyweapon(id,event,data,x,y)
	if (x == 1 and y == 9) then
		menu(id,"Power Ups, Slow Weapon-Slows enemy by 3%- 12000$,Nuka - Cola - Speeds you by 2% - 15000$, Stun 

Weapon 16000$")
	if (x == 7 and y == 9) then
		menu(id,"Modes,Autoteambalance ON,Autoteambalance Off,Friendly Fire On,Friendly Fire Off, Startmoney 

16000 -- Restarts game, Startmoney 800 -- Restarts game, Remove Bot, Exit")
	end
end

addhook("menu","menuby")
function menuby(id,title,button)
	if title == "Power Ups" then
		if button == 1 then
		if player(id,"money")>=12000 then
			parse("equip "..id.." 4")
			parse("setmoney "..id.." "..player(id, "money")-12000)
			msg2(id,"©255000255You have successfully bought the Slow Weapon!@C")
			else
			msg2(id,"©255255000You have insufficient funds!@C")
		end

		elseif button == 2 then
		if player(id,"money")>=15000 then
			parse('hudtxt 1 "©000255000Nuka-Cola = Available "55 55')
			parse("speedmod "..id.." 10")
			parse("setmoney "..id.." "..player(id,"money")-15000)
			msg2(id,"©255000255You have sucessfully bought the Nuka-Cola!@C")
			else
			msg2(id,"©255000000You have insufficient funds!@C")
		end
		
		elseif button == 3 then
		if player(id,"money")>=16000 then
			parse("equip "..id.." 75")
			parse("setmoney "..id.." "..player(id,"money")-16000)
			msg2(id,"©255000255You have sucessfully bought the Stun Weapon!@C")
			else
			msg2(id,"©255000000You have insufficient funds!@C")
		end
	end
	if title == "Modes" then
		if button == 1 then
			parse("mp_autoteambalance 1")
			msg("©255000255AUTOTEAMBALANCE ON!")
		end
		
		elseif button == 2 then
			parse("mp_autoteambalance 0")
			msg("©255000255AUTOTEAMBALANCE OFF!")
		end

		elseif button == 3 then
			parse("mp_friendlyfire 1")
			msg("©255000255FriendlyFire On!")
		end

		elseif button == 4 then
			parse("mp_friendlyfire 0")
			msg("©255000255FriendlyFire On!")
		end

		elseif button == 5 then
			parse("mp_startmoney 16000")
			parse("mp_restartround 1")
			msg("©255000255Money 16000 On!")
		end
		
		elseif button == 6 then
			parse("mp_startmoney 800")
			parse("mp_restartround 1")
			msg("©255000255Money 800 On!")
		end
	end
	end
end
end

-----------------------If dead------------------------
addhook("die","left")
function left(id)
	if player(id,"team") == 2 then
		parse('hudtxt 1 "©000255000Nuka-Cola = None "55 55')
	end
end

addhook("spawn","spawner")
function spawner(id)
	if player(id,"team") == 2 then
		parse('hudtxt 1 "©000255000Nuka-Cola = None "55 55')
	end
end

addhook("reload","fastreload")
function fastreload(id,mode)
wp = player(id,"weapontype")
	if mode==1 then
		parse("equip "..id.." "..wp)
		parse("setweapon "..id.." "..wp)
	end
end

addhook("hit","hitx")
function hitx(id,source,weapon,hpdmg,apdmg)
	if (weapon==75) then
          		parse("speedmod "..id.." -50")
          		msg2(id,"©255000000You Got Stunned@C")
          	function speedx ()
          		parse("speedmod "..id.." 0")
     	end
          	timer(3000,"speedx")
	end
end

addhook("spawn","am")
function am(p)
	if game("mp_startmoney")=="16000" then
	parse("setmoney "..p.." 16000")
	end
end

addhook("startround","round")
function round(id)
	if player(id,"team") == 2 then
	parse("setmoney "..id.." "..player(id,"money")+16000)
	end
end

addhook("startround","start")
function startround(id)
	if player(id,"team") == 2 then
	parse('hudtxt 1 "©000255000Nuka-Cola = None "55 55')
	end
end
---------------------Weapon---------------------
parse("wpndmg 4 0")
parse("wpndmg 75 0")
parse("mp_startmoney 16000")
end

old Re: Multiple Errors

MikuAuahDark
User Off Offline

Quote
i just see the script and i see too much errors:
here. uuu
Spoiler >

old Re: Multiple Errors

Obviously Exactly Myself
User Off Offline

Quote
Also this won't work when I buy at weapon shop It works but when in restaurant, I can't

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
addhook('use','zj_use')
function zj_use(id,event,data,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
		end
	end
end
			
function zj_buy(id,title,button)
	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

old Re: Multiple Errors

Dovahkin
User 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
addhook('use','zj_use')
function zj_use(id,event,data,x,y)
     if(x == 42 and y == 21) then
          menu(id,"Restaurant,Food (+10hp)|$10,Meat (Gut Bomb)|$10")
     if (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
     end
end
               
function zj_buy(id,title,button)
     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 it now!

old Fixed

Dovahkin
User Off Offline

Quote
Here it will work im sure!! HAHAHAHAHA

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
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")
	end
	if (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

old Re: Multiple Errors

Dovahkin
User Off Offline

Quote
Put a Trigger button in where the X AND Y is located! Think You need to Think! or a Trigger Use!!

old Re: Multiple Errors

Dovahkin
User Off Offline

Quote
Its all desame! But the other one with
1
if(x == blah and y == blah) then
is more easier to code no need
1
if player(id,"tilex")
but its your choice to make one :))

old Re: Multiple Errors

Obviously Exactly Myself
User Off Offline

Quote
My map have to press E on a decal not on a empty tile w/out entities that's why I can't put trigger button there.

This is the problem of the script I provided:
When I buy at weapon shop it works but when in restaurant, the menu appears but when I clicked an item, it won't.

old Re: Multiple Errors

MikuAuahDark
User Off Offline

Quote
@user Obviously Exactly Myself: here:
Spoiler >
untested!

old Re: Multiple Errors

Obviously Exactly Myself
User Off Offline

Quote
I don't want any menus anymore I guess that error won't really be fixed but I will suggest something else:

Please fix:
1
2
3
4
5
6
7
8
9
10
addhook("walkover","zj_money")
function zj_money(id,type,iid)
	if iid == 66 then
		parse('setmoney '.. id ..' '.. (player(id, 'money') - 95))
	elseif iid == 67 then
		parse('setmoney '.. id ..' '.. (player(id, 'money') - 490))
	elseif iid == 68 then
		parse('setmoney '.. id ..' '.. (player(id, 'money') - 950))
	end
end
It won't work...
edited 1×, last 26.12.11 07:55:29 am

old Re: Multiple Errors

MikuAuahDark
User Off Offline

Quote
ZomplantJelo script >

normally this is works

old Re: Multiple Errors

Dovahkin
User Off Offline

Quote
Here -.- .

1
2
3
4
5
6
7
8
9
10
addhook("walkover","zj_money")
function zj_money(id,iid)
     if iid == 66 then
          parse("setmoney "..id.." "..player(id,"money")-95)
     elseif iid == 67 then
          parse("setmoney "..id.." "..player(id,"money")-490)
     elseif iid == 68 then
          parse("setmoney "..id.." "..player(id,"money")-950)
     end
end

Untested

old ow

MikuAuahDark
User Off Offline

Quote
@user Dovahkin: hey, you take my script!
@user Obviously Exactly Myself: here:
Spoiler >

old Re: Multiple Errors

Jynxxx
User Off Offline

Quote
@user MikuAuahDark: I tested your lua but every time i pick up the gold it says "Exception_Access_Violation" your lua makes the server crash, Fix that please
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview