SA-MP Forums Archive
[GameMode] [MySQL R41-4] Login / Register Base Script - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Gamemode Scripts (https://sampforum.blast.hk/forumdisplay.php?fid=71)
+--- Thread: [GameMode] [MySQL R41-4] Login / Register Base Script (/showthread.php?tid=659037)

Pages: 1 2 3 4


Re: [MySQL R41-4] Login / Register Base Script - solstice_ - 11.10.2018

Quote:
Originally Posted by user5487
Посмотреть сообщение
where can i see sql log i use xampp
Server folder/logs/plugins/mysql_log.txt


Re: [MySQL R41-4] Login / Register Base Script - user5487 - 11.10.2018

i set passowrd for DB and its work fine now thx @willbedie for sql_log.txt


Re: [MySQL R41-4] Login / Register Base Script - Kincaid - 25.10.2018

which MySQL version do you use?


Re: [MySQL R41-4] Login / Register Base Script - Wolfe - 25.10.2018

Quote:
Originally Posted by Kincaid
Посмотреть сообщение
which MySQL version do you use?



?


Re: [MySQL R41-4] Login / Register Base Script - solstice_ - 25.10.2018

Quote:
Originally Posted by Kincaid
Посмотреть сообщение
which MySQL version do you use?
Did you completely ignore the title or?


Re: [MySQL R41-4] Login / Register Base Script - Kincaid - 25.10.2018

oh, It's my bad :v. Thanks for your fast response


Re: [MySQL R41-4] Login / Register Base Script - Kincaid - 25.10.2018

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


Re: [MySQL R41-4] Login / Register Base Script - solstice_ - 25.10.2018

It might be you only, check mysql_log.txt and post it here.


Re: [MySQL R41-4] Login / Register Base Script - Kincaid - 25.10.2018

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] -------------------------


Re: [MySQL R41-4] Login / Register Base Script - solstice_ - 25.10.2018

That has nothing to do with my filterscript and/or with my other scripts.


Re: [MySQL R41-4] Login / Register Base Script - solstice_ - 25.10.2018

- Updated:

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):




Re: [MySQL R41-4] Login / Register Base Script - Infin1ty - 26.10.2018

Good stuff!


Re: [MySQL R41-4] Login / Register Base Script - Calisthenics - 26.10.2018

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


Re: [MySQL R41-4] Login / Register Base Script - CaptainBoi - 09.11.2018

Nice Work!


Re: [MySQL R41-4] Login / Register Base Script - AnassGM - 11.11.2018

Good Work


Re: [MySQL R41-4] Login / Register Base Script - bogushas - 17.12.2018

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.


Re: [MySQL R41-4] Login / Register Base Script - solstice_ - 29.12.2018

Quote:
Originally Posted by bogushas
Посмотреть сообщение
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.
It doesn't save if you force-shut down the server, like if you're in windows and close the "samp-server.exe" thing, it won't save the data. You will have to quit the game to save the data.


Re: [MySQL R41-4] Login / Register Base Script - PowerMwK - 29.12.2018

Lack recover password, but, the system is good.


Re: [MySQL R41-4] Login / Register Base Script - solstice_ - 24.02.2019

V1.2 (BCrypt)

Код:
[+] Updated with a new command - /changepassword
From now on, you need zcmd to compile the script.


Re: [MySQL R41-4] Login / Register Base Script - MilesM3 - 26.02.2019

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.