Forum

> > CS2D > Scripts > Save error
Forums overviewCS2D overview Scripts overviewLog in to reply

English Save error

1 reply
To the start Previous 1 Next To the start

old Save error

LifeIsCat27
User Off Offline

Quote
Im on progress on making a script but this occured
This is the code
1
2
3
4
5
6
7
8
addhook("die","save_die")
function save_die(id)
	if (player(id,"usgn")>0) then
		io.output(io.open("sys/lua/RWsaves/"..player(id,"usgn")..".txt","w+"))
		io.write(exp[id].." "..level[id].." "..HPP[id].." "..APP[id].." "..SPP[id].." "..Point[id].." "..hasbomber[id].." "..hassuper[id].." "..hascyborg[id].." "..hastrooper[id].." "..KHPP[id].." "..KAPP[id].." "..KSPP[id].." "..KR[id].." "..KD[id])
		io.close()
	end
end
Console says :
LUA ERROR :sys/lua/TotalWar.lua:805: attempt to concatenate field '?' (a nil value)
line 805 was the io.write
im aleready put array and other thingies but still cant fix this.
Help!

old Re: Save error

Apache uwu
User Off Offline

Quote
Big deal, you need to make sure all these tables are set.

1
exp,level,HPP,APP,SPP,Point,hasbomber,hassuper,hascyborg,hastrooper,KHPP,KAPP,KSPP,KR,KD

It would be much easier to store your user data in a format more pleasing to the eye.

For example:

player[1].exp = exp,
player[1].level = level,
and so on...
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview