[GameMode] [Release] MySQL Base (BSQL) [Development]
#1

Hello everbody!


From BSRP
Today I present: The gamemode BSQL as:
Blank Structured Query Language
A MySQL base script
Script made for RolePlay/FR/Stunt
Encrypted player password with md5

Exactly: 250 lines (with lines of information that you can remove)
Time spent in script: 2 hours 30 minutes
Next version will have vehicles

Details:
  1. Login/Register in Dialog
  2. Includes organized to create tables with only start the GameMode
  3. Save/Load Accounts system
  4. Encryptation of the Player Password with md5 (Reference:#2348)
  5. Verifies if a player is Registered before to spawn
ChangeLog:
  1. (June/28/2014) v0.1: Gamemode base Player: Register/Login Save/Load finished.
Requirements:
  1. Before of use:
    • MySQL knowledge
    • Keep credits at least in the script
    • A host server EX: Wamp or Xampp
    • Create a database in phpmyadmin
    • Set the database name in the script (change the user/password) if is localhost leave as is 127.0.0.1
  2. Includes needed:
    • a_samp
    • CreateUT forward UserStats (Located in includes in the folders 'CTABLES" and "ITABLES" respectively)
    • sscanf2
    • zcmd
  3. Plugins needed:
    • mysql (.dll for windows or .so for linux)
    • sscanf (.dll for windows or .so for linux)
Manual [You must READ this]

This gamemode has a internal path in the includes where gets the information to setuptables and get the player variables to the database
  • Inside of the file CreateUT.inc where the callback has some lines with this: mysql_query("ALTER TABLE "@TABLEUSERS" ADD "@P_Staff" INT(20) NOT NULL");
    @TABLEUSERS is for add the information (in this case) @P_Staff with Intenger of 20 characters long and the row will not be NULL.
    You may can edit/add/remove files in any moment the information @P_Staff come from the include /ITABLES/UserStats.inc (You may can edit/add/remove things from here
  • If you want to add for example a Key for a car (roleplay servers)
    • 1) Step: You need to define the information in the include /ITABLES/UserStats.inc #define @P_CarKey "Automobile1" in the bottom
    • 2) Step: You need to add now the information to /CTABLES/CreateUT.inc like the previously example
    • 3) Step: The definition must look like this: mysql_query("ALTER TABLE "@TABLEUSERS" ADD "@P_CarKey" INT(20) NOT NULL"); New information must be added in the last.
    • 4) Step: Now you have set and saved the includes go to the script in the enumerator pInfo add in the last (for example) the variable Auto_1
    • 5) Step: To save the Key of a car in the user's account go to the stock SavePlayerAccount and you have add to something like this in the last:
      pawn Код:
      format(Buffer, sizeof(Buffer), "UPDATE "@TABLEUSERS" SET "@P_CarKey"='%d' WHERE "@USQLID" ='%d'",
      PlayerInfo[playerid][Auto_1],PlayerInfo[playerid][pSQLID]);
      mysql_query(Buffer);
    • 6) Step To load the Key of the car when a player connects go to the stock LoadPlayerAccount and you have to add the new variable
      pawn Код:
      if (row == 9)   PlayerInfo[playerid][pMoney] = strval(Field);//this get money of the player
      //if the last row is 9 now the next will be the 10 and thus continuously. You have to add this;
      if (row == 10)  PlayerInfo[playerid][Auto_1] = strval(Field);//this get Key of the car that has the player
References:
Reference 2348: їWhat is MD5?:
This kind of encrypt has been utilized in a wide variety of cryptographic applications, and is also commonly used to verify data integrity.
Reference 3487: Set the database name in the script: In the gamemode script look for a #define SQL_DB "here put the name of your db"

FAQ:
  1. їHow do I start this gamemode? First at all you need to have installed and running the host server previously required (Wamp or Xamp).
  2. їWhy the console closes immediately? Go and open server.cfg and change the password (Default: changeme).
  3. їWhy appear this in console [gamemodes/mysql.amx]: Run time error 19: "File or function is not found"?
    May you do not have the two plugins [sscanf.dll and mysql.dll or .so] (accord to your system) in the folder /plugins.
  4. їHow do I create a database in phpmyadmin? Go to http://127.0.0.1/phpmyadmin/ Click in "databases" later in the Create database in the field put (example: samp) samp will be the name of your database select collation and create later set this name in the script (Reference:#3487)
Gamemode Download:
Resources:
  1. SA-MP Server 0.3z R2-2 (By SA-MP Team)
  2. sscanf Include/Plugin (By ******)
  3. MySQL Include/Plugin (By BlueG)
  4. Include zcmd (By Zeex)
ScreenShots




Credits:
Kalcor
Jex_Lafer (Dev Script)
BlueG (MySQL Plugin/Include)
****** (sscanf2 Plugin/Include)
Zeex (zcmd Include)
Reply
#2

Never decrypt your passwords in blank MD5, always add a salt to it!
Reply
#3

"Encrypted player password with md5"

One of the worst hash. I wouldn't even call it a hash.

"BlueG's R5 plugin"

Really old plugin and quite outdated. You should go for threaded queries with cache or orm functions (latest release is R39-2)
Reply
#4

Dead Link, plz ? :3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)