SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 29/03/2012, 01:43 AM   #1
mikiii18
Little Clucker
 
Join Date: Apr 2011
Posts: 45
Reputation: 0
Default MySQL - Please help

Hello.

For loading player data, I'm using this:



Code:
mysql_real_escape_string(inputtext, EscPass);
 
format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `user` = '%s' AND `password` = md5('%s')", pName(playerid), EscPass);
 
mysql_query(Query);
mysql_store_result();


stock savePlayer(playerid)
{
    	if(mysql_fetch_row(Query))
        {
 			 	sscanf(Query, "e<p<|>s[32]dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddfffddddffddddddddddddddddddddddddddddddddddddddddddddddddds[32]ds[32]ds[32]ds[32]ds[32]dddddddddddddddddddddddddddddd>", PlayerInfo[playerid]);
                mysql_free_result();
        }
}

That is pretty useful because I don't need to write all the playerinfo variables, it includes all..


How can I do something simillar to save player data?


Thank's.
mikiii18 is offline   Reply With Quote
Old 29/03/2012, 01:51 AM   #2
Tigerkiller
Gangsta
 
Tigerkiller's Avatar
 
Join Date: May 2010
Posts: 757
Reputation: 25
Default AW: MySQL - Please help

"UPDATE db SET (row1,row2,row3) VALUES (0,0,0) WHERE nick = '%s'"


hope i helped you
Tigerkiller is offline   Reply With Quote
Old 29/03/2012, 01:53 AM   #3
mikiii18
Little Clucker
 
Join Date: Apr 2011
Posts: 45
Reputation: 0
Default Re: MySQL - Please help

To put the values variables I will need to put more than 100 variables..

Can't I do something like the loadPlayer?? (Put PlayerInfo[playerid] instead of put the all variables (PlayerInfo[playerid][xxx], PlayerInfo[playerid][xxa], PlayerInfo[playerid][xxb]), etc...)
mikiii18 is offline   Reply With Quote
Old 29/03/2012, 01:55 AM   #4
Tigerkiller
Gangsta
 
Tigerkiller's Avatar
 
Join Date: May 2010
Posts: 757
Reputation: 25
Default AW: MySQL - Please help

i dont think so
Tigerkiller is offline   Reply With Quote
Old 29/03/2012, 02:32 AM   #5
mikiii18
Little Clucker
 
Join Date: Apr 2011
Posts: 45
Reputation: 0
Default Re: MySQL - Please help

Other people help please.


Quote:
Can't I do something like the loadPlayer?? (Put PlayerInfo[playerid] instead of put the all variables (PlayerInfo[playerid][xxx], PlayerInfo[playerid][xxa], PlayerInfo[playerid][xxb]), etc...)
mikiii18 is offline   Reply With Quote
Old 29/03/2012, 02:40 AM   #6
SuperViper
High-roller
 
SuperViper's Avatar
 
Join Date: Sep 2011
Posts: 1,217
Reputation: 310
Default Re: MySQL - Please help

Unless you want to loop through PlayerInfo and format a string/execute a query 100 or more times, then no, you can't do it.
SuperViper is offline   Reply With Quote
Old 29/03/2012, 11:49 AM   #7
mikiii18
Little Clucker
 
Join Date: Apr 2011
Posts: 45
Reputation: 0
Default Re: MySQL - Please help

Quote:
Originally Posted by SuperViper View Post
Unless you want to loop through PlayerInfo and format a string/execute a query 100 or more times, then no, you can't do it.

Would it lag the server?
mikiii18 is offline   Reply With Quote
Old 29/03/2012, 02:48 PM   #8
mikiii18
Little Clucker
 
Join Date: Apr 2011
Posts: 45
Reputation: 0
Default Re: MySQL - Please help

Please help!
mikiii18 is offline   Reply With Quote
Old 29/03/2012, 02:53 PM   #9
mikiii18
Little Clucker
 
Join Date: Apr 2011
Posts: 45
Reputation: 0
Default Re: MySQL - Please help

heeeeellpp meeeee
mikiii18 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
[Include] C-MySQL. (Advanced MySQL Account Configuration) Carlton Includes 44 18/08/2012 08:19 AM
Strikens Mysql vs BlueG's Mysql plugin PrawkC Scripting Help 4 30/09/2011 10:30 AM
Can't connect to local MySQL server through socket '/tmp/mysql.sock' Ivan_Pantovic Help Archive 4 03/08/2011 01:50 PM
Mysql Move a record? (Mysql/pawn Question) DarrenReeder Help Archive 4 05/11/2010 07:23 PM


All times are GMT. The time now is 01:57 PM.


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