Forum

> > CS2D > Scripts > What this error means?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch What this error means?

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: What this error means?

DC
Admin Off Offline

Zitieren
You probably never assigned any value to
moneyz[id]
(with the id value which is currently used at that point)

Therefore it is nil (does not exist / has no value). You can't compare nil and you can't add something to nil. That's what the errors mean.

You have to initialize the value first by doing
moneyz[id] = YOUR INITIAL VALUE
e.g.
moneyz[id] = 0


And you have to do that for all possible id values (probably 1-32 if those are player IDs). This must happen in the beginning. BEFORE you try to access these values.

alt Re: What this error means?

Cure Pikachu
User Off Offline

Zitieren
Right. Make sure your script has something like this:
1
2
3
4
5
6
7
8
9
10
11
moneyz = {}

addhook("join","initvalue")
function initvalue(id)
	moneyz[id] = 0
end

addhook("leave","resetvalue")
function resetvalue(id)
	moneyz[id] = nil
end

alt Re: What this error means?

script favor
User Off Offline

Zitieren
You're attempting to compare a value with nil value like
1
1 > n
, but we don't know what n is , in other words n is not defined
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht