MySQL
#9

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
pawn Код:
new UselessData[129], data2[6], Playername[MAX_PLAYER_NAME],QueryString[100],Line[100];
GetPlayerName(playerid,Playername,sizeof(Playername));
format(QueryString,sizeof(QueryString),"SELECT * FROM `playerinfo` WHERE `user` = '%s'",Playername); // Select the row of the player
mysql_query(QueryString);
mysql_fetch_row(Line); // This gets whole MySQL row
sscanf(Line,"p<|>s[128]s[24]ddddds[24]dd",UselessData,UselessData,data2[0],data2[1],data2[2],data2[3],UselessData,data2[4],data2[5]); // Using SSCANF by ****** to split the line
SetPVarInt(playerid, "Kills", data2[0]); //Sets Pvar ints
SetPVarInt(playerid, "Logged", 1); //Sets Pvar ints
SetPVarInt(playerid, "Deaths", data2[1]); //Sets Pvar ints
SetPlayerScore(playerid, data2[2]); // Set Score
GivePlayerMoney(playerid, data2[3]); // Set Cash
SetPVarInt(playerid, "Admin", data2[4]);
SetPVarInt(playerid, "GM", data2[5]);
mysql_free_result();
Read this properly and compare it to your own script
Whats the point of UseLess Data?

Код:
SELECT Colum1Name, Coloum2Name,etc FROM `playerinfo` WHERE `user` = '%s'",Playername);
Then there is no need for this extra varible
Reply


Messages In This Thread
MySQL - by Rob_Zero - 06.07.2011, 08:23
Re: MySQL - by [NoV]LaZ - 06.07.2011, 08:33
Re: MySQL - by Rob_Zero - 06.07.2011, 08:34
Re: MySQL - by Jochemd - 06.07.2011, 08:36
Re: MySQL - by Rob_Zero - 06.07.2011, 08:49
Re: MySQL - by Rob_Zero - 06.07.2011, 09:25
Re: MySQL - by Rob_Zero - 06.07.2011, 10:51
Re: MySQL - by Jochemd - 06.07.2011, 11:07
Re: MySQL - by Cadetz - 20.07.2011, 10:48

Forum Jump:


Users browsing this thread: 2 Guest(s)