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 2153 154 155338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
Could anyone help me with a Knife-kill hudtxt?

Got this code until now:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("join","akd_hud_join_kk")
function akd_hud_join_kk(id)
	KK = 0
	parse([[hudtxt2 ]]..id..[[ 5 "©000255000Knife-kills: ]]..KK..[[ " 5 170]])
end

addhook("kill","akd_hud_kill")
function akd_hud_kill(killer,weapon)

	-- Knife-Kills
	if (weapon==50) then
		KK = KK + 1
		parse([[hudtxt2 ]]..killer..[[ 5 "©000255000Knife-kills: ]]..KK..[[ " 5 170]])
	end

end

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Anders:
1- That FOW won't work for a single player.
2- You need to use global tables for knife kills.
Even moar basic (:

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
Alright, this isn't working AGAIN... I'm getting annoyed on how it jumps out. and in.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("team","Teams")
function Teams(p,team)
     for i, Usgns in ipairs(ADMIN.S) do
		if (team == 1) then
		  print(team)
		  print(value)
		if (player(p,"usgn") == Usgns) then
			return 0
               else
			return 1
               end
          end
	end
end
Arlight, here are the problems, It's not looping through the table, no idea why, I also get nil values, but I have no idea what'snil? I just freakin am tiredof this thing failing then working.. Help please?

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
Homer has written
1
2
3
4
5
6
7
8
9
10
11
12
13
14
addhook("team","Teams")
function Teams(p,team)
	for i, Usgns in ipairs(ADMIN.S) do
		if (team == 1) then
			print(team)
			print(value)
			if (player(p,"usgn") == Usgns) then
				return 0
			else
				return 1
			end
		end
	end
end


Okay.. Now we got the layout done..
...But i really dont know anything about the "Usgns in ipairs(ADMIN.S)"... Sorry

------------------------------------------------------------------------------------------------------------

Flacko has written
Anders:
1- That FOW won't work for a single player.
2- You need to use global tables for knife kills.
Even moar basic (:


1. You are totally right (; I forgot, sorry.
2. and that is..? s: - But isn't there made something for knife-kills before? So i can just copy it >.>

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
Flacko has written
@Anders:
No, copy&pasting like a fag from this thread isn't cool.

@Homer:
zomg, same mistake you did before


But it's for own use? haha
And if someone can't teach me how to make it..

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
You must make a table using the almighty initArray function from leegao, it appears in most of the samples included in CS2D.

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
Flacko has written
You must make a table using the almighty initArray function from leegao, it appears in most of the samples included in CS2D.


Hm.. This was what i found:
1
2
3
4
5
6
7
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

But i don't know what it does! haha

old Re: Lua Scripts/Questions/Help

ZianSing
User Off Offline

Quote
I need help with a script.
I want it where only admins with a certain USGN can only be T, while the rest are CT.

I tried this:

1
2
addhook("team","admt")
function admt(id,team)

but I don't know what to do next!

old Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Quote
AxeL has written
I need help with a script.
I want it where only admins with a certain USGN can only be T, while the rest are CT.

I tried this:

1
2
addhook("team","admt")
function admt(id,team)

but I don't know what to do next!


Hm.. That could actually be a nice script (:
I'm gonna keep looking for the "usgn-thing" ...I have seen it before (:

I think that this will be the basics of the script:
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("team","admt")
function admt(id,team)
	admins = {123, 321}		-- This is the usgn id's that will be admins.
	if player(id)				-- How do i make a "if terrorist was selected"?
		if player(id, "usgn")==admins[1] or player(id, "usgn")==admins[2] then
			return 0
		else
			return 1
		end
	else
		return 0
	end
end

How can we make a "if terrorist is selected then"?
edited 2×, last 30.01.10 10:47:36 am

old Re: Lua Scripts/Questions/Help

Crazyx
User Off Offline

Quote
Can someone give me a script that, when a play joins the server, it says this:

"player joins from country"

I've seen this in lots of servers.

______________

And a friend of my has problems with the XVote in his server and he wants help too:

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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
--[[
Extended vote system
version 1.0
Author: Kiffer-Opa

Licence:
You can use this script for your server.
You can edit and use the code if you want, if you mention all other authors.
]]

if xvote==nil then xvote={} end

-- load configuration file
dofile("sys/lua/xvoteconfig.lua")

parse("mp_mapvoteratio 1.00")
parse("mp_kickpercent 1.00")


-- turn off automatic stuff (autoteambalance etc.) and some restrictions
parse('exec "sys/norestrictions.cfg"')



xvote.votecolor = "©000255150"


function xvote.initArray(size,value)
	local array = {}
	for i=1,size do
		array[i]=value
	end
	return array
end

function xvote.getHumans()
	local humans=0

	for i=1,#player(0,"table") do
		p=player(0,"table")[i]
		if(player(p,"bot")==false) then
			humans=humans+1
		end
	end

	return humans
end

function xvote.getPlayers()
	local players=0

	for i=1,#player(0,"table") do
		players=players+1
	end

	return players
end

function xvote.getMaxPlayerID()
	local max = 0
	for i=1,#player(0,"table") do
		max = math.max(max,player(0,"table")[i])
	end
	return max
end

function xvote.getVotes(votetable,value)
	local votes=0
	for i=1,#votetable do
		if(votetable[i]==value) then
			votes=votes+1
		end
	end
	return votes
end

function xvote.humans()
	local table = {}

	for i=1,32 do
		if(player(i,"exists")) then
			if(player(i,"bot")==false) then
				table[#table+1]=i
			end
		end
	end
	return table
end

function xvote.players()
	local table = {}

	for i=1,32 do
		if(player(i,"exists")) then
			table[#table+1]=i
		end
	end
	return table
end

function xvote.getMajority(votetable)
	local possiblevotes = xvote.getVoteOptions(votetable)
	local votecount = xvote.initArray(#possiblevotes,0)
	local majority = nil
	local max = 0
	local humans = xvote.humans()
	local id

	for v=1,#humans do
		id=humans[v]
		for p=1,#possiblevotes do
			if(votetable[id]==possiblevotes[p]) then
				votecount[p] = votecount[p]+1
			end
		end
	end

	for c=1,#votecount do
		if(votecount[c]>max) then
			majority = possiblevotes[c]
			max      = votecount[c]
		elseif(votecount[c]==max) then
			majority = nil
		end
	end

	return majority
end

function xvote.getVoteOptions(votetable)
	local options = {}
	local counted = false
	for i=1,32 do
		counted = false
		for j=1,#options do
			if(votetable[i]==options[j]) then
				counted=true
			end
		end
		if(counted==false) then
			options[#options+1]=votetable[i]
		end
	end

	return options
end

function xvote.getIDFromName(name)
	for p=1,32 do
		if(name==player(p,"name")) then
			return p
		end
	end
	return nil
end

function xvote.serveraction(playerID,action)
	if(action == xvote.serveractionkey) then
		xvote.refreshmenus()
		menu(playerID, xvote.menu.game)
	end
end
addhook("serveraction","xvote.serveraction",-10)

function xvote.say(playerID,text)
	if(string.lower(text)=="!xvote") then
		menu(playerID, xvote.menu.game)
		return 1
	end
	return 0
end
addhook("say","xvote.say")
addhook("sayteam","xvote.say")



function xvote.votemenu(playerID,votemode,param)
	local victim, map
	if(votemode==1) then		-- votekick
		if(param~="") then
			victim = xvote.getIDFromName(param)
			if(victim~=nil) then
				--msg(xvote.votecolor..player(playerID,"name").." votes to kick "..player(victim,"name")..".")

				xvote.vote.kick[victim][playerID] = true

				if(xvote.getMajority(xvote.vote.kick[victim])==true) then
					parse("kick "..victim)
				end
			else
				msg2(playerID,"©255000000This player is not on the server.@C")
			end
		else

			for i=1,32 do
				xvote.vote.kick[i][playerID] = false
			end
			msg(xvote.votecolor..player(playerID,"name").." withdrew the kick votes.")
		end

	elseif(votemode==2) then	-- votemap
		xvote.vote.map[playerID] = param
		if(param=="") then
			msg(xvote.votecolor..player(playerID,"name").." votes against mapchange.")
		--[[
		else
			msg(xvote.votecolor..player(playerID,"name").." votes for map "..param)
		]]
		end
		map=xvote.getMajority(xvote.vote.map)
		if(map~="") then
			parse("sv_map "..map)
		end
	end
end
addhook("vote","xvote.votemenu")

function xvote.getVoteRatio(votetable,value)
	local votes = xvote.getVotes(votetable,value)
	local humans =xvote.getHumans()

	return ( votes/humans ) * 100
end

function xvote.voteString(votetable,vote,title)
	return title.."|"..string.format('%.1f',xvote.getVoteRatio(votetable,vote)).."%"
end

function xvote.mapcycle(filter)
	local maptable = {}

	file = io.open(xvote.votemaps,"r")

	if(filter==nil) then filter="" end


	for line in io.lines("sys/mapcycle.cfg","r") do
		local match = string.match(line,"^"..filter.."[^/][%w%d%p]+")
		if(match ~= nil) then
			table.insert(maptable,match)
		end
	end

	file:close()

	return maptable
end


function xvote.openVotemapMenu(playerID,page,filter,openmenu)
	if(filter==nil) then filter="" end
	if(filter=="") then space="" else space=" " end
	if(openmenu==nil) then openmenu=true end

	local str = "Vote for "..filter..space.."map (page "..page..")"
	local start = 1 + (page-1)*7
	local c = 1
	local maps = xvote.mapcycle(filter)

	for i=start,math.min(#maps,start+6) do
		str = str..","..xvote.voteString(xvote.vote.map, maps[i], maps[i])
		c = c+1
	end

	for i=c, 7 do
		str = str..","
	end

	if(page~=1) then
		str = str..",« previous page"
	else
		str = str..","
	end
	if(#maps~=math.min(#maps,start+6)) then
		str = str..",next page »"
	end

	if(openmenu==true) then
		menu(playerID,str)
	end

	return str
end

-- vote tables

xvote.vote = {}

xvote.vote.makespec = {}
xvote.vote.kick = {}
for i=1,32 do
	xvote.vote.makespec[i] = {}     -- create a new row
	xvote.vote.kick[i] = {}
	for j=1,32 do
        	xvote.vote.makespec[i][j] =	false
		xvote.vote.kick[i][j] =		false
	end
end

-- xvote.vote.fow = 	xvote.initArray(32,false)	-- toggle Fog of War
-- xvote.vote.ff = 	xvote.initArray(32,false)	-- toggle Friendly Fire
xvote.vote.infammo = 	xvote.initArray(32,false)	-- toggle infinite ammo
xvote.vote.map = 	xvote.initArray(32,false)	-- change map
-- xvote.vote.gamemode =	xvote.initArray(32,false)	-- set game mode
-- xvote.vote.specmode =	xvote.initArray(32,false)	-- set spectator mode

-- xvote.vote.roundtime = 	xvote.initArray(32,false)	-- set round time
xvote.vote.freezetime = xvote.initArray(32,false)	-- set freezetime
-- xvote.vote.buytime = 	xvote.initArray(32,false)	-- set buytime
-- xvote.vote.startmoney = xvote.initArray(32,false)	-- set start money
-- xvote.vote.curtailedexplosions = xvote.initArray(32,false)-- set curtailed explosions
xvote.vote.restart = xvote.initArray(32,false)		-- restart round

xvote.menu = {}
xvote.menu.main = "XVote menu,Player,Game Options"


xvote.menu.map = "Select map type"





function xvote.refreshmenus()
	xvote.menu.fow = "Vote for Fog of War,"..xvote.voteString(xvote.vote.fow,true,"on")..","..xvote.voteString(xvote.vote.fow,false,"off")..",(don't change)"
	xvote.menu.ff = "Vote for Friendly Fire,"..xvote.voteString(xvote.vote.ff,true,"on")..","..xvote.voteString(xvote.vote.ff,false,"off")..",(don't change)"
	xvote.menu.infammo = "Vote for infinite ammo"..xvote.voteString(xvote.vote.infammo,true,"on")..","..xvote.voteString(xvote.vote.infammo,false,"off")..",(don't change)"
	xvote.menu.curtailedexplosions = "Vote for curtailed explosions,"..xvote.voteString(xvote.vote.curtailedexplosions,true,"on")..","..xvote.voteString(xvote.vote.curtailedexplosions,false,"off")..",(don't change)"
	xvote.menu.gamemode = "Vote for game mode,"..xvote.voteString(xvote.vote.gamemode,0,"Standard")..","..xvote.voteString(xvote.vote.gamemode,1,"Deathmatch")..","..xvote.voteString(xvote.vote.gamemode,2,"Team Deathmatch")..","..xvote.voteString(xvote.vote.gamemode,3,"Construction")..","..xvote.voteString(xvote.vote.gamemode,4,"Zombies!")..",(current mode)"
	xvote.menu.specmode = "Vote to allow to spectate ...,"..xvote.voteString(xvote.vote.specmode,1,"everything")..","..xvote.voteString(xvote.vote.specmode,2,"own team only")..","..xvote.voteString(xvote.vote.specmode,0,"nothing")..",(current setting)"
	xvote.menu.game = "Vote game options,map,kick player,game mode,spectator mode,"..xvote.voteString(xvote.vote.fow,true,"Fog of War")..","..xvote.voteString(xvote.vote.ff,true,"Friendly Fire")..","..xvote.voteString(xvote.vote.infammo,true,"infinite ammo")..","..xvote.voteString(xvote.vote.restart,true,"restart round")..",withdraw my votes"
	xvote.menu.construction = "Vote Construction options,unlimited buildings,instant build"

	if(#xvote.mapcycle("") > 7) then
		temp = {"","","","","","","","",""}

		if(xvote.mapcycle("")~=nil) then
			temp[1]="any map"
		end
		if(xvote.mapcycle("as_")~=nil) then
			temp[2]="Assassination|as_"
		end
		if(xvote.mapcycle("cs_")~=nil) then
			temp[3]="Hostage Rescue|cs_"
		end
		if(xvote.mapcycle("de_")~=nil) then
			temp[4]="Bomb Defuse|de_"
		end
		if(xvote.mapcycle("dm_")~=nil) then
			temp[5]="Deathmatch|dm_"
		end
		if(xvote.mapcycle("ctf_")~=nil) then
			temp[6]="Capture the Flag|ctf_"
		end
		if(xvote.mapcycle("dom_")~=nil) then
			temp[7]="Domination|dom_"
		end
		if(xvote.mapcycle("zm_")~=nil) then
			temp[8]="Zombie map|zm_"
		end
		if(xvote.mapcycle("gg_")~=nil) then
			temp[9]="GunGame|gg_"
		end

		for i=1,9 do
			xvote.menu.map = xvote.menu.map..","..temp[i]
		end
	else
		xvote.menu.map = xvote.openVotemapMenu(0,1,"",false)
	end
end
xvote.refreshmenus()

function xvote.clearvotes(votetable)
	votetable = {}
end

function xvote.clearPlayerVotes(playerID)
	xvote.vote.fow[playerID] = false
	xvote.vote.ff[playerID] = false
	xvote.vote.infammo[playerID] = false
	xvote.vote.map[playerID] = false
	xvote.vote.gamemode[playerID] =	false
	xvote.vote.specmode[playerID] =	false
	xvote.vote.roundtime[playerID] = false
	xvote.vote.freezetime[playerID] = false
	xvote.vote.buytime[playerID] = 	false
	xvote.vote.startmoney[playerID] = false
	xvote.vote.curtailedexplosions[playerID] = false
	xvote.vote.restart[playerID] = false

	for i=1,32 do
		xvote.vote.kick[i][playerID] = false
		xvote.vote.makespec[i][playerID] = false
	end
end

function xvote.join(playerID)
	xvote.clearPlayerVotes(playerID)
end
addhook("join","xvote.join")

function xvote.leave(playerID,reason)
	xvote.clearPlayerVotes(playerID)
end
addhook("leave","xvote.leave")

function xvote.toggle(votetable, playerID, option, condition, positive, negative, name)
	if(votetable[playerID]~=true) then
		votetable[playerID]=true
		msg(xvote.votecolor..player(playerID,"name").." votes to toggle "..name..".")
		parse('sv_sound "player/vote.wav"')
	end
	if(xvote.getMajority(votetable)==true) then
		if(tonumber(game(option))==condition) then
			parse(negative)
		else
			parse(positive)
		end

		return true
	end
	return false
end



function xvote.openVotekickMenu(playerID,page)
	local str = "Vote to kick player (page "..page..")"
	local start = 1 + (page-1)*7
	local c = 1
	for i=start,math.min(xvote.getPlayers(),start+6) do
		p = xvote.players()[i]

		if(player(p,"exists")) then
			str = str..","..xvote.voteString(xvote.vote.kick[p], true, player(p,"name"))
		else
			str = str..","
		end
		c = c+1
	end

	for i=c, 7 do
		str = str..","
	end

	if(page~=1) then
		str = str..",« previous page"
	else
		str = str..","
	end
	if(xvote.getPlayers()~=math.min(xvote.getPlayers(),start+6)) then
		str = str..",next page »"
	end

	menu(playerID,str)

	return str
end






function xvote.menucall(playerID,title,button)
	if(title=="Vote game options") then
		if(button==1) then
			--xvote.openVotemapMenu(playerID,1)
			menu(playerID,xvote.menu.map)
		elseif(button==5) then
			if(xvote.toggle(xvote.vote.fow, playerID, "sv_fow", 1, "sv_fow 1", "sv_fow 0", "Fog of War")) then
				xvote.vote.fow = xvote.initArray(32,false)
			end
		elseif(button==6) then
			if(xvote.toggle(xvote.vote.ff, playerID, "sv_friendlyfire", 1, "sv_friendlyfire 1", "sv_friendlyfire 0", "Friendly Fire")) then
				xvote.vote.ff = xvote.initArray(32,false)
			end

		elseif(button==7) then
			if(xvote.toggle(xvote.vote.infammo, playerID, "mp_infammo", 1, "mp_infammo 1", "mp_infammo 0", "infinite ammo")) then
				xvote.vote.infammo = xvote.initArray(32,false)
			end

		elseif(button==3) then
			menu(playerID,xvote.menu.gamemode)

		elseif(button==4) then
			menu(playerID,xvote.menu.specmode)
		elseif(button==2) then
			xvote.openVotekickMenu(playerID,1)
		elseif(button==8) then

			if(xvote.vote.restart~=true) then
				xvote.vote.restart[playerID]=true
				msg(xvote.votecolor..player(playerID,"name").." votes for a round restart.")
			end
			if(xvote.getMajority(xvote.vote.restart)==true) then
				parse("sv_restartround")
				xvote.vote.restart = xvote.initArray(32,false)
			end
		elseif(button==9) then
			xvote.clearPlayerVotes(playerID)
			msg(xvote.votecolor..player(playerID,"name").." withdraws his votes.")
		end

	elseif(title=="Vote for game mode") then
		if(button>=1 and button<=5) then
			xvote.vote.gamemode[playerID] = button-1

			if(xvote.vote.gamemode[playerID]==0) then
				msg(xvote.votecolor..player(playerID,"name").." votes the gamemode Standard.")
			elseif(xvote.vote.gamemode[playerID]==1) then
				msg(xvote.votecolor..player(playerID,"name").." votes the gamemode Deathmatch.")
			elseif(xvote.vote.gamemode[playerID]==2) then
				msg(xvote.votecolor..player(playerID,"name").." votes the gamemode Team Deathmatch.")
			elseif(xvote.vote.gamemode[playerID]==3) then
				msg(xvote.votecolor..player(playerID,"name").." votes the gamemode Construction.")
			elseif(xvote.vote.gamemode[playerID]==4) then
				msg(xvote.votecolor..player(playerID,"name").." votes the gamemode Zombies!")
			end

			parse('sv_sound "player/vote.wav"')

			if(xvote.getMajority(xvote.vote.gamemode)~=false and xvote.getMajority(xvote.vote.gamemode)~=nil) then
				parse("sv_gamemode "..xvote.vote.gamemode[playerID])
				xvote.vote.gamemode = xvote.initArray(32,false)
			end
		elseif(button==6) then
			xvote.vote.gamemode[playerID] = false
			msg(xvote.votecolor..player(playerID,"name").." withdraws the vote on gamemode.")
		end


	elseif(title=="Vote to allow to spectate ...") then
		if (button==1) then
			xvote.vote.specmode[playerID] = 1	-- everything
			msg(xvote.votecolor..player(playerID,"name").." votes to allow full spectating.")

		elseif(button==2) then
			xvote.vote.specmode[playerID] = 2	-- own team only
			msg(xvote.votecolor..player(playerID,"name").." votes to to allow spectating own team only.")
		elseif(button==3) then
			xvote.vote.specmode[playerID] = 0	-- nothing
			msg(xvote.votecolor..player(playerID,"name").." votes to disable spectating.")
		elseif(button==4) then
			xvote.vote.specmode[playerID] = false
			msg(xvote.votecolor..player(playerID,"name").." withdraws the vote on spectating mode.")
		end

		parse('sv_sound "player/vote.wav"')

		if(xvote.getMajority(xvote.vote.specmode)~=false and xvote.getMajority(xvote.vote.specmode)~=nil) then
			parse("sv_specmode "..xvote.vote.specmode[playerID])
			xvote.vote.specmode = xvote.initArray(32,false)
		end
	elseif(title=="Select map type") then
		if(button==1) then
			xvote.openVotemapMenu(playerID,1,"")
		elseif(button==2) then
			xvote.openVotemapMenu(playerID,1,"as_")
		elseif(button==3) then
			xvote.openVotemapMenu(playerID,1,"cs_")
		elseif(button==4) then
			xvote.openVotemapMenu(playerID,1,"de_")
		elseif(button==5) then
			xvote.openVotemapMenu(playerID,1,"dm_")
		elseif(button==6) then
			xvote.openVotemapMenu(playerID,1,"ctf_")
		elseif(button==7) then
			xvote.openVotemapMenu(playerID,1,"dom_")
		elseif(button==8) then
			xvote.openVotemapMenu(playerID,1,"zm_")
		elseif(button==9) then
			xvote.openVotemapMenu(playerID,1,"gg_")
		end


	elseif(string.sub(title,1,9)=="Vote for " and string.match(title,"map")~=nil) then
		local page = string.match(title,"(%d+)")
		local filter = string.match(title,"%a+_")
		if filter==nil then filter="" end
		local start = (page-1)*7

		if(button>=1 and button<=7) then
			maps=xvote.mapcycle(filter)
			map = start+button

			xvote.vote.map[playerID] = maps[map]

			msg(xvote.votecolor..player(playerID,"name").." votes the map "..maps[map]..".")
			parse('sv_sound "player/vote.wav"')

			if(xvote.getMajority(xvote.vote.map)==maps[map]) then
				parse("sv_map "..maps[map])
			end
		elseif(button==8) then
			xvote.openVotemapMenu(playerID,page-1,filter)
		elseif(button==9) then
			xvote.openVotemapMenu(playerID,page+1,filter)
		end

	elseif(string.sub(title,1,19)=="Vote to kick player") then
		local page = string.match(title,"(%d+)")
		local start = (page-1)*7

		if(button>=1 and button<=7) then
			victim = xvote.players()[start+button]

			xvote.vote.kick[victim][playerID] = true

			msg(xvote.votecolor..player(playerID,"name").." votes to kick "..player(victim,"name")..".")
			parse('sv_sound "player/vote.wav"')

			if(xvote.getMajority(xvote.vote.kick[victim])==true) then
				parse("kick "..victim)
			end
		elseif(button==8) then
			xvote.openVotekickMenu(playerID,page-1)
		elseif(button==9) then
			xvote.openVotekickMenu(playerID,page+1)
		end
	end
end
addhook("menu","xvote.menucall")

He said he removed some stuff that he didn't want to be available to vote.
But it gives him an error (just 1) everytime he tries to start the server.
Anybody can fix?
To the start Previous 1 2153 154 155338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview