SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 05/08/2010, 07:39 AM   #21
Martin_Santiago
Little Clucker
 
Join Date: Aug 2010
Posts: 1
Reputation: 0
Default Re: Easy MySQL Register/Login system!

Nice way of setting up man, its a lot cleaner than the way i was doing it.

Just one thing. There isnt really much point to do this

Code:
SavePlayer(playerid)
{
	if(!PlayerLogged[playerid])
		return 0;

    	UserStats[playerid][Money] = GetPlayerMoney(playerid);
    

	CheckMySQL();
    
    	new string[256];
        format(string, sizeof(string), "UPDATE Users SET Password='%s', Admin='%d', Money='%d' WHERE Name='%s'", UserStats[playerid][Password], UserStats[playerid][Admin], UserStats[playerid][Money], UserStats[playerid][Name]);
    	mysql_query(string);
    	return 1;
}
Your much better off just updating what you need to update. Its not like their password ever changes while they are logged in unless your going to add a change password option or something.

My Way
Code:
SavePlayer(playerid)
{
	if(!PlayerLogged[playerid])
		return 0;

    	UserStats[playerid][Money] = GetPlayerMoney(playerid);
    

	CheckMySQL();
    
    	new string[256];
    	format(string, sizeof(string), "UPDATE `users` SET `admin`='%d', `money`='%d' WHERE `name`='%s'", UserStats[playerid][Admin], UserStats[playerid][Money], UserStats[playerid][Name]);
    	mysql_query(string);
    	return 1;
}
Just thought id let ya know =D
Martin_Santiago is offline   Reply With Quote
Old 05/08/2010, 08:45 AM   #22
WackoX
Guest
 
Posts: n/a
Default Re: Easy MySQL Register/Login system!

Quote:
Originally Posted by Martin_Santiago View Post
Nice way of setting up man, its a lot cleaner than the way i was doing it.

Just one thing. There isnt really much point to do this

Your much better off just updating what you need to update. Its not like their password ever changes while they are logged in unless your going to add a change password option or something.

My Way

Just thought id let ya know =D
Yes thanks,
I always had it like that, but for the tutorial I implemented the password variable somehow, lol.
  Reply With Quote
Old 09/08/2010, 07:34 PM   #23
KyleSmith
High-roller
 
KyleSmith's Avatar
 
Join Date: Mar 2009
Location: United Kingdom
Posts: 2,374
Reputation: 284
Default Re: Easy MySQL Register/Login system!

Help please?

KyleSmith is offline   Reply With Quote
Old 17/08/2010, 08:23 PM   #24
playbox12
High-roller
 
playbox12's Avatar
 
Join Date: Feb 2010
Location: Netherlands
Posts: 1,685
Reputation: 216
Default Re: Easy MySQL Register/Login system!

Download VS9 version in the topic of the mysql plugin, otherwise update Net. Framework (I think).
playbox12 is offline   Reply With Quote
Old 26/12/2010, 09:27 PM   #25
KotoK
Big Clucker
 
Join Date: Nov 2009
Posts: 61
Reputation: 0
Default Re: Easy MySQL Register/Login system!

For me all works fine! Just started to learn mysql system and this tutorial is exactly what I need.
KotoK is offline   Reply With Quote
Old 08/01/2011, 08:08 PM   #26
Anthonyx3'
Gangsta
 
Anthonyx3''s Avatar
 
Join Date: Feb 2010
Location: Bronx ^^
Posts: 527
Reputation: 0
Default Re: Easy MySQL Register/Login system!

Immah sound stupid right now, but if i wanted to change to dialog, how do i do this correctly, i attempted and failed.
__________________
Quote:
Originally Posted by Nexus RP Advertisement
"IP: 127.0.0.1:7777 (Working IP)"
"our Admins are not noobs too!"
Anthonyx3' is offline   Reply With Quote
Old 15/01/2011, 02:26 PM   #27
[MWR]Blood
High-roller
 
Join Date: Apr 2009
Posts: 2,379
Reputation: 105
Default Re: Easy MySQL Register/Login system!

That's hardly bugged mate, I register and when I rejoin and I try to login it says I'm not registered.
__________________
[MWR]Blood is offline   Reply With Quote
Old 15/01/2011, 02:45 PM   #28
Anthonyx3'
Gangsta
 
Anthonyx3''s Avatar
 
Join Date: Feb 2010
Location: Bronx ^^
Posts: 527
Reputation: 0
Default Re: Easy MySQL Register/Login system!

Its not bugged then, you just messed up with the database im guessing
__________________
Quote:
Originally Posted by Nexus RP Advertisement
"IP: 127.0.0.1:7777 (Working IP)"
"our Admins are not noobs too!"
Anthonyx3' is offline   Reply With Quote
Old 15/01/2011, 03:27 PM   #29
THE_KNOWN
Gangsta
 
Join Date: Dec 2010
Posts: 709
Reputation: 60
Default Re: Easy MySQL Register/Login system!

erm i need help with it saving skins. i tried it but it doesnt.
THE_KNOWN is offline   Reply With Quote
Old 21/01/2011, 04:35 AM   #30
THE_KNOWN
Gangsta
 
Join Date: Dec 2010
Posts: 709
Reputation: 60
Default Re: Easy MySQL Register/Login system!

got it.
my comment for the tut:
SIMPLY PERFECT!!!

my request to add:
save data of different tables and not only users(stats maybe?(having a hard time figuring it out))
THE_KNOWN 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



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


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