SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 13/03/2010, 01:12 AM   #1
Carlton
Gangsta
 
Carlton's Avatar
 
Join Date: Mar 2010
Posts: 687
Reputation: 4
Default [MySQL] Advanced Registration System

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
Carlton is offline   Reply With Quote
Old 13/03/2010, 11:46 AM   #3
[MWR]Blood
High-roller
 
Join Date: Apr 2009
Posts: 2,268
Reputation: 105
Default Re: [MySQL] Advanced Registration System

Nice, but dont bump
__________________
[MWR]Blood is offline   Reply With Quote
Old 13/03/2010, 04:32 PM   #4
Calgon
Banned
 
Join Date: Jan 2009
Posts: 6,129
Reputation: 1127
Default Re: [MySQL] Advanced Registration System

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?
Calgon is offline   Reply With Quote
Old 13/03/2010, 04:42 PM   #5
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: [MySQL] Advanced Registration System

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
Joe Staff is offline   Reply With Quote
Old 13/03/2010, 07:23 PM   #6
Carlton
Gangsta
 
Carlton's Avatar
 
Join Date: Mar 2010
Posts: 687
Reputation: 4
Default Re: [MySQL] Advanced Registration System

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
Carlton is offline   Reply With Quote
Old 15/03/2010, 02:38 AM   #7
Kyosaur
Gangsta
 
Kyosaur's Avatar
 
Join Date: Mar 2008
Location: USA - California
Posts: 973
Reputation: 349
Default Re: [MySQL] Advanced Registration System

EDIT: Nvm.
Kyosaur is offline   Reply With Quote
Old 18/03/2010, 04:35 PM   #8
[03]Garsino
Guest
 
Posts: n/a
Default Re: [MySQL] Advanced Registration System

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 With Quote
Old 18/03/2010, 07:38 PM   #9
Carlton
Gangsta
 
Carlton's Avatar
 
Join Date: Mar 2010
Posts: 687
Reputation: 4
Default Re: [MySQL] Advanced Registration System

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.
Carlton is offline   Reply With Quote
Old 20/03/2010, 12:15 AM   #10
acade
Huge Clucker
 
Join Date: Mar 2008
Posts: 446
Reputation: 8
Default Re: [MySQL] Advanced Registration System

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;
}
__________________
+REP if you think I helped you out - Thanks
acade is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [FS] torran's Registration System v3.1 NewTorran Filterscripts 66 22/08/2011 09:27 AM
[HELP] Registration System [SOLVED] park4bmx Help Archive 4 28/04/2010 07:04 PM
Admin System WITHOUT registration system steven_italy Help Archive 9 09/06/2009 09:22 PM
registration, and system bug My_Waffles_Bitch_L0L Help Archive 4 18/02/2009 07:10 PM


All times are GMT. The time now is 07:44 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.