Vice City: Multiplayer

Server Development => Scripting and Server Management => Script Showroom => Topic started by: Fuzzie on Jan 24, 2015, 08:00 AM

Title: Fuzzie's Account System v3
Post by: Fuzzie on Jan 24, 2015, 08:00 AM
Fuzzie's Account System v3


Ever since 0.4 came out, I knew I had to update my account system that I made for the 0.3z R2 Squirrel server. I also knew that I had to do more than just edit a few lines of code. I had to create an entire new one to support server owners who wants to use the MySQL plugin. I tried to make the difference between both variants as small as possible although several external factors such as connection speed may cause varying experience.



SQLite Variant

Nothing much was changed from the previous version.

Required Plugins: Squirrel (https://bitbucket.org/stormeus/0.4-squirrel/downloads), SQLite (https://bitbucket.org/stormeus/0.4-sqlite/downloads) and Hashing (https://bitbucket.org/stormeus/0.4-hashing-algorithms/downloads)

This zip archive contains the SQLite variant (fas_v3_sqlite.nut), a sample SQL query text file, and a sample script.

Download via MediaFire (http://www.mediafire.com/download/t2148bjzm6za56a/Fuzzie's_Account_System_v3_SQLite.zip)



MySQL Variant

Specifically made for server owners and coders who uses a MySQL database.

Required Plugins: Squirrel (https://bitbucket.org/stormeus/0.4-squirrel/downloads), MySQL (https://bitbucket.org/stormeus/0.4-mysql/downloads) and Hashing (https://bitbucket.org/stormeus/0.4-hashing-algorithms/downloads)

This zip archive contains the MySQL variant (fas_v3_mysql.nut), a sample SQL query text file, and a sample script.

Download via MediaFire (http://www.mediafire.com/download/t72ka01d3nn1691/Fuzzie's_Account_System_v3_MySQL.zip)

Note: When connecting to a MySQL database that is not located locally (localhost), you may need to whitelist your server IP to allow it to remotely access your database. Click here (http://support.hostgator.com/articles/cpanel/how-to-connect-to-the-mysql-database-remotely) for more info.



Both of these variants have the same functions with the same parameters

PlayerClass(playerName, dbGlobal)
PlayerClass.Join(player)
PlayerClass.Update(player, dbGlobal)
PlayerClass.Register(player, password, dbGlobal)
PlayerClass.Login(player, password, dbGlobal)

*dbGlobal is an SQLite or MySQL database pointer. Refer to the sample script (main.nut) for further information.



If you found any bugs, feel free to post it and I will try to fix as soon as possible.

Happy coding!
Title: Re: Fuzzie's Account System v3
Post by: BigcaT_ on Jan 24, 2015, 10:16 AM
:D
Title: Re: Fuzzie's Account System v3
Post by: Sebastian on Jan 24, 2015, 10:24 AM
Sounds'n'looks good at a first view. Good job ;)
Title: Re: Fuzzie's Account System v3
Post by: Fuzzie on Jan 24, 2015, 12:37 PM
Thanks. I have definitely spotted a few places where I can improve it but that will come in the next version which will probably be a few months away depending on how well this one is.
Title: Re: Fuzzie's Account System v3
Post by: MatheuS on Jan 24, 2015, 10:43 PM
Nice :)
Title: Re: Fuzzie's Account System v3
Post by: PsyChO_KiLLeR on Feb 28, 2015, 04:13 AM
GETTING ERROR Here
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi61.tinypic.com%2F723q5z.png&hash=c08772d94986bf65139aa93327ee86d68aef02e1)

My pic uploader software not working so i give here lines


 this is of fas_v3_sqlite line 56

::QuerySQL( dbGlobal, "INSERT INTO Accounts VALUES('" + player.Name + "', '" + player.Name.tolower() + "', '" + ::SHA256( password ) + "', 0, 0, 0, 0, 1, '" + player.IP + "')" ); 





and error here
this is line of main.nut 156
   pstats[ player.ID ].Register( player, text, sqliteDB );
Title: Re: Fuzzie's Account System v3
Post by: . on Feb 28, 2015, 04:15 AM
As usual you forgot the required modules (https://bitbucket.org/stormeus/0.4-hashing-algorithms/downloads).
Title: Re: Fuzzie's Account System v3
Post by: PsyChO_KiLLeR on Feb 28, 2015, 04:20 AM
oh thank u so much slc
my problem solve
Title: Re: Fuzzie's Account System v3
Post by: Kratos_ on Feb 28, 2015, 05:54 AM
Quote from: Squirrel Master on Feb 28, 2015, 04:13 AM::QuerySQL( dbGlobal, "INSERT INTO Accounts VALUES('" + player.Name + "', '" + player.Name.tolower() + "', '" + ::SHA256( password ) + "', 0, 0, 0, 0, 1, '" + player.IP + "')" ); 


Considering high-end cryptographic security, WHIRLPOOL is preferred over SHA256 . If the scripts are being updated to the newer 0.4 version then people should utilize the more secure hashing algorithm available to them as well.
Title: Re: Fuzzie's Account System v3
Post by: . on Feb 28, 2015, 06:00 AM
Quote from: Kratos_ on Feb 28, 2015, 05:54 AMConsidering high-end cryptographic security, WHIRLPOOL is preferred over SHA256 . If the scripts are being updated to the newer 0.4 version then people should utilize the more secure hashing algorithm available to them as well.

Also consider using a salt if we're on the subject of security :)
Title: Re: Fuzzie's Account System v3
Post by: Kratos_ on Feb 28, 2015, 06:11 AM
Quote from: S.L.C on Feb 28, 2015, 06:00 AMAlso consider using a salt if we're on the subject of security :)

Yes. A hashing algorithm ( WHIRLPOOL ) with a random salt combination will be secure enough, at least in VC:MP. :)
Title: Re: Fuzzie's Account System v3
Post by: Ksna on Jul 11, 2015, 07:41 AM
Sorry for bump
Thanks Fuzzie ,
When a registered player join , he is able to register again if he is not automatically logged in.

Fixed Code
if( cmd == "register" ){
if( !text ){
MessagePlayer( "Syntax Error!", player );
MessagePlayer( "Correct syntax: /register <password>", player );
}
else if( pstats[ player.ID ].Level != 0 )MessagePlayer( " This account is already Registered", player );
else if( pstats[ player.ID ].Logged == true ){
MessagePlayer( "You are already logged in.", player );
}
else{
pstats[ player.ID ].Register( player, text, sqliteDB );
}
}

Title: Re: Fuzzie's Account System v3
Post by: MacTavish on Jul 11, 2015, 07:44 AM
Quote from: Ksna on Jul 11, 2015, 07:41 AMSorry for bump
Thanks Fuzzie ,
When a registered player join , he is able to register again if he is not automatically logged in.
if( cmd == "register" ){
if( !text ){
MessagePlayer( "Syntax Error!", player );
MessagePlayer( "Correct syntax: /register <password>", player );
}
else if( pstats[ player.ID ].Level != 0 )MessagePlayer( " This account is already Registered", player );
else if( pstats[ player.ID ].Logged == true ){
MessagePlayer( "You are already logged in.", player );
}
else{
pstats[ player.ID ].Register( player, text, sqliteDB );
}
}

Because table isnt created in database
Title: Re: Fuzzie's Account System v3
Post by: Ksna on Jul 11, 2015, 08:03 AM
Quote from: Beztone on Jul 11, 2015, 07:44 AMBecause table isnt created in database
I  just showed a bug  and how to fix... and i said if player is not automatically logged.
Title: Re: Fuzzie's Account System v3
Post by: [VSS]Shawn on Jul 11, 2015, 08:29 AM
You Might Modify That System
Title: Re: Fuzzie's Account System v3
Post by: MacTavish on Jul 11, 2015, 08:41 AM
Quote from: Ksna on Jul 11, 2015, 08:03 AM
Quote from: Beztone on Jul 11, 2015, 07:44 AMBecause table isnt created in database
I  just showed a bug  and how to fix... and i said if player is not automatically logged.
i am using the same system and it happend to me also the i saw that i didnt create the table please ensure the table is created in db
Title: Re: Fuzzie's Account System v3
Post by: Ksna on Jul 13, 2015, 03:46 PM
You have not understood what i mean..
Tables are created but he is able to login and register again if he comes from another ip


Recheck:
1.  Register your name using /register password then table will be created in database
2.  remove this else if( LastUsedIP == player.IP ){
Logged = true;
player.Cash = stats[ player.ID ].Cash;
::MessagePlayer( "Welcome back!", player );
}
from function join(player) . so that next time you enter server you will not auto login.
3. now when you join server it will ask you to login  but dont login this time do /register password again and this will make another table for same name.

Check in ADM too it happens same

and putting this else if( stats[ player.ID ].Level != 0 ) MessagePlayer( "You are already Registered.", player );
in register fix this.
Title: Re: Fuzzie's Account System v3
Post by: DizzasTeR on Jul 13, 2015, 05:34 PM
I've been using this system and I never encountered such thing, its not bugged, you guys are doing something wrong.
Title: Re: Fuzzie's Account System v3
Post by: Ksna on Jul 14, 2015, 04:52 AM
https://www.youtube.com/watch?v=WgYkXPHQlbg&feature=youtu.be

Doom you have modified your script .. so you didn't got this ..
Title: Re: Fuzzie's Account System v3
Post by: FarisDon on Jul 14, 2015, 05:25 AM
Quote from: Ksna on Jul 14, 2015, 04:52 AMhttps://www.youtube.com/watch?v=WgYkXPHQlbg&feature=youtu.be

Doom you have modified your script .. so you didn't got this ..
Ksna had you added classes?
Title: Re: Fuzzie's Account System v3
Post by: Ksna on Jul 15, 2015, 11:15 AM
Yes.....
Title: Re: Fuzzie's Account System v3
Post by: FarisDon on Jul 15, 2015, 12:01 PM
The only New thing which was the best for us was the security you don't need to copy the full code ._.
Title: Re: Fuzzie's Account System v3
Post by: Fuzzie on Aug 16, 2015, 12:21 PM
Quote from: Ksna on Jul 11, 2015, 07:41 AMSorry for bump
Thanks Fuzzie ,
When a registered player join , he is able to register again if he is not automatically logged in.
Sorry for the late reply. Thanks for the fix but the /register command and the files associated with it in the Sample Script folder are just a sample script and was not part of the main file in the first place. I wasn't expecting anyone to use the sample script as part of their script, hence the reason why I didn't bothered doing a full bug check.
Title: Re: Fuzzie's Account System v3
Post by: KAKAN on Aug 17, 2015, 11:59 AM
Okay SO, now edit it, register bug and another bug, which would not let u create the account table on the database
P.S- I love your scripts
Title: Re: Fuzzie's Account System v3
Post by: kennedyarz on Mar 24, 2016, 01:36 AM
error
Title: Re: Fuzzie's Account System v3
Post by: W3aPoN^ on Jul 09, 2016, 08:08 AM
I Don't Understand Please Can You MAKE A Full Video/Picture Tutorial About This
Title: Re: Fuzzie's Account System v3
Post by: W3aPoN^ on Aug 01, 2016, 03:59 PM
Bro This Is Not Working On My Server I Downloaded The Modules I am using Windows 10 x64 Bit So I Downloaded It With hashing64, SQLite64, Squirel64
Title: Re: Fuzzie's Account System v3
Post by: Thijn on Aug 01, 2016, 04:14 PM
Please make a new topic in the appropriate board if you need specific help.
Title: Re: Fuzzie's Account System v3
Post by: Shovon^ on Sep 16, 2016, 10:55 AM
;D AWESOME ACCOUNT SYSYEM!!!
iam using it for my server.....
Title: Re: Fuzzie's Account System v3
Post by: . on Sep 16, 2016, 10:58 AM
Quote from: Shovon^ on Sep 16, 2016, 10:55 AM;D AWESOME ACCOUNT SYSYEM!!!
iam using it for my server.....

There's a like button you know.
Title: Re: Fuzzie's Account System v3
Post by: Shovon^ on Sep 16, 2016, 11:12 AM
ohh thnx for telling ...