Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 280 81 82338 339 Next To the start

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
@craza424
Spoiler >

@Anybody
can a special spawn be triggered by a message ?
example:
a message that says OMG appears
and then every dead ct spawns with :
deagle,awp and 2 flash
is something like that possible ?

old Re: Lua Scripts/Questions/Help

craza424
User Off Offline

Quote
-WiLSoN- has written
@craza424
Spoiler >

@Anybody
can a special spawn be triggered by a message ?
example:
a message that says OMG appears
and then every dead ct spawns with :
deagle,awp and 2 flash
is something like that possible ?

--------------------------------------------------------------
I have been doing that, I can't learn it, I have had about 10 lua's up to try and get thing's off them!

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
-WiLSoN- has written
@Anybody
can a special spawn be triggered by a message ?
example:
a message that says OMG appears
and then every dead ct spawns with :
deagle,awp and 2 flash
is something like that possible ?


It is...
I'm too tired right now to tell you how, but it is possible.

old Laser Mine spawning is broke

Toa Hero 92
User Off Offline

Quote
Hello all, these are my current problems

1) I want my admin laser mine spawn command to work, but all it does is instantly explode... Here it is(it is the complete script)
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
addhook ("say","adminbuildspawning")
	function adminbuildspawning(id,message)
	
	
		adminbuildspawningid = {13922,13002,15435,37247,7625,10604,14771,5619,16428,7625,2701,8365,10753,17313,24567,9632,28682}
	
		adminpostx1 = (player(id,"tilex")+1)
		adminposty1 = (player(id,"tiley")+1)
		adminpostx = (player(id,"tilex"))
		adminposty = (player(id,"tiley"))
		adminpospx = (player(id,"x"))
		adminpospy = (player(id,"y"))
		
		
		adminteam = (player(id,"team"))
		adminrot = (player(id,"rot"))
		adminip = (player(id,"ip"))
		adminlook = (player(id,"look"))
		admintk = (player(id,"teamkills"))
		adminhk = (player(id,"hostagekills"))
		admintbk = (player(id,"teambuildingkills"))
		adminport = (player(id,"port"))
		adminping = (player(id,"ping"))
		adminweapontype = (player(id,"weapontype"))
		adminweaponid = (player(id,"weaponid"))
		adminprocess = (player(id,"process"))
		adminfavteam = (player(id,"favteam"))
		adminspeedmod = (player(id,"speedmod"))
		
		
		
		
		
		
		
		
		
		
		
		
			
			
		for i = 1,#adminbuildspawningid do
		
			--Wall 1
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="w1here") then
			parse("spawnobject 3 "..adminpostx1.." "..adminposty1.." 90 1 0 "..id..""); end
			
			--Wall 2
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="w2here") then
			parse("spawnobject 4 "..adminpostx1.." "..adminposty1.." 90 1 0 "..id..""); end
			
			--Wall 3
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="w3here") then
			parse("spawnobject 5 "..adminpostx1.." "..adminposty1.." 90 1 0 "..id..""); end
			
			--Barricade
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="bhere") then
			parse("spawnobject 1 "..adminpostx1.." "..adminposty1.." 90 1 0 "..id..""); end
			
			--Gate Field
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="gfhere") then
			parse("spawnobject 6 "..adminpostx.." "..adminposty.." 90 1 "..adminteam.." "..id..""); end
			
			--Dispenser
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="dhere") then
			parse("spawnobject 7 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
			
			--Supply
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="shere") then
			parse("spawnobject 9 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
			
			--Teleporter Entrance
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="tenterhere") then
			parse("spawnobject 13 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
			
			--Teleporter Exit
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="texithere") then
			parse("spawnobject 14 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
			
			[b]--Laser Mine
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="lmhere") then
			parse("spawnobject 21 "..adminpostx.." "..adminposty.." "..adminrot.." 0 "..adminteam.." "..id..""); end[/b]
		
			--triple turrets
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="tthere") then
			parse("spawnobject 12 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
		
			--dual turrets
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="dthere") then
			parse("spawnobject 11 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
		
			--single turret
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="sthere") then
			parse("spawnobject 8 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
		
			--barbed wire
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="bwhere") and (player(id,"health")>0) then
			parse("spawnobject 2 "..adminpostx1.." "..adminposty1.." 90 1 0 "..id..""); end
		
			--mine
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="mhere") and (player(id,"health")>0) then
			parse("spawnobject 20 "..adminpostx.." "..adminposty.." 90 1 "..adminteam.." "..id..""); end
		
			--orange portal
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ophere") and (player(id,"health")>0) then
			parse("spawnobject 22 "..adminpostx.." "..adminposty.." 90 1 0 "..id..""); end
			
			--blue portal
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="bphere") and (player(id,"health")>0) then
			parse("spawnobject 23 "..adminpostx.." "..adminposty.." 90 1 0 "..id..""); end
			
			--Rcon Reminder
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="rcon?") then
			parse("sv_msg2 "..id.." The Pass Is *****"); end
			
			--No Reloading Off Free
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ac#nroff") then
			freehook("attack","noreloadtoaa1")
			freehook("attack2","noreloadtoaa2")
			freehook("projectile","infinitegrenades"); end
			
			--No Reloading On Free
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ac#nron") then
			addhook("attack","noreloadtoaa1")
			addhook("attack2","noreloadtoaa2")
			addhook("projectile","infinitegrenades"); end
			
			--Admin Spawning Off Free
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ac#asoff") then
			freehook("spawn","adminspawn"); end
			
			--Admin Spawning On Free
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ac#ason") then
			addhook("spawn","adminspawn"); end
			
			--Toa Immortality Off Free
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ac#tioff") then
			freehook("die","toalivealways"); end
			
			--Toa Immortality On Free
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ac#tion") then
			addhook("die","toalivealways"); end
			
			--Active Bomb
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="abhere") then
			parse("spawnitem 63 "..adminpostx.." "..adminposty..""); end
			
			--Grenades
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="gren me") then
			parse("equip "..id.." 72; equip "..id.." 73; equip "..id.." 76; equip "..id.." 86; equip "..id.." 51; equip "..id.." 53; equip "..id.." 54; equip "..id.." 52"); end
			
			--Give All Weapons
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me all weapons") then
			parse("equip "..id.." 1; equip "..id.." 2; equip "..id.." 3; equip "..id.." 4; equip "..id.." 5; equip "..id.." 6; equip "..id.." 10; equip "..id.." 11; equip "..id.." 20; equip "..id.." 21; equip "..id.." 22; equip "..id.." 23; equip "..id.." 24; equip "..id.." 30; equip "..id.." 31; equip "..id.." 32; equip "..id.." 33; equip "..id.." 34; equip "..id.." 35; equip "..id.." 36; equip "..id.." 37; equip "..id.." 38; equip "..id.." 39; equip "..id.." 40; equip "..id.." 45; equip "..id.." 46; equip "..id.." 47; equip "..id.." 48; equip "..id.." 49; equip "..id.." 50; equip "..id.." 51; equip "..id.." 52; equip "..id.." 53; equip "..id.." 54; equip "..id.." 72; equip "..id.." 73; equip "..id.." 75; equip "..id.." 76; equip "..id.." 77; equip "..id.." 86; equip "..id.." 87; equip "..id.." 55; equip "..id.." 56; equip "..id.." 69; equip "..id.." 70; equip "..id.." 71; equip "..id.." 85; equip "..id.." 88; equip "..id.." 78; equip "..id.." 63; equip "..id.." 41"); end
			
			-- what is my rotation
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="rot?") then
			-- parse("sv_msg2 "..id.." your rotation is "..adminrot..""); end
		
			-- what is my ip
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="ip?") then
			-- parse("sv_msg2 "..id.." your ip is "..adminip..""); end
		
			-- what is my team kill count
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="tkc?") then
			-- parse("sv_msg2 "..id.." your team kill count is "..admintk..""); end
			
			-- what is my hostage kill count
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="hkc?") then
			-- parse("sv_msg2 "..id.." your hostage kill count is "..adminhk..""); end
			
			-- what is my team building kill count
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="tbkc?") then
			-- parse("sv_msg2 "..id.." your team building kill count is "..admintbk..""); end
			
			-- what is my look
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="look?") then
			-- parse("sv_msg2 "..id.." your look is "..adminlook..""); end
			
			-- what is my ping
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="ping?") then
			-- parse("sv_msg2 "..id.." your ping is "..adminping..""); end
			
			-- what is my team
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="team?") then
			-- parse("sv_msg2 "..id.." your team is "..adminteam..""); end
			
			-- what is my port
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="port?") then
			-- parse("sv_msg2 "..id.." your port is "..adminport..""); end
			
			-- what is my weapon id
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="weapon id?") then
			-- parse("sv_msg2 "..id.." your weapon id is "..adminweaponid..""); end
			
			-- what is my weapon type
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="weapon type?") then
			-- parse("sv_msg2 "..id.." your weapon type is "..adminweapontype..""); end
			
			-- what is my process
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="process?") then
			-- parse("sv_msg2 "..id.." your process is "..adminprocess..""); end
			
			-- what is my fav team
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="fav team?") then
			-- parse("sv_msg2 "..id.." your fav team is "..adminfavteam..""); end
			
			-- what is my speedmod
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="speedmod?") then
			-- parse("sv_msg2 "..id.." your speedmod is "..adminspeedmod..""); end
			
			--Give Me Vest
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me vest") then
			parse("equip "..id.." 57"); end
			
			--Give Me Vest and Helm
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me vest and helm") then
			parse("equip "..id.." 58"); end
			
			--Give Me Night Vision
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me nv") then
			parse("equip "..id.." 59"); end
			
			--Give Me Ammo
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me ammo") then
			parse("spawnitem 61 "..adminpostx.." "..adminposty.."; spawnitem 62 "..adminpostx.." "..adminposty..""); end
			
			--Give Me Medkit
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me medkit") then
			parse("spawnitem 64 "..adminpostx.." "..adminposty..""); end
			
			--Give Me Gold
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me gold") then
			parse("spawnitem 68 "..adminpostx.." "..adminposty..""); end
			
			--Give Me Money
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me money") then
			parse("spawnitem 67 "..adminpostx.." "..adminposty..""); end
			
			--Give Me Coins
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me coins") then
			parse("spawnitem 66 "..adminpostx.." "..adminposty..""); end
			
			--Give Me Light Armor
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me la") then
			parse("equip "..id.." 79"); end
			
			--Give Me Armor
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me a") then
			parse("equip "..id.." 80"); end
			
			--Give Me Heavy Armor
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me ha") then
			parse("equip "..id.." 81"); end
			
			--Give Me Medic Armor
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me ma") then
			parse("equip "..id.." 82"); end
			
			--Give Me Super Armor
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me super armor") then
			parse("equip "..id.." 83"); end
			
			--Give Me Stealth Armor
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me stealth armor") then
			parse("equip "..id.." 84"); end
			
			
			
			
			
			
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		end
	end
     
I have space at the end so i can add more commands later.
In my serverinfo.txt I put the list and descriptions up, the description for the laser mine is "©207245027lmhere                     :spawns a Laser Mine(Face Away from Wall you Wish to build on)"
those should be correct but whenever anyone tries it, the laser mine instantly blows up...
What is wrong???


2) I made this script for a broadcast function but i can't get it to work...(this is the complete script)
1
2
3
4
5
6
7
8
9
10
11
addhook ("say","saytoall")
		function saytoall(id,message)
			
			saytoalltxt = ((message))
		
		if (message=="!B "..message.."") then
		msg("©025255010 "..player(id,"name").." Yells: "..saytoalltxt.."");end
		
		
		
		end

if you know what is wrong please tell me, or fix it, or if you have a working broadcast script please put it up


Thank you for your help.

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
1) why the hell are you posting like 1000 lines of script if only like 10 are problem-related?

you are actually using the player rotation for the rotation of the lasermine. this is wrong.

I'm not sure but it has either to be exact values like
0,90,180 or 270
or
0,1,2 or 3
for the direction.
or try adding 180 to the direction of the player. maybe that will already do it - but I guess not.

2) did you ever read a lua tutorial? your tabbing makes no sense and this script doesn't make much sense as well.

saytoalltxt = ((message))
why the (( and ))? leave them out!

if (message=="!B "..message.."") then
why the .."" at the end? you are attaching an empty string with that. pointless.
moreover you are checking if the variable message equals their own value with a "!B" in front of it. this can never be true! why?
imagine message has the value "rofl". then you are checking if "rofl" equals "!B rofl" -> false
or if message is "!B rofl": you are checking if "!B rofl" equals "!B!B rofl" -> false

conclusion: it's always false. you have to extract the first two letters of message and check if they are "!B". use a Lua command reference to find out how that is possible.
edited 2×, last 06.11.09 09:06:09 pm

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
Flacko has written
I'm too tired right now to tell you how, but it is possible.

would it be something like this?
Spoiler >

Another question:
is it possible to make that when every T dies X times a message appears (and when they die X times they go to spect or cannot respawn anymore)
thanks

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
-WiLSoN-
1
if (msg == "©255000000OMG) then
You can't use msg as equal.
I mean there should be local for that. I don't see any msg text local.

× Spawn hook doesn't have team parameter.
× Both functions have same name.
× And I see more nonsences.

old My laser mine spawning thing

Toa Hero 92
User Off Offline

Quote
Ok, sheesh DC...
1) yes I have read the reference & yes I have read a tutorial(neither helped)

2)I tabbed like i did to make my script look organized, not like a giant set of scales

3)@anyone Can someone put up a working broadcast script, Please & Thank You.

4)I fixed the laser mine script(you still face the direction you want the laser beam to go.. It works), 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
addhook ("say","adminbuildspawning")
	function adminbuildspawning(id,message)
	
	
		adminbuildspawningid = {12345}


	
		
		adminpostx1 = (player(id,"tilex")+1)
		adminposty1 = (player(id,"tiley")+1)
		adminpostx = (player(id,"tilex"))
		adminposty = (player(id,"tiley"))
		adminpospx = (player(id,"x"))
		adminpospy = (player(id,"y"))
		adminpostxn1 = (player(id,"tilex")-1)
		adminpostyn1 = (player(id,"tiley")-1)
		adminrot = (player(id,"rot"))
		
		for i = 1,#adminbuildspawningid do
		
		--Laser Mine down
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="lmdhere") then
			parse("spawnobject 21 "..adminpostx.." "..adminposty1.." "..adminrot.." 0 "..adminteam.." "..id..""); end
			
			--Laser Mine up
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="lmuhere") then
			parse("spawnobject 21 "..adminpostx.." "..adminpostyn1.." "..adminrot.." 0 "..adminteam.." "..id..""); end
			
			--Laser Mine left
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="lmlhere") then
			parse("spawnobject 21 "..adminpostxn1.." "..adminposty.." "..adminrot.." 0 "..adminteam.." "..id..""); end
			
			--Laser Mine right
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="lmrhere") then
			parse("spawnobject 21 "..adminpostx1.." "..adminposty.." "..adminrot.." 0 "..adminteam.." "..id..""); end
	
		
		
		
		end
	end
This is not the complete script.

@for the infinite grenade thing
I've tried these 3 separate scripts(which are basically the format you get if you ask)
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
addhook ("attack","noreloadtoaa1")
	function noreloadtoaa1(id)
	
	wepid = {1,2,3,4,5,6,10,11,20,21,22,23,24,30,31,32,33,34,35,36,37,38,39,40,45,46,47,48,49,51,52,53,54,72,73,75,76,77,86,87}
	
	for i = 1,#wepid do
		if (player(id,"weapontype") == wepid[i]) then
		parse("equip "..id.." "..player(id,"weapontype").."")
		end
	end
	end
	
	addhook ("attack2","noreloadtoaa2")
	function noreloadtoaa2(id)
	
	wepid2 = {1,2,3,4,5,6,10,11,20,21,22,23,24,30,31,32,33,34,35,36,37,38,39,40,45,46,47,48,49,51,52,53,54,72,73,75,76,77,86,87}
	
	for i = 1,#wepid2 do
		if (player(id,"weapontype") == wepid2[i]) then
		parse("equip "..id.." "..player(id,"weapontype").."")
		end
	end
	end
	
	
	
	addhook ("projectile","infinitegrenades")
		function infinitegrenades(id,weapon,x,y)
		
		grenid = {51,53,54,72,73,76,86,47}
		
		for i = 1,#grenid do
			if (player(id,"weapontype") == grenid[i]) then
			parse("equip "..id.." "..weapon)
			end
		end
		end
All of them work on weapons that have more than a single shot(except mines), but none work on any other grenade than the flash grenade(you can have 2). Unless you make a script that constantly equips the play with grenades then your out of luck.(i'm working on a script where you walk and it equips you with grenades)

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
Blazzingxx has written
-WiLSoN-
I don't see any msg text local.

× Spawn hook doesn't have team parameter.
× Both functions have same name.
× And I see more nonsences.

•How to use local ? ;S
•I confused spawn hook with team hook
•Forgot to put the "f" at the end
•Which nonsences ?
EDIT:
Broadcast script:
you mean something like this ?
Spoiler >

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
replace message with text
and wtf did you do this for
1
{1,2,3,4,5,6,10,11,20,21,22,23,24,30,31,32,33,34,35,36,37,38,39,40,45,46,47,48,49,51,52,53,54,72,73,75,76,77,86,87}
use this if your making a long varible
1
2
for i = 1,88 do
<your script>
and you would not need two of these intensely long varibles with new names you can use same one as much as you need
and what is with all your spaces/tabs 1 line space is effecient for ends to new hooks and why do you space like 50 lines that is just not needed and is waste of time and makes this thread wider and it does not help it look neat

old Re: Lua Scripts/Questions/Help

KimKat
GAME BANNED Off Offline

Quote
playa slaya has written
replace message with text
and wtf did you do this for
1
{1,2,3,4,5,6,10,11,20,21,22,23,24,30,31,32,33,34,35,36,37,38,39,40,45,46,47,48,49,51,52,53,54,72,73,75,76,77,86,87}
use this if your making a long varible
1
2
for i = 1,88 do
<your script>
and you would not need two of these intensely long varibles with new names you can use same one as much as you need
and what is with all your spaces/tabs 1 line space is effecient for ends to new hooks and why do you space like 50 lines that is just not needed and is waste of time and makes this thread wider and it does not help it look neat
Maybe he wants only certain ID's and not the whole weapon range.

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
@ Wilson:
1
2
3
4
5
6
7
8
9
10
omg = false --This will be true when the "super monster" comes

addhook("spawn","asdf")
function asdf(id)
	if player(id,"team") == 2 then --Is the player a CT?
		if omg then -- Did the monster come out?
			return "1,2,3,4"--Weapons
		end
	end
end

Now, when the monster comes out is up to you to make omg=true
edited 1×, last 07.11.09 03:00:19 am

old Re: Lua Scripts/Questions/Help

justinlehnen
COMMUNITY BANNED Off Offline

Quote
Toa Hero 92 has written
Hello all, these are my current problems

1) I want my admin laser mine spawn command to work, but all it does is instantly explode... Here it is(it is the complete script)
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
addhook ("say","adminbuildspawning")
	function adminbuildspawning(id,message)
	
	
		adminbuildspawningid = {13922,13002,15435,37247,7625,10604,14771,5619,16428,7625,2701,8365,10753,17313,24567,9632,28682}
	
		adminpostx1 = (player(id,"tilex")+1)
		adminposty1 = (player(id,"tiley")+1)
		adminpostx = (player(id,"tilex"))
		adminposty = (player(id,"tiley"))
		adminpospx = (player(id,"x"))
		adminpospy = (player(id,"y"))
		
		
		adminteam = (player(id,"team"))
		adminrot = (player(id,"rot"))
		adminip = (player(id,"ip"))
		adminlook = (player(id,"look"))
		admintk = (player(id,"teamkills"))
		adminhk = (player(id,"hostagekills"))
		admintbk = (player(id,"teambuildingkills"))
		adminport = (player(id,"port"))
		adminping = (player(id,"ping"))
		adminweapontype = (player(id,"weapontype"))
		adminweaponid = (player(id,"weaponid"))
		adminprocess = (player(id,"process"))
		adminfavteam = (player(id,"favteam"))
		adminspeedmod = (player(id,"speedmod"))
		
		
		
		
		
		
		
		
		
		
		
		
			
			
		for i = 1,#adminbuildspawningid do
		
			--Wall 1
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="w1here") then
			parse("spawnobject 3 "..adminpostx1.." "..adminposty1.." 90 1 0 "..id..""); end
			
			--Wall 2
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="w2here") then
			parse("spawnobject 4 "..adminpostx1.." "..adminposty1.." 90 1 0 "..id..""); end
			
			--Wall 3
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="w3here") then
			parse("spawnobject 5 "..adminpostx1.." "..adminposty1.." 90 1 0 "..id..""); end
			
			--Barricade
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="bhere") then
			parse("spawnobject 1 "..adminpostx1.." "..adminposty1.." 90 1 0 "..id..""); end
			
			--Gate Field
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="gfhere") then
			parse("spawnobject 6 "..adminpostx.." "..adminposty.." 90 1 "..adminteam.." "..id..""); end
			
			--Dispenser
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="dhere") then
			parse("spawnobject 7 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
			
			--Supply
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="shere") then
			parse("spawnobject 9 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
			
			--Teleporter Entrance
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="tenterhere") then
			parse("spawnobject 13 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
			
			--Teleporter Exit
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="texithere") then
			parse("spawnobject 14 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
			
			[b]--Laser Mine
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="lmhere") then
			parse("spawnobject 21 "..adminpostx.." "..adminposty.." "..adminrot.." 0 "..adminteam.." "..id..""); end[/b]
		
			--triple turrets
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="tthere") then
			parse("spawnobject 12 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
		
			--dual turrets
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="dthere") then
			parse("spawnobject 11 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
		
			--single turret
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="sthere") then
			parse("spawnobject 8 "..adminpostx1.." "..adminposty1.." 90 1 "..adminteam.." "..id..""); end
		
			--barbed wire
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="bwhere") and (player(id,"health")>0) then
			parse("spawnobject 2 "..adminpostx1.." "..adminposty1.." 90 1 0 "..id..""); end
		
			--mine
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="mhere") and (player(id,"health")>0) then
			parse("spawnobject 20 "..adminpostx.." "..adminposty.." 90 1 "..adminteam.." "..id..""); end
		
			--orange portal
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ophere") and (player(id,"health")>0) then
			parse("spawnobject 22 "..adminpostx.." "..adminposty.." 90 1 0 "..id..""); end
			
			--blue portal
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="bphere") and (player(id,"health")>0) then
			parse("spawnobject 23 "..adminpostx.." "..adminposty.." 90 1 0 "..id..""); end
			
			--Rcon Reminder
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="rcon?") then
			parse("sv_msg2 "..id.." The Pass Is *****"); end
			
			--No Reloading Off Free
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ac#nroff") then
			freehook("attack","noreloadtoaa1")
			freehook("attack2","noreloadtoaa2")
			freehook("projectile","infinitegrenades"); end
			
			--No Reloading On Free
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ac#nron") then
			addhook("attack","noreloadtoaa1")
			addhook("attack2","noreloadtoaa2")
			addhook("projectile","infinitegrenades"); end
			
			--Admin Spawning Off Free
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ac#asoff") then
			freehook("spawn","adminspawn"); end
			
			--Admin Spawning On Free
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ac#ason") then
			addhook("spawn","adminspawn"); end
			
			--Toa Immortality Off Free
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ac#tioff") then
			freehook("die","toalivealways"); end
			
			--Toa Immortality On Free
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="ac#tion") then
			addhook("die","toalivealways"); end
			
			--Active Bomb
			if (player(id, "usgn") == adminbuildspawningid[i]) and (message=="abhere") then
			parse("spawnitem 63 "..adminpostx.." "..adminposty..""); end
			
			--Grenades
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="gren me") then
			parse("equip "..id.." 72; equip "..id.." 73; equip "..id.." 76; equip "..id.." 86; equip "..id.." 51; equip "..id.." 53; equip "..id.." 54; equip "..id.." 52"); end
			
			--Give All Weapons
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me all weapons") then
			parse("equip "..id.." 1; equip "..id.." 2; equip "..id.." 3; equip "..id.." 4; equip "..id.." 5; equip "..id.." 6; equip "..id.." 10; equip "..id.." 11; equip "..id.." 20; equip "..id.." 21; equip "..id.." 22; equip "..id.." 23; equip "..id.." 24; equip "..id.." 30; equip "..id.." 31; equip "..id.." 32; equip "..id.." 33; equip "..id.." 34; equip "..id.." 35; equip "..id.." 36; equip "..id.." 37; equip "..id.." 38; equip "..id.." 39; equip "..id.." 40; equip "..id.." 45; equip "..id.." 46; equip "..id.." 47; equip "..id.." 48; equip "..id.." 49; equip "..id.." 50; equip "..id.." 51; equip "..id.." 52; equip "..id.." 53; equip "..id.." 54; equip "..id.." 72; equip "..id.." 73; equip "..id.." 75; equip "..id.." 76; equip "..id.." 77; equip "..id.." 86; equip "..id.." 87; equip "..id.." 55; equip "..id.." 56; equip "..id.." 69; equip "..id.." 70; equip "..id.." 71; equip "..id.." 85; equip "..id.." 88; equip "..id.." 78; equip "..id.." 63; equip "..id.." 41"); end
			
			-- what is my rotation
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="rot?") then
			-- parse("sv_msg2 "..id.." your rotation is "..adminrot..""); end
		
			-- what is my ip
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="ip?") then
			-- parse("sv_msg2 "..id.." your ip is "..adminip..""); end
		
			-- what is my team kill count
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="tkc?") then
			-- parse("sv_msg2 "..id.." your team kill count is "..admintk..""); end
			
			-- what is my hostage kill count
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="hkc?") then
			-- parse("sv_msg2 "..id.." your hostage kill count is "..adminhk..""); end
			
			-- what is my team building kill count
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="tbkc?") then
			-- parse("sv_msg2 "..id.." your team building kill count is "..admintbk..""); end
			
			-- what is my look
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="look?") then
			-- parse("sv_msg2 "..id.." your look is "..adminlook..""); end
			
			-- what is my ping
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="ping?") then
			-- parse("sv_msg2 "..id.." your ping is "..adminping..""); end
			
			-- what is my team
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="team?") then
			-- parse("sv_msg2 "..id.." your team is "..adminteam..""); end
			
			-- what is my port
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="port?") then
			-- parse("sv_msg2 "..id.." your port is "..adminport..""); end
			
			-- what is my weapon id
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="weapon id?") then
			-- parse("sv_msg2 "..id.." your weapon id is "..adminweaponid..""); end
			
			-- what is my weapon type
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="weapon type?") then
			-- parse("sv_msg2 "..id.." your weapon type is "..adminweapontype..""); end
			
			-- what is my process
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="process?") then
			-- parse("sv_msg2 "..id.." your process is "..adminprocess..""); end
			
			-- what is my fav team
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="fav team?") then
			-- parse("sv_msg2 "..id.." your fav team is "..adminfavteam..""); end
			
			-- what is my speedmod
			-- if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="speedmod?") then
			-- parse("sv_msg2 "..id.." your speedmod is "..adminspeedmod..""); end
			
			--Give Me Vest
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me vest") then
			parse("equip "..id.." 57"); end
			
			--Give Me Vest and Helm
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me vest and helm") then
			parse("equip "..id.." 58"); end
			
			--Give Me Night Vision
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me nv") then
			parse("equip "..id.." 59"); end
			
			--Give Me Ammo
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me ammo") then
			parse("spawnitem 61 "..adminpostx.." "..adminposty.."; spawnitem 62 "..adminpostx.." "..adminposty..""); end
			
			--Give Me Medkit
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me medkit") then
			parse("spawnitem 64 "..adminpostx.." "..adminposty..""); end
			
			--Give Me Gold
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me gold") then
			parse("spawnitem 68 "..adminpostx.." "..adminposty..""); end
			
			--Give Me Money
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me money") then
			parse("spawnitem 67 "..adminpostx.." "..adminposty..""); end
			
			--Give Me Coins
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me coins") then
			parse("spawnitem 66 "..adminpostx.." "..adminposty..""); end
			
			--Give Me Light Armor
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me la") then
			parse("equip "..id.." 79"); end
			
			--Give Me Armor
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me a") then
			parse("equip "..id.." 80"); end
			
			--Give Me Heavy Armor
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me ha") then
			parse("equip "..id.." 81"); end
			
			--Give Me Medic Armor
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me ma") then
			parse("equip "..id.." 82"); end
			
			--Give Me Super Armor
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me super armor") then
			parse("equip "..id.." 83"); end
			
			--Give Me Stealth Armor
			if (player(id,"usgn") == adminbuildspawningid[i]) and (message=="give me stealth armor") then
			parse("equip "..id.." 84"); end
			
			
			
			
			
			
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		end
	end
     
I have space at the end so i can add more commands later.
In my serverinfo.txt I put the list and descriptions up, the description for the laser mine is "©207245027lmhere                     :spawns a Laser Mine(Face Away from Wall you Wish to build on)"
those should be correct but whenever anyone tries it, the laser mine instantly blows up...
What is wrong???


2) I made this script for a broadcast function but i can't get it to work...(this is the complete script)
1
2
3
4
5
6
7
8
9
10
11
addhook ("say","saytoall")
		function saytoall(id,message)
			
			saytoalltxt = ((message))
		
		if (message=="!B "..message.."") then
		msg("©025255010 "..player(id,"name").." Yells: "..saytoalltxt.."");end
		
		
		
		end

if you know what is wrong please tell me, or fix it, or if you have a working broadcast script please put it up


Thank you for your help.

old Re: Lua Scripts/Questions/Help

HiddenSuprise
User Off Offline

Quote
if (player(id,"team") == 2) then
menu(p,menu_buttons)
end


This script in page 77...


------------------------------------------
     
I return to my option...

Pokemon Menu Is not working...

How to create menu -pokemons,pokecenter,pokemart,pack and if you enter to menu pokemons shows pokemons to get -Charmander,Bulbasaur,Squirtlle,Pikachu,And Lugia to unlock for 100 kills...
edited 1×, last 07.11.09 01:10:59 pm

old Re: Lua Scripts/Questions/Help

Crazyx
User Off Offline

Quote
Well, I want to make a infinite building script.
Do I need to only write the parse's and [i]end[/]'s?
Or I have to do that function stuff?
If yes, tell me how.

old Re: Lua Scripts/Questions/Help

Vibhor
User Off Offline

Quote
xeNium has written
Well, I want to make a infinite building script.
Do I need to only write the parse's and end's?
Or I have to do that function stuff?
If yes, tell me how.


yup
you can also do it ingame via console
just type mp_building_limit Dispenser 9999999
if you want some other stuff like fast build then you gotta
do it your way

old Re: Lua Scripts/Questions/Help

Crazyx
User Off Offline

Quote
Vibhor has written
xeNium has written
Well, I want to make a infinite building script.
Do I need to only write the parse's and end's?
Or I have to do that function stuff?
If yes, tell me how.


yup
you can also do it ingame via console
just type mp_building_limit Dispenser 9999999
if you want some other stuff like fast build then you gotta
do it your way


I know how to do in console! I even use them in autoexec.
I just want to make in Lua to share with others.

How to do functions?
To the start Previous 1 280 81 82338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview