SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 10/05/2014, 05:23 AM   #61
Deal-or-die
Huge Clucker
 
Deal-or-die's Avatar
 
Join Date: Oct 2010
Location: An Island 1000's of miles away
Posts: 366
Reputation: 22
Default Re: MySQL Registration System [Threaded Queries(R33+) + Whirlpool]

Okay.
I'll summarise everything that happened with me for future Reference of others.

When I got found this tutorial I typed each character out 1 by 1 instead of simply copying and pasting as this is how I teach myself, didn't take long and eventually got there. The login system didn't work quite frankly.

The first Register Dialog would appear and nothing more. I could type in my Password, the dialog would disappear but no spawning or no "You have successfully logged in." Message with the only visible thing was the spawn menu '<< | >> | Spawn' on which when you clicked since there was no class or spawn selection set would just displayer the 'You are out of boundaries' (Or what ever) message.

Firstly if you followed the tutorial step by step, from the photos to the script you'd have come across this problem too. To fix this. In the pictures the tutorial states having the 'Password' field as 'Password' However in the script in the 'public OnAccountCheck(playerid)' you will find

pawn Code:
cache_get_field_content(0, "PASS", pInfo[playerid][Password], mysql, 129);
Simply change this too
pawn Code:
cache_get_field_content(0, "Password", pInfo[playerid][Password], mysql, 129);

This fixed my problem and now the saving of account credentials, registering and login now works. However you will have to add your own way of spawning.

If you are working on moreso an RP script adding the following to the login dialog after the OnAccountLoad query should fix that problem.
pawn Code:
SetSpawnInfo(playerid, 0, 240, pInfo[playerid][posX], pInfo[playerid][posY], pInfo[playerid][posZ], 0.0, 0,0,0,0,0,0);
                SpawnPlayer(playerid);
__________________
/////////////////////////// | Mini Moot | \\\\\\\\\\\\\\\\\\\\\\\\\\\

"I'm in the country that basically invented the Internet, and your getting faster speeds on an island 1,000miles away"

Last edited by Deal-or-die; 11/05/2014 at 04:52 AM.
Deal-or-die is offline   Reply With Quote
Old 11/05/2014, 03:25 AM   #62
Deal-or-die
Huge Clucker
 
Deal-or-die's Avatar
 
Join Date: Oct 2010
Location: An Island 1000's of miles away
Posts: 366
Reputation: 22
Default Re: MySQL Registration System [Threaded Queries(R33+) + Whirlpool]

The only problem I am having now is the position I am spawning in is way out of whack.

After numerous logins I have worked out there seems to be a pattern to which I am spawning in.

Lets say I log in 6 times.

First time I will be falling through the world in Blueberry. This being because of this in the Register Dialog:
pawn Code:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `PosX` ,`PosY`, `PosZ`) VALUES ('%e', '%s', '%s', 0, 0, 0, 0.0, 0.0, 0.0)", Name[playerid], pInfo[playerid][Password], IP[playerid]);

I did try to define
pawn Code:
#define SpawnX          1704.9124
#define SpawnY          1409.2749
#define SpawnZ          10.6406
#define SpawnA          10.6406
and then
pawn Code:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `PosX` ,`PosY`, `PosZ`) VALUES ('%e', '%s', '%s', 0, 0, 0, '%f', '%f', '%f')", Name[playerid], pInfo[playerid][Password], IP[playerid], SpawnX, SpawnY, SpawnZ);
But that didn't work so I stuck with simply.
pawn Code:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `PosX` ,`PosY`, `PosZ`) VALUES ('%e', '%s', '%s', 0, 0, 0, 1704.9124, 1409.2749, 10.6406)", Name[playerid], pInfo[playerid][Password], IP[playerid]);

But anyway that's the first spawn.
The second spawn it seems to randomly pick where you spawn.
I logged in the first time, fell through blueberry, Ran away and jumped on a roof. Logged out.
The second time when I logged in I found myself on the roof of a completely different building but still in Blueberry.
The third time I logged in I found myself where I logged out the first time.

Summary.
First Login - Falling
First Logout - Pizza Roof
Second Login - Freight Roof
Second Logout - Street near pizza place
Third Login - Pizza Roof
Third Logout - Shipping containers
Forth Login - Street near pizza place
Forth Logout - Building ruins
Fifth Login - Shipping containers
Fifth Logout - Freight Depot
Sixth Login - Building Ruins
Ect...

Any ideas what's going on?

Cheers!
__________________
/////////////////////////// | Mini Moot | \\\\\\\\\\\\\\\\\\\\\\\\\\\

"I'm in the country that basically invented the Internet, and your getting faster speeds on an island 1,000miles away"

Last edited by Deal-or-die; 11/05/2014 at 05:54 AM.
Deal-or-die is offline   Reply With Quote
Old 11/05/2014, 09:59 AM   #63
luckie12
Huge Clucker
 
Join Date: Mar 2009
Location: The Sewers
Posts: 342
Reputation: 2
Default Re: MySQL Registration System [Threaded Queries(R33+) + Whirlpool]

i get these errors O.o

Code:
C:\Users\Luc\Documents\Samp server\filterscripts\Register.pwn(101) : error 017: undefined symbol "pInfo"
C:\Users\Luc\Documents\Samp server\filterscripts\Register.pwn(101) : warning 215: expression has no effect
C:\Users\Luc\Documents\Samp server\filterscripts\Register.pwn(101) : error 001: expected token: ";", but found "]"
C:\Users\Luc\Documents\Samp server\filterscripts\Register.pwn(101) : error 029: invalid expression, assumed zero
C:\Users\Luc\Documents\Samp server\filterscripts\Register.pwn(101) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
http://pastebin.com/xy4hVa7G
__________________
luckie12 is offline   Reply With Quote
Old 11/05/2014, 11:12 AM   #64
Deal-or-die
Huge Clucker
 
Deal-or-die's Avatar
 
Join Date: Oct 2010
Location: An Island 1000's of miles away
Posts: 366
Reputation: 22
Default Re: MySQL Registration System [Threaded Queries(R33+) + Whirlpool]

Make sure you include the enum at the top under
pawn Code:
native WP_Hash(buffer[], len, const str[]); //whirlpool, for hashing our password


pawn Code:
//Now let's create an enumerator that holds player's information
enum PDATA //We name our enumerator as PDATA (which stands for PlayerDATA). You can name it however you want.
{
    ID, //Will be used later to store player's ID from database so we can use it anywhere later
    Password[129], //We will load player's password into this varible from database
    Admin, //We will load player's admin level from database into this variable so we can use it anywhere later.
    VIP, //We will load player's VIP level from database into this variable so we can use it anywhere later.
    Money, //We will load player's money from database into this variable so we can use it anywhere later.
    Float:posX, //We will load player's X position from database into this variable so we can use it anywhere later.
    Float:posY, //We will load player's Y position from database into this variable so we can use it anywhere later.
    Float:posZ //We will load player's Z from database into this variable so we can use it anywhere later.

}
new pInfo[MAX_PLAYERS][PDATA]; //Variable that stores enumerator above

EDIT: If that pastebin is what you're using, you're missing most of the tutorial. :P
__________________
/////////////////////////// | Mini Moot | \\\\\\\\\\\\\\\\\\\\\\\\\\\

"I'm in the country that basically invented the Internet, and your getting faster speeds on an island 1,000miles away"
Deal-or-die is offline   Reply With Quote
Old 11/05/2014, 11:55 AM   #65
luckie12
Huge Clucker
 
Join Date: Mar 2009
Location: The Sewers
Posts: 342
Reputation: 2
Default Re: MySQL Registration System [Threaded Queries(R33+) + Whirlpool]

Well, no error this time, but doesnt show up ingame ;o when i connect or something lol :/
__________________
luckie12 is offline   Reply With Quote
Old 12/05/2014, 12:04 AM   #66
Deal-or-die
Huge Clucker
 
Deal-or-die's Avatar
 
Join Date: Oct 2010
Location: An Island 1000's of miles away
Posts: 366
Reputation: 22
Default Re: MySQL Registration System [Threaded Queries(R33+) + Whirlpool]

The Dialogs don't show?
It looks like you've includeded the registration as a Filterscript, have you included it in your server.config?


EDIT: Okay... the problem I was having was that I copied and pasted the tutorial to save time. Thus making me un-aware of silly errors like the one included in the tutorial.

This if you notice is straight from the Tutorial. If you look closely at the X, Y, and Z position you'll notice there is no 'Y' coordinate and two 'Z' coordinates.

pawn Code:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, pInfo[playerid][posX], pInfo[playerid][posZ], pInfo[playerid][posZ]);
    //Set player's position to the last saved position.
    return 1;
}

To fix, simply change this:
pawn Code:
SetPlayerPos(playerid, pInfo[playerid][posX], pInfo[playerid][posZ], pInfo[playerid][posZ]);
To this:
pawn Code:
SetPlayerPos(playerid, pInfo[playerid][posX], pInfo[playerid][posY], pInfo[playerid][posZ]);
__________________
/////////////////////////// | Mini Moot | \\\\\\\\\\\\\\\\\\\\\\\\\\\

"I'm in the country that basically invented the Internet, and your getting faster speeds on an island 1,000miles away"

Last edited by Deal-or-die; 12/05/2014 at 01:54 PM.
Deal-or-die is offline   Reply With Quote
Old 18/05/2014, 08:35 PM   #67
Hwang
Huge Clucker
 
Hwang's Avatar
 
Join Date: Jul 2013
Location: Turkey
Posts: 215
Reputation: 33
Default Re: MySQL Registration System [Threaded Queries(R33+) + Whirlpool]

Subject document should be updated, the subject seems useful.
__________________


185.136.204.49:7777
Hwang is offline   Reply With Quote
Old 19/05/2014, 06:25 PM   #68
Denying
Gangsta
 
Join Date: Feb 2013
Posts: 541
Reputation: 13
Default Re: MySQL Registration System [Threaded Queries(R33+) + Whirlpool]

pawn Code:
cache_get_field_content(0, "PASS", pInfo[playerid][Password], mysql, 129);

Here, why is the row 0 and why do you use "PASS" and not "Password" like we saved on the table?
Thanks in advance.



EDIT: Figured it all out, a friend helped me out.
Anyway, you need to change that "PASS" in the line I have above in my comment to "Password".

Last edited by Denying; 20/05/2014 at 05:04 PM.
Denying is offline   Reply With Quote
Old 22/05/2014, 01:25 PM   #69
VladimirMark
Huge Clucker
 
VladimirMark's Avatar
 
Join Date: May 2014
Location: Russia
Posts: 362
Reputation: 21
Default Re: MySQL Registration System [Threaded Queries(R33+) + Whirlpool]

Where can I find MySQL R33+
I am trying to find it but nothing :/
Just need help, thanks
__________________
Rep+ If I really helped you
Mapping is what I do.
Contact me:



VladimirMark is offline   Reply With Quote
Old 22/05/2014, 02:02 PM   #70
Denying
Gangsta
 
Join Date: Feb 2013
Posts: 541
Reputation: 13
Default Re: MySQL Registration System [Threaded Queries(R33+) + Whirlpool]

Quote:
Originally Posted by VladimirMark View Post
Where can I find MySQL R33+
I am trying to find it but nothing :/
Just need help, thanks
https://github.com/pBlueG/SA-MP-MySQL/releases
Denying 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
Baffled - mySQL Vehicle Loading (threaded queries) Moglizorz. Server Support 0 18/05/2013 01:14 AM
Comparing password [MySQL Threaded queries] emokidx Scripting Help 3 02/04/2013 12:07 PM
MySQL Threaded Queries CONTROLA Scripting Help 4 25/11/2012 03:02 PM
Threaded Queries - BlueG's MYSQL Plugin R7 Ballu Miaa Scripting Help 3 05/11/2012 05:36 PM
[Help] BlueG's MySQL Plugin R7 - Threaded Queries Maxips2 Scripting Help 4 19/10/2012 09:35 AM


All times are GMT. The time now is 06:08 AM.


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