SA-MP Forums Archive
[GameMode] Very Basic 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] Very Basic Script (/showthread.php?tid=668165)

Pages: 1 2


Very Basic Script - GTLS - 23.07.2019

  • 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.



Re: Very Basic Script - N4Sti - 23.07.2019

Nice


Re: Very Basic Script - ZigGamerx - 23.07.2019

Pretty much basic and Nice for newbies.

+REP


Re: Very Basic Script - NeXTGoD - 23.07.2019

Good job will help for some beginners


Re: Very Basic Script - GTLS - 24.07.2019

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.


Re: Very Basic Script - ZigGamerx - 24.07.2019

@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");



Re: Very Basic Script - GTLS - 24.07.2019

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 



Re: Very Basic Script - GeorgeMcReary - 24.07.2019

Nice bro. Rated 5 Stars.


Re: Very Basic Script - Mobtiesgangsa - 24.07.2019

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


Re: Very Basic Script - Kane - 24.07.2019

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


Re: Very Basic Script - kukboy - 24.07.2019

What's the problem though?


Re: Very Basic Script - Josh_Main - 25.07.2019

Perfect for people who are learning to script!


Re: Very Basic Script - GTLS - 25.07.2019

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


Re: Very Basic Script - Huemerson - 25.07.2019

Good script, thanks.


Re: Very Basic Script - sonn51280 - 25.07.2019

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




Re: Very Basic Script - ZigGamerx - 25.07.2019

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.


Re: Very Basic Script - GTLS - 27.07.2019

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


Re: Very Basic Script - PhantomThief1412 - 04.08.2019

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


Re: Very Basic Script - ZigGamerx - 04.08.2019

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.


Re: Very Basic Script - SiaReyes - 05.08.2019

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!