Forum

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

Englisch Save Error

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Save Error

_Vava_
User Off Offline

Zitieren
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
function _join	
local usgn = player(id,"usgn")
	if (usgn > 0) then
		msg2(id,'\169255255255Your U.S.G.N. ID: '..usgn..'@C')
		f = io.open('sys/lua/ZombieCrown/saves/'..usgn..'.txt','r')
		local line
		if not f then
			line = {1,0,50,10,0,0,0}
			msg2(id,"\169255000000Failed to load!@C")
		else
			line = f:read("*a"):split()
			msg2(id,"\169000000255Load!@C")
		end
		level[id] = tonumber(line[1]) or 1 -- Same as above reasoning (prevents errors)
		exp[id] = tonumber(line[2]) or 0
		ap[id] = tonumber(line[3]) or 50
		point[id]=tonumber(line[4]) or 10
		hp[id]=tonumber(line[5]) or 0
		armor[id]=tonumber(line[6]) or 0
		deadly[id]=tonumber(line[7]) or 0
	else
		msg2(id,"\169255000000No USGN found!@C")
		level[id]=1
		exp[id]=0
		ap[id]=50
		point[id]=10
		hp[id]=0
		armor[id]=0
		deadly[id]=0
	end
end

LUA Error: Attempt to call method 'split' (a nil value)
Line=11

alt Re: Save Error

Waldin
User Off Offline

Zitieren
hehe add a string.split function
1
2
3
4
5
6
7
function string:split(sep)
	local words = {}
	for word in self:gmatch(sep~=nil and "[^"..tostring(sep).."]+" or "[^%s]+") do
		words[#words+1] = word
	end
	return words
end

also...
1
function _join

use _join(id) ?

alt Re: Save Error

Baloon
GAME BANNED Off Offline

Zitieren
The name is actually wrong, you should rename it to "Load Userdata Error", the thing is join hook is actually used on Load, not Save.
Spoiler >
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht