Forum

> > CS2D > Scripts > Script Error.
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Script Error.

7 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Script Error.

Raaj Nadar
User Off Offline

Zitieren
Hi this is Raaj Nadar.
I was in a small project and i made my own script.

But when i tried to use in Cs2D i got a error message when i use tag command.

1
LUA ERROR: sys/lua/raaj nadar/admins.lua:47: attempt to index field '?' (a nil value)

I am trying to fix it but it made it impossible.
Need you help to fix it.

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
mod = {} -- Don't put the USGN id here it is for the function.

VIP = {}
Admin = {}

--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--
--~~~~~~~~~ Tag System(By - Raaj Nadar). ~~~~~~~~~~~--
--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--
levelnames = {[0]=Banned,[1]=User,[2]=VIP,[3]=Moderator,[4]=Supporter,[5]=Supervisor,[6]=Admin,[7]=Owner,}

addhook("say","colors")
function colors(id,t)
	if colors == 0 then
	return false
	end
end

function mod_join(id)
	mod[id] = {}
	mod[id].level = 1
	mod[id].status = "User"
	mod[id].name = player(id,"name")
	mod[id].usgn = player(id,"usgn")
	mod[id].ip = player(id,"ip")
	mod[id].muted = false
	mod[id].tagon = false

	for _, usgn in ipairs(VIP) do
		if player(id,"usgn")==usgn then
		mod[id].level = 2
		mod[id].status = "V.I.P"
		mod[id].tag = "~[VIP]~"
		mod[id].tagon = true
		end
	end
	welcome(id)
end

addhook("say","say_tag")
function say_tag(id,txt)
if txt=="!tag" then
	if mod[id].level >= 2 then
		mod[id].tag = true
		msg2(id,"©000255000Color Tag is On!")
			return 1
		else
		mod[id].tag = false
		msg2(id,"©255000000Color Tag Is off!")
			return 1
		end
	end
end

Check out and help me...

Have a nice day....be fast i am rushing with the script.

Admin/Mod Kommentar

It makes no sense to hide the error message in a spoiler tag when it's only one single stupid line (unless you want to annoy people). Fixed /DC

alt Re: Script Error.

Alpha Beta
User Off Offline

Zitieren
Not sure if this is what you wanted, but it works here;

Spoiler >


You can change the colors in the levelnames table.
2× editiert, zuletzt 30.06.14 00:31:45

alt Re: Script Error.

TopNotch
User Off Offline

Zitieren
So similar to my script...
Anyway, "mod[id].tag" isn't defined for every user, so will lead to errors when you try to compare it. Place it somewhere in the join hook.
Furthermore, you forgot to add the join hook.
1× editiert, zuletzt 22.06.14 15:50:50

alt Re: Script Error.

Raaj Nadar
User Off Offline

Zitieren
@user Alpha Beta: Oh thank's & it really worked....
CHANGED
: The function.

@user Pseudon: Thanks i forgot that thing....error's by scriptor.

@user TopNotch: "mod[id].tag" then what can i use instead of this...any suggestion.

Thanks it got fixed in a day....i was trying from a week.

alt Re: Script Error.

_Yank
User Off Offline

Zitieren
user UnkN hat geschrieben
1
2
3
for i=1, 32 do
	mod[i]={}
end

That's not needed since he does it on the join hook.

By the way if you want to do this, use this instead
1
2
3
4
local maxplayers = game("sv_maxplayers")
for id = 1, maxplayers do
	mod[id] = {level = 1, muted = false, tagon = true, status = "User"}
end
So you only need to apply the USGN, the IP and the name on join hook and apply the other ones only if player has a special rank.

alt Re: Script Error.

Raaj Nadar
User Off Offline

Zitieren
@user _Yank: Can you expain you script in detail.
I did not understood the the link of max player??

Hope you can explain me.

@user UnkN: Ya user _Yank is right i am using join function after it was fixed by user Alpha Beta.


But thanks for Helping... (Y)
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht