Forum

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

Englisch Lua Error

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Lua Error

mr_s
User Off Offline

Zitieren
i was editing smiley city lua to add autosave but i got this error:
LUA ERROR: sys/lua/Team Boss/Main.lua:390: attempt to compare number with nil
1
2
3
4
5
6
7
8
addhook("minute","rp_minute")
function rp_minute(id)
	
		local USGNid = UsgnIds[id]
		if USGNid > 0 then
			SaveUserStat(id,USGNid)
			rp_msg("000255100","AutoSave!")
	end
line 390 :
1
if USGNid > 0 then

alt Re: Lua Error

Dovahkin
User Off Offline

Zitieren
What is the error?

1
2
3
4
5
6
7
8
9
addhook("minute","rp_minute")
function rp_minute(id)
     
          local USGNid = UsgnIds[id]
          if USGNid = 0 then
               SaveUserStat(id,USGNid)
               rp_msg("000255100","AutoSave!")
     end
end

Edit : I'm just guessing until you state the actual problem.

Edit2x : Probably PM me the whole code instead. ∗

alt Re: Lua Error

MikuAuahDark
User Off Offline

Zitieren
it looks like that: UsgnIds with index id is nil

you could post the join and leave hook instead. and also the Save & Load function

EDIT: i got it. cs2d lua hook minute hook does not have any parameter
Fixed:
1
2
3
4
5
6
7
8
9
addhook("minute","rp_minute")
function rp_minute()
	for _, id in pairs(player(0,"table")) do
		if UsgnIds[id]>0 then
			SaveUserStat(id,UsgnIds[id])
		end
	end
	rp_msg("000255100","AutoSave!")
end

alt Re: Lua Error

mr_s
User Off Offline

Zitieren
good good good, worked

didnt save and didnt make message
1× editiert, zuletzt 25.08.13 14:22:30

alt Re: Lua Error

omg
User Off Offline

Zitieren
if it didnt work, u'll want to post the whole script to save time

*in a spoiler, preferably
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht