[GameMode] Very Basic Script
#1

  • Base Login/Register Gamemode


This is just a basic script, which was requested by one of my friends to be made, so I am releasing it here. This script uses MySQL R41-4 and BCrypt for hashing passwords. I dont think there are any base scripts on forums which uses BCrypt as example(At least I dont know if there are any), Which is why I decided to release it for all the people, so that they can know how login/register system is made using MySQL and simple dialogs and also, how to use BCrypt.

  • Features

  • Based on MySQL.
  • Login and Register using normal dialogs.
  • BCrypt Hashing so its very much secure.
  • Saves user's info upon disconnect and loads it on connect. Incl. Positions.
  • Very easy and straight forward scripting.




  • Requirements

  • BlueG's MySQL R41-4
  • BCrypt Plugin and Include
  • MySQL Server installed


  • Screenshots & Downloads

Credits to the creators of above specified plugins and includes.
This script was created for beginners and therefore help will be provided by me ONLY if you provide proper details of error/problem you are having and you must show me what did you try to solve it on your behalf. The script shouldn't have any bugs, but if there are tell me down there.
Reply
#2

Nice
Reply
#3

Pretty much basic and Nice for newbies.

+REP
Reply
#4

Good job will help for some beginners
Reply
#5

Thank you for the compliments. The main reason to release this was to spread knowledge about bcrypt in beginners snd even old school scripters.. Ill be here if anyone needs my help.
Reply
#6

@GTLS

There are few warnings of "TAG MISMATCH"

for example:

Code:
if(rows) ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "This account is found on your database. Please login", "Login", "Quit");
Reply
#7

Quote:
Originally Posted by ZigGamerx
View Post
@GTLS

There are few warnings of "TAG MISMATCH"

for example:

Code:
if(rows) ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "This account is found on your database. Please login", "Login", "Quit");
Oh sorry, I uploaded the wrong pawn file. The solution is easy though.

remove the enum name of dialog ids and it will be fixed. I have uploaded the fixed pwn file over github.

PHP Code:
//change  on line 15
 
enum DIALOG_IDs
//to
enum 
Reply
#8

Nice bro. Rated 5 Stars.
Reply
#9

GTLS You dont becouse you never visited forum very often
Quote:

I dont think there are any base scripts on forums which uses BCrypt as example(At least I dont know if there are any)

check Solstice_s page he made one with both bCrypt and Whirlpool

Bcrypt concept
Reply
#10

Not really helpful. I wouldn't recommend this to anyone, especially if they're just learning.
Reply
#11

What's the problem though?
Reply
#12

Perfect for people who are learning to script!
Reply
#13

Quote:
Originally Posted by Mobtiesgangsa
View Post
GTLS You dont becouse you never visited forum very often

check Solstice_s page he made one with both bCrypt and Whirlpool

Bcrypt concept
Wow you know more about me than me.. haha anyways, thanks for pointing out that for me.

Quote:
Originally Posted by kukboy
View Post
Very helpful for beginners.
Quote:
Originally Posted by Josh_Main
View Post
Perfect for people who are learning to script!
Thank you

Quote:
Originally Posted by Kane
View Post
Not really helpful. I wouldn't recommend this to anyone, especially if they're just learning.
Quote:
Originally Posted by kukboy
View Post
What's the problem though?
Exactly? I havent use any kind of complicated logic in the script which would confuse first timers..
Reply
#14

Good script, thanks.
Reply
#15

can you send github me?

Quote:

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.DL-R1, ©2005-2018 SA-MP Team

[20:12:05] filterscripts = "" (string)
[20:12:05]
[20:12:05] Server Plugins
[20:12:05] --------------
[20:12:05] Loading plugin: mysql
[20:12:05] >> plugin.mysql: R41-4 successfully loaded.
[20:12:05] Loaded.
[20:12:05] Loaded 1 plugins.

[20:12:05]
[20:12:05] Filterscripts
[20:12:05] ---------------
[20:12:05] Loaded 0 filterscripts.

[20:12:05] Script[gamemodes/lsc.amx]: Run time error 19: "File or function is not found"
[20:12:05] Number of vehicle models: 0

Reply
#16

Quote:
Originally Posted by sonn51280
View Post
can you send github me?
Yo brother, use native checker plugin and then restart the server with it, then post the logs here.
Reply
#17

Quote:
Originally Posted by sonn51280
View Post
can you send github me?
Check the releases on the github. I had shared a zip with all binaries required for the script.

Problem you have is you are missing plugin bcrypt-samp. Either download it from forums or download zip from releases tab on github.s
Reply
#18

Quote:
Originally Posted by Kane
View Post
Not really helpful. I wouldn't recommend this to anyone, especially if they're just learning.
LOL you dont know how to appreciate good work.. Good work GTLS
Reply
#19

Quote:
Originally Posted by Kane
View Post
Not really helpful. I wouldn't recommend this to anyone, especially if they're just learning.
This is a very basic script, this is more easy for newbies to learn MySQL easily. Who cares if you are a good scripter, learn to respect other works.

No Hate!! Just Truth.

Good work GTLS.
Reply
#20

Quote:
Originally Posted by ZigGamerx
View Post
This is a very basic script, this is more easy for newbies to learn MySQL easily. Who cares if you are a good scripter, learn to respect other works.

No Hate!! Just Truth.

Good work GTLS.
Kane was right, if you had read the whole script, you could have spotted some issues.

Mysql connection wasn't close at OnGameModeExit.
Player Name is stored in database but no idea why it was not used in script instead using GetPlayerName everytime!
`Users` and `USERS` should be `users` in onplayerconnect and OnPlayerDisconnect callback!


There is no need to login after the player register. It can be done by
pawn Code:
forward OnPlayerRegister(playerid);
public OnPlayerRegister(playerid)
{
         pInfo[playerid][MasterID] = cache_insert_id();
         pInfo[playerid][PX] = 1527.85;
         pInfo[playerid][PY] = -1675.35;
         pInfo[playerid][PZ] = 13.3828;
         pInfo[playerid][ROOT] = 270;
         pInfo[playerid][Skin] = 1;
         pInfo[playerid][Level] = 1;
    SetPlayerScore(playerid, pInfo[playerid][Level]);
    SetSpawnInfo(playerid, 0, pInfo[playerid][Skin], pInfo[playerid][PX], pInfo[playerid][PY], pInfo[playerid]
        [PZ],pInfo[playerid][Rot], 0, 0, 0, 0, 0, 0);
    SendClientMessage(playerid, 0x0033FFFF /*Blue*/, "Thank you for registering! You will be spawned now!");
    TogglePlayerSpectating(playerid, false);
    TogglePlayerControllable(playerid, true);
        SpawnPlayer(playerid);
    return 1;
}
And the last thing is , No Login detection was checked when player disconnect and no player variable for login check is defined.
When player disconnect, you should check if player logged in (after login/register) , so the data will be saved in mysql.
What if a player logins with an another player name and exist the server (Calls OnPlayerDisconnect)? or what if a player mistype his password and kicked out?
It will save the player's current position and will be stored into the database under the player name. So, that's why the script needs a login variable.

Anyways Good work!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)