[MySql] Players boot data
#3

What do you mean by neat? I think that's personal because every scripter has a different style.

A couple of things that might help you though.

Код:
SELECT * FROM `players` WHERE `id`=%d LIMIT 1
What is the use of the id field? if it's for finding the players record, you can use your name field.
For example:

Код:
SELECT * FROM `players` WHERE `username` = '%s'
And remember to escape the string to stop injections.

Another thing that might be usefull to know, but not necessary is a specifier for SSCANF, you can use the enum specifier to enumerate the data you retrieve using sscanf, for example in your code:

Код:
if ( sscanf( string, "p<|>s[20]ddddddddddddfffdd",
			trash,
			PlayerInfo[playerid][banned],
			PlayerInfo[playerid][Level],
			PlayerInfo[playerid][SEELevel],
			money,
   			score,
			PlayerInfo[playerid][Kills],
			PlayerInfo[playerid][Deaths],
   			PlayerInfo[playerid][GTLLevel],
   			PlayerInfo[playerid][SMPLevel],
   			PlayerInfo[playerid][LSTLevel],
   			PlayerInfo[playerid][TSGLevel],
   			PlayerInfo[playerid][eLevel],
   			PlayerInfo[playerid][Exp],
   			PlayerInfo[playerid][pos_x],
   			PlayerInfo[playerid][pos_y],
   			PlayerInfo[playerid][pos_z],
   			PlayerInfo[playerid][FavSkin],
   			PlayerInfo[playerid][rBan]
		 ) )
Can become:

Код:
if ( sscanf( string, "e<p<|>s[20]ddddddddddddfffdd>",
			PlayerInfo[playerid]
		 ) )
However, your enumerator (the one used for PlayerInfo) will have to be in the SAME order as the mysql table for players.
Reply


Messages In This Thread
[MySql] Players boot data - by [LTU]mindux9[TCS] - 05.01.2012, 17:33
Re: [MySql] Players boot data - by [LTU]mindux9[TCS] - 06.01.2012, 06:49
Re: [MySql] Players boot data - by Joe_ - 06.01.2012, 09:16
Re: [MySql] Players boot data - by [LTU]mindux9[TCS] - 06.01.2012, 10:44
Re: [MySql] Players boot data - by Joe_ - 06.01.2012, 11:03
Re: [MySql] Players boot data - by [LTU]mindux9[TCS] - 06.01.2012, 11:10
Re: [MySql] Players boot data - by [HiC]TheKiller - 06.01.2012, 11:27
Re: [MySql] Players boot data - by [LTU]mindux9[TCS] - 06.01.2012, 14:56
Re: [MySql] Players boot data - by [LTU]mindux9[TCS] - 06.01.2012, 14:59

Forum Jump:


Users browsing this thread: 2 Guest(s)