Forum

> > CS2D > Scripts > giving points - scott
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch giving points - scott

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt giving points - scott

OutstandingPP
BANNED Off Offline

Zitieren
Hello guys its the last thread about point system - scott

first of all i want to say for scott big thanks for giving to me that great code

Spoiler >


i just need the last thing is how to give some one points, because when players join to my server they are saying for me give us points

example: !give "..id.." "amount"
how to do this ?

Mehr >


let's just say thanks for reading ∗ ∗ ∗ ∗ ∗

alt Re: giving points - scott

Zeik
User Off Offline

Zitieren
Replace your say hook with this:
Mehr >


EDIT: Explanation below:
Mehr >
2× editiert, zuletzt 21.01.17 03:16:50

alt Re: giving points - scott

cs2d_is_a_Gem
User Off Offline

Zitieren
This does not have a system of Auto save
therefore every time that you restart the server will automatically erase all the points of all the players.

alt Re: giving points - scott

Cloudy71
BANNED Off Offline

Zitieren
You can save points by using IO system, or using any other methods to save them into any database. But I'd recommend saving them into the file.
Players can be identified only by their USGN or IP Address and by checking nickname just to make sure if the player receives his points when two players with same IP joins.
• By USGN
• By IP [and Nickname]

Saving can be proceeded by every point gain, by shutdown hook or by periodical autosave (timer or minute hook).

And loading in join hook.

Since filesystem is relative to the CS2D.exe path. You can make new folder in the game folder or in sys folder.
1
2
3
4
local file = io.open("sys/pts/saves.txt", "a") -- You can save points into one file or into file which will be named by the usgn or ipaddress.
io.output(file) -- Sets the filesystem to output into this file
io.write("usgn," .. player(id, "usgn) .. "," .. tostring(points[id]) .. "\n")
io.close(file)

Loading can be made by splitting lines and their content and identify the player. But better will be probably using each file for each player.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht