[MySQL] Advanced Registration System
#1

If you don't know me yet, here's a quote from my old release located at: http://forum.sa-mp.com/index.php?topic=157771.0'
Quote:

Some of you have seen me on the forums so far, i'm pretty much new to scripting, I'm a c++ coder and a PHP coder, so PAWN is easier for me atm. I noticed people were releasing scripts here, and I thought, why not make something that isn't in SA-MP, like the teargas feature, so I simply, went into Pawno, and did my thing.

Recently, I've been studying more of PAWN and the functions available at http://www.wiki.sa-mp.com. I came across a mysql plugin and was interested in using it for a future release. So I made a advanced registration system. Some features are found below:
  • 100% MySQL.
  • Easily editable - You can edit the messages easily and mysql info.
  • Toggle Autologin - You can toggle autologin on, or off.
  • Force login - You are able to toggle force login on or off, ( used for RP server )
  • Force login dialogs
  • Easy to edit registration and login system.
  • Saves: money, health, armour, adminlevel, bank

In my opinion, I think whoever that is interested into this, that you use this as a base registration system, because of the adminlevel and bank etc. The codes below is a example how to edit the register and login messages. This is a premade example that's already included.

pawn Code:
function OnPlayerLogin(playerid) {
  // In this function you can make a user forcespawn. This is called after someone logged in..
      GivePlayerMoney(playerid, PlayerAccount[playerid][Money]);
      SetPlayerHealth(playerid, PlayerAccount[playerid][Health]);
  SetPlayerHealth(playerid, PlayerAccount[playerid][Armour]);
      AccountData[playerid][Logged] = true;
}
pawn Code:
function OnPlayerRegister(playerid) {
  // In this function you can make a user forcespawn. This is called after someone registered.
 
  AccountData[playerid][Account] = true;
  #if defined Force_Login
      {
    ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Enter your password below:","Login","Cancel"); }
      #endif
}
I know alot of users will have trouble with the query installation for PHPMyAdmin or something similar, the code is below, just simply insert it into your database.

Code:
CREATE TABLE IF NOT EXISTS `YOUR TABLE NAME!` (
 `Name` text NOT NULL,
 `Password` text NOT NULL,
 `IP` text NOT NULL,
 `Money` int(20) NOT NULL,
 `AdminLevel` int(20) NOT NULL,
 `Health` float NOT NULL,
 `Armour` float NOT NULL,
 `Bank` int(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
I would like to give some credits/props to some people who helped me make this.

Seif: The function define.
pawn Code:
#define function%0(%1) stock%0(%1)
ZeeX Zcmd.

If you get some errors, for example:
pawn Code:
fatal error 100: cannot read from file: "zcmd"
or something similar the download includes are below also.

MySQL include: http://forum.sa-mp.com/index.php?topic=79352.0
Zcmd include: http://forum.sa-mp.com/index.php?topic=116240.0
Script download: http://pastebin.com/eT0xTThB

Enjoy :P
Reply
#2

Yikes, any comments?
Reply
#3

Nice, but dont bump
Reply
#4

Pretty good code, better than mine and utilities more features. Though I'm pretty sure the maximum size for an IP is 32 cells not 30?
Reply
#5

Quote:
Originally Posted by FreddoX [BINMAN
]
Pretty good code, better than mine and utilities more features. Though I'm pretty sure the maximum size for an IP is 32 cells not 30?
How often do you see 32 celled IPs?

255.255.255.255 = 15 character count, so cell count should be 16
Reply
#6

Well before a arguments starts about the string size of the IP, I did honestly ignore what wiki said that the recommended size is 16. Also thanks FreddoX
Reply
#7

EDIT: Nvm.
Reply
#8

Code:
GarAdmin_MySql.pwn(4003) : error 017: undefined symbol "mysql_reconnect"
Line 4003:
pawn Code:
if(mysql_ping(RegistrationSystemConnection) == -1) return mysql_reconnect(RegistrationSystemConnection);
Reply
#9

Quote:
Originally Posted by [03
Garsino ]
Code:
GarAdmin_MySql.pwn(4003) : error 017: undefined symbol "mysql_reconnect"
Line 4003:
pawn Code:
if(mysql_ping(RegistrationSystemConnection) == -1) return mysql_reconnect(RegistrationSystemConnection);
Use G-sTyLeZzZ's include. If you're still getting the error, update it to RC3.
Reply
#10

Nice tutorial, Noticed an error:

pawn Code:
function OnPlayerLogin(playerid) {
  // In this function you can make a user forcespawn. This is called after someone logged in..
  GivePlayerMoney(playerid, PlayerAccount[playerid][Money]);
  SetPlayerHealth(playerid, PlayerAccount[playerid][Health]);
  SetPlayerHealth(playerid, PlayerAccount[playerid][Armour]);
  AccountData[playerid][Logged] = true;
}
Should be
pawn Code:
function OnPlayerLogin(playerid) {
  // In this function you can make a user forcespawn. This is called after someone logged in..
  GivePlayerMoney(playerid, PlayerAccount[playerid][Money]);
  SetPlayerHealth(playerid, PlayerAccount[playerid][Health]);
  SetPlayerArmour(playerid, PlayerAccount[playerid][Armour]);
  AccountData[playerid][Logged] = true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)