Forum

> > CS2D > Scripts > load data not work| roleplay
Forums overviewCS2D overview Scripts overviewLog in to reply

English load data not work| roleplay

6 replies
To the start Previous 1 Next To the start

old load data not work| roleplay

cs2d_is_a_Gem
User Off Offline

Quote
Hi unreal sofware.
I can not load the data of the game, when saving the game the file is created and saved automatically in the indicated folder but when re-entering the server the data does not load.
Does anyone know the reason?


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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function SaveUserStat(id,UsgnID)
	file = io.open("sys/lua/rp_citylife/"..UsgnID..'.txt', "w+") or io.tmpfile()
	local text = ""
	text = tostring(rp_money[id])
	text = text .." "..rp_license[id]
	if rp_arrest[id]==true then
		text = text .." 1"
	else
		text = text .." 0"
	end
		
	for k, v in ipairs(Addons) do
		text = text .." "..v.FLic[id]
	end
	file:write(text)
	file:close()
end

function LoadUserStat(id,file)
	for line in file:lines() do
		local parses = totable(line)
		local userMoney=tonumber(parses[1])
		if userMoney ~= nil then
			rp_money[id]= userMoney
		end
		if (tonumber(parses[2])~=nil) then
			rp_license[id]=tonumber(parses[2])
		end
		if (tonumber(parses[3]) == 1) then
			rp_arrest[id]=true
			rp_license[id]=0
		end
		
		local counter=3
		for k, v in ipairs(Addons) do
			counter=counter+1
			local LicItem = tonumber(parses[counter])
			if LicItem~=nil then
				v.FLic[id]=LicItem
			else
				v.FLic[id]=0
			end
		end
	end
end

Load >
edited 1×, last 13.10.17 09:03:10 am

old Re: load data not work| roleplay

Masea
Super User Off Offline

Quote
@user cs2d_is_a_Gem: Just give up dude, I'll never share that.

Yet, I'm thinking to upload a file which is about setting up your GUI easily. Such as creating buttons, menus and so on. I just need some more ideas then it'll probably be ready soon.

old Re: load data not work| roleplay

cs2d_is_a_Gem
User Off Offline

Quote
@user Masea: I think your work in that script is totally great.
and players from different parts of the world would be happy to play it. but your server does not have very good ping. Would not you like to see your work being used over the years?
I think there should be more quality codes for cs2d to shine on steam using quality servers.
it is a mistake to reserve the mods for your own use only, and if you think about sharing quality codes, I will recognize you as an excellent scripter, and we will all be grateful for your work.
Collaborate with this game to raise it to a new level. ∗ ∗ ∗
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview