English Lua Error

5 replies
Goto Page
To the start Previous 1 Next To the start
20.08.13 10:11:09 am
Up
mr_s
User
Offline Off
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
Code:
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 :
Code:
1
if USGNid > 0 then
IMG:http://www.gs4u.net/350x20/cs2d/5.231.50.192:36963.png
20.08.13 11:06:46 am
Up
Dovahkin
User
Offline Off
What is the error?

Code:
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. ∗
IMG:http://i561.photobucket.com/albums/ss59/killerboy_04/76561198036665859.png
20.08.13 11:27:14 am
Up
MikuAuahDark
User
Offline Off
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:
Code:
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
Hello? Are you there, Tae Hanazono?
20.08.13 12:41:31 pm
Up
Dovahkin
User
Offline Off
@user MikuAuahDark: How nicely done. √
IMG:http://i561.photobucket.com/albums/ss59/killerboy_04/76561198036665859.png
20.08.13 01:38:26 pm
Up
mr_s
User
Offline Off
good good good, worked

didnt save and didnt make message
edited 1×, last 25.08.13 02:22:30 pm
IMG:http://www.gs4u.net/350x20/cs2d/5.231.50.192:36963.png
26.08.13 03:13:14 am
Up
omg
User
Offline Off
if it didnt work, u'll want to post the whole script to save time

*in a spoiler, preferably
will code for food
To the start Previous 1 Next To the start