SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 18/07/2010, 08:12 PM   #11
WackoX
Guest
 
Posts: n/a
Default Re: Easy MySQL Register/Login system!

Quote:
Originally Posted by [HiC]TheKiller View Post
A few things that I suggest:

1. Instead of using a enum just use PVars for all of them.
2. Use Sscanf
3. Use dialogs
4. Please explain some of it using comments
5. Did you just copy and paste this from a script?
1. People can change it to whatever they want, and BTW if a standard value has to be like 255 for a house system or something, it reset's it automatically to 0 when a player disconnect, result: bugged house system.

And another way, i don't like the way of pVars:

* They reset automatically when i DON'T want to.
* You cannot use things like Text3D and other stuff in them, result: 2 different ways of saving for 1 system.
* They use less RAM, but take up more CPU.

2. Why? i don't use any parameters at the dcmd part, there's no need for.
3. Like i already said, people can modify whatever they want, and the title says EASY System.
4.
5. Yes, from my own created script, but edited it for the tutorial.
  Reply With Quote
Old 19/07/2010, 06:28 AM   #12
[HiC]TheKiller
High-roller
 
Join Date: Mar 2008
Location: New Zealand
Posts: 3,038
Reputation: 407
Default Re: Easy MySQL Register/Login system!

Quote:
Originally Posted by WackoX View Post
1. People can change it to whatever they want, and BTW if a standard value has to be like 255 for a house system or something, it reset's it automatically to 0 when a player disconnect, result: bugged house system.

And another way, i don't like the way of pVars:

* They reset automatically when i DON'T want to.
* You cannot use things like Text3D and other stuff in them, result: 2 different ways of saving for 1 system.
* They use less RAM, but take up more CPU.

2. Why? i don't use any parameters at the dcmd part, there's no need for.
3. Like i already said, people can modify whatever they want, and the title says EASY System.
4.
5. Yes, from my own created script, but edited it for the tutorial.
Well, to put it this way, all I see is just code. You haven't explained any part of the script in comments hence it not really being much of a tutorial.
__________________
[HiC]TheKiller is offline   Reply With Quote
Old 19/07/2010, 06:35 AM   #13
RealCop228
Godfather
 
Join Date: Feb 2010
Location: Springboro, OH
Posts: 8,160
Reputation: 685
Default Re: Easy MySQL Register/Login system!

Yeah, I was confused about what was happening in this tutorial. It wasn't explained well, it seems like a bunch of images, rather than explanations. Once MySQL is setup, I am able to create stuff, but I always have a hard time setting it up from scratch, so I think its time to learn.

Last edited by RealCop228; 21/07/2010 at 07:16 AM.
RealCop228 is offline   Reply With Quote
Old 21/07/2010, 11:17 AM   #14
Яσскѕтая
Big Clucker
 
Яσскѕтая's Avatar
 
Join Date: Jul 2010
Posts: 111
Reputation: 2
Default Re: Easy MySQL Register/Login system!

For some reason I was already registered and when I browse the structures in PHPMyAdmin theres nothing there...

EDIT: My MySQL database was a little funny, but now when I try to execute it I get a error:
Code:
CREATE TABLE(
  `Name` varchar(24) collate utf8_unicode_ci NOT NULL,
  `Password` varchar(32) collate utf8_unicode_ci NOT NULL,
  `Admin` int(1) NOT NULL,
  `Money` int(8) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
EDIT2: Forgot to put the Users on create table, but it still is saying im registered.
Яσскѕтая is offline   Reply With Quote
Old 21/07/2010, 02:31 PM   #15
Gforcez1337
Gangsta
 
Gforcez1337's Avatar
 
Join Date: Jul 2010
Location: The Netherlands.
Posts: 941
Reputation: 290
Default Re: Easy MySQL Register/Login system!

Thanks Wackox! =D
Gforcez1337 is online now   Reply With Quote
Old 31/07/2010, 10:07 PM   #16
Luis_Leone
Big Clucker
 
Join Date: Jul 2010
Location: England
Posts: 51
Reputation: 0
Default Re: Easy MySQL Register/Login system!

I am getting these Errors,
Code:
C:\Users\BooNii3\Geramia RP\LS-RP\gamemodes\LS-RP.pwn(73) : error 021: symbol already defined: "main"
C:\Users\BooNii3\Geramia RP\LS-RP\gamemodes\LS-RP.pwn(82) : error 021: symbol already defined: "OnGameModeInit"
C:\Users\BooNii3\Geramia RP\LS-RP\gamemodes\LS-RP.pwn(91) : error 021: symbol already defined: "OnGameModeExit"
C:\Users\BooNii3\Geramia RP\LS-RP\gamemodes\LS-RP.pwn(96) : error 021: symbol already defined: "OnPlayerRequestClass"
C:\Users\BooNii3\Geramia RP\LS-RP\gamemodes\LS-RP.pwn(147) : error 021: symbol already defined: "OnPlayerCommandText"
C:\Users\BooNii3\Geramia RP\LS-RP\gamemodes\LS-RP.pwn(164) : error 010: invalid function or declaration
__________________
It has been nice here, I loved helping you all and I love the fact I was apart of a great community, I maybe back in the near future also I am sorry for what I did if I was to get unbanned on my main account I would not post another stupid thing like that. I hope you accept my apologies.

If you have unbanned me on my -Luis account can you send me an Email at Luisiscool@hotmail.co.uk.

Regards, -Luis
Luis_Leone is offline   Reply With Quote
Old 02/08/2010, 04:44 PM   #17
WackoX
Guest
 
Posts: n/a
Default Re: Easy MySQL Register/Login system!

Quote:
Originally Posted by Luis_Leone View Post
I am getting these Errors,
Code:
C:\Users\BooNii3\Geramia RP\LS-RP\gamemodes\LS-RP.pwn(73) : error 021: symbol already defined: "main"
C:\Users\BooNii3\Geramia RP\LS-RP\gamemodes\LS-RP.pwn(82) : error 021: symbol already defined: "OnGameModeInit"
C:\Users\BooNii3\Geramia RP\LS-RP\gamemodes\LS-RP.pwn(91) : error 021: symbol already defined: "OnGameModeExit"
C:\Users\BooNii3\Geramia RP\LS-RP\gamemodes\LS-RP.pwn(96) : error 021: symbol already defined: "OnPlayerRequestClass"
C:\Users\BooNii3\Geramia RP\LS-RP\gamemodes\LS-RP.pwn(147) : error 021: symbol already defined: "OnPlayerCommandText"
C:\Users\BooNii3\Geramia RP\LS-RP\gamemodes\LS-RP.pwn(164) : error 010: invalid function or declaration
You only need to add those functions if they do not exist, if they do then 'add' the code inside of it.
  Reply With Quote
Old 03/08/2010, 04:41 AM   #18
RealLifeRP
Little Clucker
 
Join Date: Jul 2010
Posts: 5
Reputation: 0
Default Re: Easy MySQL Register/Login system!

nevermind

Last edited by RealLifeRP; 03/08/2010 at 05:42 AM.
RealLifeRP is offline   Reply With Quote
Old 03/08/2010, 12:37 PM   #19
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,845
Reputation: 2567
Default Re: Easy MySQL Register/Login system!

I'd rather add an SQL ID in the database as well. This should be the first value in the table and should be set as Primary Key and Auto-increment.

You can then retrieve this value when someone registers (mysql_insert_id) and assign it to a variable. You can then use this value to execute future queries on the database without retrieving the player's name every time.

And you can use sscanf instead of explode to split rows into the data you need, as TheKiller already suggested.
__________________
Vince is offline   Reply With Quote
Old 03/08/2010, 05:16 PM   #20
WackoX
Guest
 
Posts: n/a
Default Re: Easy MySQL Register/Login system!

Quote:
Originally Posted by Vince View Post
I'd rather add an SQL ID in the database as well. This should be the first value in the table and should be set as Primary Key and Auto-increment.

You can then retrieve this value when someone registers (mysql_insert_id) and assign it to a variable. You can then use this value to execute future queries on the database without retrieving the player's name every time.

And you can use sscanf instead of explode to split rows into the data you need, as TheKiller already suggested.
Maybe that's your way of scripting, but it makes no sence, why add a variable while you can just use he's name?
it doesn't slows it down or something, it works fine, and it's more handy.
And explode is way faster then sscanf for doing MySQL stuff like this.

I don't know why, but since i started this topic people are only whining about the 'problems' there are in this script a.k.a. not scripted on the way they should do.

There are no problems with this script, this is the fastest way to do it, the script has a clean optimized code, and i do explain a lot.
And this is the only MySQL tutorial that actually shows (with screens) how to set up a database!
  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



All times are GMT. The time now is 11:05 AM.


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