11.10.2018, 18:56
[GameMode] [MySQL R41-4] Login / Register Base Script
11.10.2018, 20:34
i set passowrd for DB and its work fine now thx @willbedie for sql_log.txt
25.10.2018, 19:39
which MySQL version do you use?
25.10.2018, 19:49
25.10.2018, 19:54
25.10.2018, 21:25
oh, It's my bad :v. Thanks for your fast response
25.10.2018, 22:50
I found a bug :O. Stats are not saved.
Here is the code for SavePlayer func.
forward SavePlayer(playerid);
public SavePlayer(playerid)
{
new query[1000];
new
string[800]
;
format(string, sizeof(string), "%s Cash=%d,", string, pdata[playerid][Cash]);
format(string, sizeof(string), "%s Kills=%d,", string, pdata[playerid][Kills]);
format(string, sizeof(string), "%s Deaths=%d,", string, pdata[playerid][Deaths]);
format(string, sizeof(string), "%s Level=%d,", string, pdata[playerid][Level]);
format(string, sizeof(string), "%s Score=%d,", string, pdata[playerid][Score]);
format(string, sizeof(string), "%s XP=%d,", string, pdata[playerid][XP]);
format(string, sizeof(string), "%s Coins=%d,", string, pdata[playerid][Coins]);
mysql_format(Database, query, sizeof(query), "UPDATE `users` SET %s WHERE `Username` = '%s'", string, GetName(playerid));
mysql_tquery(Database, query); //We will execute the query.
return 1;
}
here is a screenshot for table structure: http://prntscr.com/laj7md
- thanks for helping
Here is the code for SavePlayer func.
forward SavePlayer(playerid);
public SavePlayer(playerid)
{
new query[1000];
new
string[800]
;
format(string, sizeof(string), "%s Cash=%d,", string, pdata[playerid][Cash]);
format(string, sizeof(string), "%s Kills=%d,", string, pdata[playerid][Kills]);
format(string, sizeof(string), "%s Deaths=%d,", string, pdata[playerid][Deaths]);
format(string, sizeof(string), "%s Level=%d,", string, pdata[playerid][Level]);
format(string, sizeof(string), "%s Score=%d,", string, pdata[playerid][Score]);
format(string, sizeof(string), "%s XP=%d,", string, pdata[playerid][XP]);
format(string, sizeof(string), "%s Coins=%d,", string, pdata[playerid][Coins]);
mysql_format(Database, query, sizeof(query), "UPDATE `users` SET %s WHERE `Username` = '%s'", string, GetName(playerid));
mysql_tquery(Database, query); //We will execute the query.
return 1;
}
here is a screenshot for table structure: http://prntscr.com/laj7md
- thanks for helping
25.10.2018, 23:17
It might be you only, check mysql_log.txt and post it here.
25.10.2018, 23:24
that's weird..
[Thu Oct 25 20:22:44 2018] -------------------------
[Thu Oct 25 20:22:44 2018] Logging Started
[Thu Oct 25 20:22:44 2018] -------------------------
[Thu Oct 25 20:23:20 2018] -------------------------
[Thu Oct 25 20:23:20 2018] Logging Started
[Thu Oct 25 20:23:20 2018] -------------------------
[Thu Oct 25 20:24:42 2018] -------------------------
[Thu Oct 25 20:24:42 2018] Logging Started
[Thu Oct 25 20:24:42 2018] -------------------------
[Thu Oct 25 20:25:36 2018] -------------------------
[Thu Oct 25 20:25:36 2018] Logging Started
[Thu Oct 25 20:25:36 2018] -------------------------
[Thu Oct 25 20:27:37 2018] -------------------------
[Thu Oct 25 20:27:37 2018] Logging Started
[Thu Oct 25 20:27:37 2018] -------------------------
[Thu Oct 25 20:28:43 2018] -------------------------
[Thu Oct 25 20:28:43 2018] Logging Started
[Thu Oct 25 20:28:43 2018] -------------------------
[Thu Oct 25 20:32:29 2018] -------------------------
[Thu Oct 25 20:32:29 2018] Logging Started
[Thu Oct 25 20:32:29 2018] -------------------------
[Thu Oct 25 20:33:15 2018] -------------------------
[Thu Oct 25 20:33:15 2018] Logging Started
[Thu Oct 25 20:33:15 2018] -------------------------
[Thu Oct 25 21:00:29 2018] -------------------------
[Thu Oct 25 21:00:29 2018] Logging Started
[Thu Oct 25 21:00:29 2018] -------------------------
[Thu Oct 25 21:00:54 2018] -------------------------
[Thu Oct 25 21:00:54 2018] Logging Started
[Thu Oct 25 21:00:54 2018] -------------------------
[Thu Oct 25 21:01:04 2018] -------------------------
[Thu Oct 25 21:01:04 2018] Logging Started
[Thu Oct 25 21:01:04 2018] -------------------------
[Thu Oct 25 21:08:16 2018] -------------------------
[Thu Oct 25 21:08:16 2018] Logging Started
[Thu Oct 25 21:08:16 2018] -------------------------
[Thu Oct 25 21:10:29 2018] -------------------------
[Thu Oct 25 21:10:29 2018] Logging Started
[Thu Oct 25 21:10:29 2018] -------------------------
[Thu Oct 25 21:10:36 2018] -------------------------
[Thu Oct 25 21:10:36 2018] Logging Started
[Thu Oct 25 21:10:36 2018] -------------------------
[Thu Oct 25 20:22:44 2018] -------------------------
[Thu Oct 25 20:22:44 2018] Logging Started
[Thu Oct 25 20:22:44 2018] -------------------------
[Thu Oct 25 20:23:20 2018] -------------------------
[Thu Oct 25 20:23:20 2018] Logging Started
[Thu Oct 25 20:23:20 2018] -------------------------
[Thu Oct 25 20:24:42 2018] -------------------------
[Thu Oct 25 20:24:42 2018] Logging Started
[Thu Oct 25 20:24:42 2018] -------------------------
[Thu Oct 25 20:25:36 2018] -------------------------
[Thu Oct 25 20:25:36 2018] Logging Started
[Thu Oct 25 20:25:36 2018] -------------------------
[Thu Oct 25 20:27:37 2018] -------------------------
[Thu Oct 25 20:27:37 2018] Logging Started
[Thu Oct 25 20:27:37 2018] -------------------------
[Thu Oct 25 20:28:43 2018] -------------------------
[Thu Oct 25 20:28:43 2018] Logging Started
[Thu Oct 25 20:28:43 2018] -------------------------
[Thu Oct 25 20:32:29 2018] -------------------------
[Thu Oct 25 20:32:29 2018] Logging Started
[Thu Oct 25 20:32:29 2018] -------------------------
[Thu Oct 25 20:33:15 2018] -------------------------
[Thu Oct 25 20:33:15 2018] Logging Started
[Thu Oct 25 20:33:15 2018] -------------------------
[Thu Oct 25 21:00:29 2018] -------------------------
[Thu Oct 25 21:00:29 2018] Logging Started
[Thu Oct 25 21:00:29 2018] -------------------------
[Thu Oct 25 21:00:54 2018] -------------------------
[Thu Oct 25 21:00:54 2018] Logging Started
[Thu Oct 25 21:00:54 2018] -------------------------
[Thu Oct 25 21:01:04 2018] -------------------------
[Thu Oct 25 21:01:04 2018] Logging Started
[Thu Oct 25 21:01:04 2018] -------------------------
[Thu Oct 25 21:08:16 2018] -------------------------
[Thu Oct 25 21:08:16 2018] Logging Started
[Thu Oct 25 21:08:16 2018] -------------------------
[Thu Oct 25 21:10:29 2018] -------------------------
[Thu Oct 25 21:10:29 2018] Logging Started
[Thu Oct 25 21:10:29 2018] -------------------------
[Thu Oct 25 21:10:36 2018] -------------------------
[Thu Oct 25 21:10:36 2018] Logging Started
[Thu Oct 25 21:10:36 2018] -------------------------
25.10.2018, 23:33
That has nothing to do with my filterscript and/or with my other scripts.
25.10.2018, 23:38
- Updated:
V1.1
Thanks to Bork for suggesting stuff / helping me finish this. Enjoy!
Github
Pastebin
P.S: Here's how a 5 characters password looks like (hashed, salted):
V1.1
- Added BCrypt version (very recommended to use)
- Fixed some account saving issues
- Removed AUTO_RECONNECT code OnGameModeInit (MySQL has that option itself without having to do anything)
- Passwords get hashed and salted, no need to do both separatedly.
Thanks to Bork for suggesting stuff / helping me finish this. Enjoy!
Github
Pastebin
P.S: Here's how a 5 characters password looks like (hashed, salted):
26.10.2018, 08:55
Good stuff!
26.10.2018, 09:26
This will not work (no active cache): https://github.com/willbedie/MySQL-L...g.pwn#L92-#L93
You select everything from the row twice + another one to select the password:
https://github.com/willbedie/MySQL-L...g.pwn#L45-#L46
https://github.com/willbedie/MySQL-L...pwn#L126-#L127
https://github.com/willbedie/MySQL-L...g.pwn#L91-#L92
The first query should lookup the database by the name of the player. Any other query should identify records by their registration ID.
Set necessary keys (name of player will always be unique) to improve searching speed.
In `OnPlayerRegister` public function you should retrieve the insert id generated using the cache function: https://github.com/willbedie/MySQL-L...pwn#L111-#L117
Since you have two different scripts, one with bcrypt and the other one with Whirlpool you should have a .sql file for each one of them.
bcrypt output is 60 so why `Password` column to be varchar(129)? It is also a fixed-length so make it char(60).
Set default values for cash, kills and deaths.
When you know an amount (integer value) cannot be negative, declare it as unsigned.
There are different integer types, you should choose wisely: https://dev.mysql.com/doc/refman/8.0...ger-types.html
You select everything from the row twice + another one to select the password:
https://github.com/willbedie/MySQL-L...g.pwn#L45-#L46
https://github.com/willbedie/MySQL-L...pwn#L126-#L127
https://github.com/willbedie/MySQL-L...g.pwn#L91-#L92
The first query should lookup the database by the name of the player. Any other query should identify records by their registration ID.
Set necessary keys (name of player will always be unique) to improve searching speed.
In `OnPlayerRegister` public function you should retrieve the insert id generated using the cache function: https://github.com/willbedie/MySQL-L...pwn#L111-#L117
Since you have two different scripts, one with bcrypt and the other one with Whirlpool you should have a .sql file for each one of them.
bcrypt output is 60 so why `Password` column to be varchar(129)? It is also a fixed-length so make it char(60).
Set default values for cash, kills and deaths.
When you know an amount (integer value) cannot be negative, declare it as unsigned.
There are different integer types, you should choose wisely: https://dev.mysql.com/doc/refman/8.0...ger-types.html
09.11.2018, 16:00
Nice Work!
11.11.2018, 15:55
Good Work
17.12.2018, 13:12
Maybe im stupid, or I missed something. When player registers on the server, are u sure, that he's data gonna be saved when he will disconnect ? Cuz, I was trying all the ways, and the most common idea I made, that you have to pull he's 'ID' from database after he regs, to save he's data on first time he joins and leaves the server. On second time if you will connect, it's ok, it saves everything. I hope you got it.
29.12.2018, 20:15
Quote:
Maybe im stupid, or I missed something. When player registers on the server, are u sure, that he's data gonna be saved when he will disconnect ? Cuz, I was trying all the ways, and the most common idea I made, that you have to pull he's 'ID' from database after he regs, to save he's data on first time he joins and leaves the server. On second time if you will connect, it's ok, it saves everything. I hope you got it.
|
29.12.2018, 20:25
Lack recover password, but, the system is good.
24.02.2019, 17:12
V1.2 (BCrypt)
From now on, you need zcmd to compile the script.
Код:
[+] Updated with a new command - /changepassword
26.02.2019, 04:44
Not bad but obviously basic. Needs_Rehash function from bcrypt include can be included in case work factor changes as technology progresses. Also the GitHub repo .amx is not updated. Aside from this, could be extended through second password confirmation box, email for recovery (even if this is manual). GPCI hash can also be another useful metric for ban evaders though obviously not foolproof.
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)