Forum

> > CS2D > Scripts > Global USGN data manager Example Script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Global USGN data manager Example Script

3 replies
To the start Previous 1 Next To the start

old Global USGN data manager Example Script

KagamineLen
User Off Offline

Quote
hello i need help on using file cs2d Global USGN data manager [LOAD/SAVE SCRIPT] because even it has example script, still don't understand how it works and how to do it

so, this is the example sxript on the file's description

1
2
3
4
5
6
7
8
9
10
11
12
USGN_DEFAULTDATA["money"] = 0

addhook("join","onJoin")
function onJoin(id)
     ReloadUSER(id)
     msg2(id, "Hello "..player(id,"name")..", you've $"..USER[id]["money"])
end

addhook("leave","onLeave")
function onLeave(id)
     SaveUSER(id)
end

I just wanted to save/load this variables
1
2
3
RANK[] = (Rank)
COLOR[] = (Color)
SCORE[] = (Score)

old Re: Global USGN data manager Example Script

Starkkz
Moderator Off Offline

Quote
I guess this should work
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
USGN_DEFAULTDATA["rank"] = "rank name"
USGN_DEFAULTDATA["color"] = {r = 255,g = 255,b = 255}
USGN_DEFAULTDATA["score"] = 0

addhook("join","onJoin")
function onJoin(id)
	ReloadUSER(id)
	if USER_DATA[id] ~= nil then
		msg2(id, "Your rank: "..USER[id]["rank"])
		msg2(id, "Your score: "..USER[id]["score"])

		msg2(id, "Color R: "..USER[id]["color"].r)
		msg2(id, "Color G: "..USER[id]["color"].g)
		msg2(id, "Color B: "..USER[id]["color"].b)
	end
end

addhook("leave","onLeave")
function onLeave(id)
	SaveUSER(id)
end

So you can modify the USER[id] table with the elements that you set as default user data variables.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview