Forum

> > CS2D > Scripts > Say and Table not functioning well
Forums overviewCS2D overview Scripts overviewLog in to reply

English Say and Table not functioning well

No replies
To the start Previous 1 Next To the start

old Say and Table not functioning well

The Camo
User Off Offline

Quote
Heys, again.
I got few errors in my lua, I don't understand them at all, any explanation or a fix?
The code 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
×
			elseif string.sub(txt,-15,15)=="!ctfescoreboard" then
			ctfe.scoreboard(id)
			ctfettid=player(0,"team1")
			return 1
			end
		end
	end
end

function ctfe.scoreboard(id)
	if ctfesb==0 then
	ctfesb=1
	img1=image("gfx/Ctfessentials/CTFEScoreBoard.png",320,240,2,id)
		if (player(ctfettid[1],"exists"))==true then
		parse('hudtxt2 '..id..' tsbq "©050150255 1   '..player(ctfettid[1],"name")..' 200 80')
		end
	elseif ctfesb==1 then
	ctfesb=0
	freeimage(id)
	parse('hudtxt2 '..id..' tsbq "" 1 1')
	parse('hudtxt2 '..id..' tsbw "" 2 2')
	end
end

Well, first problem is, when I say !ctfescoreboard once it turns image on and hudtxt2 , it shows that I said !ctfe... but after that when I press again, once it should remove all hudtxts and image, it doesn't show that I said !ctfe... (I do not wish for it to say anything, thats why I set return 1 but it checks it every 1/2 times when I say !ctfe..). as if its...
1
2
3
4
5
if ctfesb==0 then
ctfesb=1
if ctfesb==1 then
ctfesb=0
return 1

but its not, its..
1
2
3
4
elseif string.sub(txt,-15,15)=="!ctfescoreboard" then
                ctfe.scoreboard(id)
                ctfettid=player(0,"team1")
                return 1
So whenever I say !ctfescoreboard it should hide the text.


Second thing is table ctfettid=player(0,"team1"), in error messages says that its trying to index global ctfettid (a nil value) when it parses this..
1
parse('hudtxt2 '..id..' tsbq "©050150255 1 '..player(ctfettid[1],"name")..' 200 80')

Thanks.
-Camo

Edit: -Deleted- Found out how to place working table check for Admin usgns with Pikachu's help.
edited 2×, last 18.12.11 03:37:00 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview