Forum

> > CS2D > Scripts > Vote Kick Error!
Forums overviewCS2D overview Scripts overviewLog in to reply

English Vote Kick Error!

No replies
To the start Previous 1 Next To the start

old Vote Kick Error!

MikuAuahDark
User Off Offline

Quote
i want put votekick at file cs2d Point system v0.4.2 but error, so can someone fix it? the error:
1. the precent always says -1.#IND
2. the precent not 50% and up but it says success
the 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
-- Removed--
function votekick(id,target)
	vote_kick = target
	vote_starter = id
	vote_duration = 15
	vote_total = vote_result.agree+vote_result.disagree
	agrees = vote_result.agree*100/vote_total
	disagrees = vote_result.disagree*100/vote_total
	precent = agrees-disagrees
	for _, i in ipairs(player(0,"table")) do
		if i~=traget then
			xphud(i,9,"255255255","Vote starter: "..player(id,"name").." Precent: "..precent.." Duration: "..vote_duration,0,355)
			xphud(i,10,"255255255","Votekick player: "..player(target,"name").." Agree: "..vote_result.agree.." Disagree: "..vote_result.disagree,0,370)
			if i~=id then
				xphud(i,11,"255255255","Press 9 to Agree, 0 to Dsiagree",0,385)
				menu(i,"VOTE@i,,,,,,,,,Agree")
				isvote[i] = false
			end
		end
	end
	countdown(id,target)
end

function countdown(id,target)
	vote_duration=vote_duration-1
	vote_total = vote_result.agree+vote_result.disagree
	agrees = vote_result.agree*100/vote_total
	disagrees = vote_result.disagree*100/vote_total
	precent = agrees-disagrees
	if vote_duration==0 then
		xphud(id,9,"255255255","",-640,-480)
		xphud(id,10,"255255255","",-640,-480)
		if precent>=50 then
			msg(string.char(169).."255255255Vote kick succes, "..player(target,"name").." has been kicked")
			parse("kick "..target.." \"You get kicked by votekick\"")
		else
			msg(string.char(169).."255255255Vote kick failed, "..player(target,"name").." not kicked")
		end
		vote_kick = 0
		vote_starter = 0
	end
	if vote_duration~=0 then
		for _, i in ipairs(player(0,"table")) do
			if i~=target then
				xphud(i,9,"255255255","Vote starter: "..player(id,"name").." Precent: "..precent.." % Duration: "..vote_duration,0,355)
				xphud(i,10,"255255255","Votekick player: "..player(target,"name").." Agree: "..vote_result.agree.." Disagree: "..vote_result.disagree,0,370)
				if i~=id then
					if isvote[i]==true then
						xphud(i,11,"255255255","",-640,-480)
					else
						xphud(i,11,"255255255","Press 9 to Agree, 0 to Dsiagree",0,385)
					end
				end
			end
		end
	end
end
-- Removed --
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview