Custom MySQLGetPlayerInt(playerid,field[]); Help!
#1

K, so i just made my own command to get a field from a users row in the database.
Код:
public MySQLGetPlayerInt(playerid,field[])
{
	new name[28],query[1024],line[1024],fieldval[1024],destination[64];
	GetPlayerName(playerid,name,sizeof(name));
	format(query,sizeof(query),"SELECT * FROM `users` WHERE username='%s'",name);
	samp_mysql_query(query);
	samp_mysql_store_result();
	samp_mysql_fetch_row(line);
	samp_mysql_get_field(field,destination);
	format(fieldval,sizeof(fieldval),"%% ",destination);
	new Int = strval(fieldval);
	printf("Username: %s. Field: %s. Value: %%",name,fieldval,Int);
	return Int;
}
But it crashes my server using it in the command:
Код:
if(strcmp(cmd,"/adminlevel",true)==0)
	{
		format(string,sizeof(string),"%d",MySQLGetPlayerInt(playerid,"adminlevel"));
		new result;
		result = strval(string);
		format(string,sizeof(string),"%%",result);
	  SendClientMessage(playerid,COLOR_LIME,string);
	  return 1;
	}
It crashes somewhere in the MySQLGetPlayerInt command because it does not print that last line into the command prompt.
Reply


Messages In This Thread
Custom MySQLGetPlayerInt(playerid,field[]); Help! - by tom_jonez - 21.03.2009, 04:56
Re: Custom MySQLGetPlayerInt(playerid,field[]); Help! - by Norn - 21.03.2009, 06:16
Re: Custom MySQLGetPlayerInt(playerid,field[]); Help! - by [RP]Rav - 21.03.2009, 07:43
Re: Custom MySQLGetPlayerInt(playerid,field[]); Help! - by tom_jonez - 21.03.2009, 17:43
Re: Custom MySQLGetPlayerInt(playerid,field[]); Help! - by ICECOLDKILLAK8 - 21.03.2009, 19:15
Re: Custom MySQLGetPlayerInt(playerid,field[]); Help! - by tom_jonez - 22.03.2009, 01:25

Forum Jump:


Users browsing this thread: 1 Guest(s)