Forum

> > CS2D > Scripts > giving points - scott
Forums overviewCS2D overview Scripts overviewLog in to reply

English giving points - scott

3 replies
To the start Previous 1 Next To the start

old giving points - scott

OutstandingPP
BANNED Off Offline

Quote
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 ?

More >


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

old Re: giving points - scott

Zeik
User Off Offline

Quote
Replace your say hook with this:
More >


EDIT: Explanation below:
More >
edited 2×, last 21.01.17 03:16:50 am

old Re: giving points - scott

cs2d_is_a_Gem
User Off Offline

Quote
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.

old Re: giving points - scott

Cloudy71
BANNED Off Offline

Quote
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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview