• Best way to save scores?
    8 replies, posted
I'm making a snake addon (For any mode, using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/DrawOverlay]GM:DrawOverlay[/url] ), and I need to save: 1) Player highest score 2) Global highest score I (obviously) need to save both of these on the server, but I'm wondering what's the best way to do that I'm currently using an sql table that holds a player's SteamID, and his highest score. This works for each player but I can't figure out how to get the highest score (I've never used sql before, I'm a bit lost with how sql.Query works) How would I do that? Or, if there's a better way what is it?
PData is a good way for beginners, or saving it in the serverside data folder.
--snip-- misread question.
[QUOTE=whitestar;51126192]PData is a good way for beginners, or saving it in the serverside data folder.[/QUOTE] PData would let me save every person's score, but I won't be able to show the best overall score unless the person is online
This is propably something useful: [url]http://www.sqlitetutorial.net/sqlite-max/[/url]
[QUOTE=JasonMan34;51126352]PData would let me save every person's score, but I won't be able to show the best overall score unless the person is online[/QUOTE] You still can manually fetch that data using sql.* stuff and order by score. Just look at pdata functions source to see what table they operate on and what columns are used.
[QUOTE=mijyuoon;51127155]You still can manually fetch that data using sql.* stuff and order by score. Just look at pdata functions source to see what table they operate on and what columns are used.[/QUOTE] :snip: What about using cookie.Set for the highest score, and simply compare a player's personal best to that every time a player gets a new PB?
[QUOTE=JasonMan34;51127322]:snip: What about using cookie.Set for the highest score, and simply compare a player's personal best to that every time a player gets a new PB?[/QUOTE] cookie.Set saves data in the clientside database (as long as cookie.Set is called clientside).
Used PData to save individual scores (Server-side). Every time a player got a new high score (Client-side), I send a net message to the server updating his score in the database. Every time a player gets a new high score, the server compares his new high score to the existing global high score (Stored with cookie.Set) If it's higher, I do cookie.Set to 2 variables - score and player name (SteamID didn't interest me in this case). Just in case anyone ever finds this useful
Sorry, you need to Log In to post a reply to this thread.