SA-MP Forums Archive
[MySQL] Advanced Registration System - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [MySQL] Advanced Registration System (/showthread.php?tid=133571)



[MySQL] Advanced Registration System - Carlton - 13.03.2010

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:

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


Re: [MySQL] Advanced Registration System - Carlton - 13.03.2010

Yikes, any comments?


Re: [MySQL] Advanced Registration System - [MWR]Blood - 13.03.2010

Nice, but dont bump


Re: [MySQL] Advanced Registration System - Calgon - 13.03.2010

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?


Re: [MySQL] Advanced Registration System - Joe Staff - 13.03.2010

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


Re: [MySQL] Advanced Registration System - Carlton - 13.03.2010

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


Re: [MySQL] Advanced Registration System - Kyosaur - 15.03.2010

EDIT: Nvm.


Re: [MySQL] Advanced Registration System - [03]Garsino - 18.03.2010

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



Re: [MySQL] Advanced Registration System - Carlton - 18.03.2010

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.


Re: [MySQL] Advanced Registration System - acade - 20.03.2010

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;
}