[HELP] Loading player variables - MySQL
#7

Alright, now it prints as 0. Thank you for clearing that small bit up for me and explaining it.

let me give some more code:

heres the player info enum:
Код:
enum pInfo
{
	username[28],
	password[32],
	email[50],
	hideemail,
	datejoined[28],
	id,
	loggedin,
	score,
	money,
	bankstate,
	adminlevel,
	regular,
	armyaccess,
	robrank,
	lastseen[10],
	dlicense,
	plicense,
	dinstructor,
	pinstructor,
	bannedby[28],
	bantime[20],
	banreason[128]
};
new Players[MAX_PLAYERS][pInfo];
this conforms to the mysql table structure, every thing w/o a set value/length is an integer in the mysql table. ex: loggedin

and here is the loading part of the Loadplayerinfo command
Код:
...
samp_mysql_strtok(field, "|", line);
	format(Players[playerid][pInfo:fval],256,"%s",field);
 	printf("%s is now stored as %s for player id (%i).",field,Players[playerid][pInfo:fval],playerid);
	fval ++;
	while(samp_mysql_strtok(field, "|", "")==1)
	{
	  //Players[playerid][pInfo:fval] =
		format(Players[playerid][pInfo:fval],256,"%s",field);
	  printf("%s is now stored as %s for player id (%i).",field,Players[playerid][pInfo:fval],playerid);
	  fval ++;
	}
...
Now i just came up with an idea, make a new array that list the table fields, and for each field, select the value of it (after mysql_fetch_row) and then say format(Players[playerid][field],256,"%s",fieldvalue); would that work?
Reply


Messages In This Thread
[HELP] Loading player variables - MySQL - by tom_jonez - 30.11.2009, 23:22
Re: Loading player variables - by yezizhu - 30.11.2009, 23:46
Re: Loading player variables - by tom_jonez - 30.11.2009, 23:56
Re: Loading player variables - by thegoliathmaster - 01.12.2009, 00:05
Re: [HELP] Loading player variables - MySQL - by tom_jonez - 01.12.2009, 01:14
Re: [HELP] Loading player variables - MySQL - by yezizhu - 01.12.2009, 02:27
Re: [HELP] Loading player variables - MySQL - by tom_jonez - 01.12.2009, 19:31
Re: [HELP] Loading player variables - MySQL - by yezizhu - 02.12.2009, 00:05
Re: [HELP] Loading player variables - MySQL - by tom_jonez - 02.12.2009, 00:25
Re: [HELP] Loading player variables - MySQL - by yezizhu - 02.12.2009, 01:18

Forum Jump:


Users browsing this thread: 1 Guest(s)