Forum

> > CS2D > Scripts > Steam save
Forums overviewCS2D overview Scripts overviewLog in to reply

English Steam save

20 replies
Page
To the start Previous 1 2 Next To the start

old Steam save

maninja
User Off Offline

Quote
Hi Guys Today, come is a new and important topic, which is that I have a problem I do not know, and I hope you will help and he Save Steam I do not know how and I hope hive it to find

thx √

old Re: Steam save

maninja
User Off Offline

Quote
i mean steam save like a usgn fo example you playing in roleplay and you hive money For example 1000$ When you exit the game and enter you find the same number money

old Re: Steam save

Masea
Super User Off Offline

Quote
@user Talented Doge: I didn't say "my eyes", I said "our eyes" anyway. Moreover, you better start caring (at least for the rest, not for me) until you got banned.

old Re: Steam save

Talented Doge
User Off Offline

Quote
Quote
I didn't say "my eyes", I said "our eyes" anyway.

Yes, as if you are the only one who don't know that.

Quote
Moreover, you better start caring (at least for the rest, not for me) until you got banned.

I know that I will be temporarily banned for this. And am doing so intentionally.

old Re: Steam save

Rainoth
Moderator Off Offline

Quote
It breaks my heart that I have to t.ban these two and that guy who's always asking for handouts is not breaking any rules.
The best way to solve this is to stop giving him what he wants until he gives up or learns that people won't do everything for him in this world for free.

@user maninja: Use the search function for your problems and you'll find that there are scripts out there that have steam save already.

old Re: Steam save

Marcell
Super User Off Offline

Quote
@user Talented Doge: Instead of blaming him, you could maybe help? I am sure you were younger and inexperienced, too. Don't tell me that you were born as a professional.

@user maninja:
What you would like for example is to save the money for the specific logged-in Steam user, right?

Let's say, my Steam user is sqpp15, which is actually right. I log in to your server, then you give me $14500, then on-exit, it would be saved, right?

I would actually suggest you save the amount & data in the period, instead of when the player leaves the game. So in server crashes or on other issues, the specific guy, still have the amount stored.

@user Talented Doge: Oh, by the way, CS2D is indeed on the border or already in the way to have zero players. Instead of giving this guy respect for still trying to put some breath to the game, you make him leave. Good job. So nice. Our community must be so important to you, so CS2D.

Please make us a favour and let these new players enjoy what left.

old Re: Steam save

Marcell
Super User Off Offline

Quote
@user maninja: First of all, do you use any existing Roleplay mod or you are willing to make a new?

old Re: Steam save

maninja
User Off Offline

Quote
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
function rp_join(id)
	rp_license[id]=0
	rp_ct[id]=false
	rp_Adminlevel[id]=0
	rp_arrest[id]=false
	rp_vip[id] = 0
	player_have_pos[id]=false
	tele_x[id]=800
	tele_y[id]=200
	tsb[id]=0
	rp_money[id]= 100
	UsgnIds[id]= 0
	rp_vipaddons[id]=0
	rp_NextAddons[id]=0
	jtag[id]=0
	stag[id]=0
	bmode[id]=2
	rp_Buildhelp[id] = 0
	InternalFreeImage(id)
	InternalFreeAddons(id)

	local UsgnID = player(id,"usgn")
	UsgnIds[id] = 0
	if UsgnID > 0 then
		local sameusgn = false
		for ids = 1,32 do
			if ids~=id then
				if UsgnIds[ids]==UsgnID then
					sameusgn=true
					break
				end
			end
		end
		if sameusgn==false then
			gmsg2(id,"000255000","Login with "..UsgnID)
			rp_Adminlevel[id]= isAdmin(UsgnID)
			rp_vip[id] = isvip(UsgnID)
			local filename = "sys/lua/IF/User data/"..UsgnID..".txt"
			local file = io.open(filename)
				if file then
				LoadUserStat(id,file)
				cu(id,UsgnID)
				gmsg2(id,"000255000","Load Successfully!")
					if rp_Adminlevel[id]>=1 then
						rp_ct[id]=true
						rp_license[id]=4
						SetAddons(id,1)
						rp_arrest[id]= false
						gmode[id] = 1
						rp_Buildhelp[id] = 1
					end	
				if file ~= nil then
					file:close()
				end
			end
			UsgnIds[id] = UsgnID
		else
			gmsg2(id,"255000000","Load fail!")
		end
	else
		gmsg2(id,"255000000","Please register a U.S.G.N. account ")
		gmsg2(id,"255000000","Your money and license not save on Database")
	end
function SaveUserStat(id,UsgnID)
	file = io.open("sys/lua/IF/User data/"..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
	text = text.." "..jtag[id]
	text = text.." "..stag[id]	
	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
		end
		if (tonumber(parses[4])~=nil) then
			jtag[id]=tonumber(parses[5])
		end
		if (tonumber(parses[5])~=nil) then
			stag[id]=tonumber(parses[5])
		end
		local counter=5
		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
edited 4×, last 09.08.18 11:36:33 am

old Re: Steam save

Marcell
Super User Off Offline

Quote
@user maninja:

Will check this and write back to you, pretty much it's a busy day for me, but I definitely gonna help you with this!

old Re: Steam save

Cure Pikachu
User Off Offline

Quote
Funny thing is that that piece of code? user cs2d_is_a_Gem passed it to him, and he also asked me on Discord to help implement a Steam save feature for him, which I did. Something like
More >

Spoiler >
edited 1×, last 13.08.22 12:48:07 pm

old Re: Steam save

maninja
User Off Offline

Quote
I just want to ask if this works well and thank you my friend @user Cure Pikachu: you too @user Marcell: 2 The beest
because my admin txt give my sign and not working a admin rank ? why and lua hiving Error
edited 1×, last 09.08.18 05:57:00 pm

old Re: Steam save

Yates
Reviewer Off Offline

Quote
Apologies, praise and another issue all in one post. Only the mighty Hazard could obtain such a skill.

old Re: Steam save

cs2d_is_a_Gem
User Off Offline

Quote
Remember to use > mp_maxclientip 1, otherwise users can double their money by entering with steam accounts and usgn using two windows.
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview