Have a problem with Faction sys using MySQL.
#1

Hi, I'm working on a new gamemode. I watched some tutorials on the froum and I got a little problem with my faction system as the title said.

For example, there are two rows in the table being called 'faction'. and each rows have their ID(1, 3). then when I loaded the system and put their ID into a variable, it gives variable wrong number.

Here's my script, I'm using MySQL R39.

Код:
stock LoadFactions()
{
	new query[120];
	
	mysql_format(g_Handle, query, sizeof(query), "SELECT * FROM `factions` ORDER BY F_ID ASC");
	mysql_tquery(g_Handle, query, "OnLoadFactions", "");
	return 1;
}

public OnLoadFactions()
{
	for(new i = 0; i < cache_get_row_count(); i++)
	{
	    g_FactionInfo[i+1][faction_ID]         = cache_get_field_content_int(i, "F_ID");
	    g_FactionInfo[i+1][faction_Status]	   = cache_get_field_content_int(i, "F_Status");
There are two rows(ID:1, ID:3) in the table.

mysql output: f_id : 1, f_id: 3.

server output: f_id : 1, f_id: 2.


I'm not good at scripting and I need a help with this script.. I think I need to do something to skip the ID not exists when some rows' not exists in the table.

If you know how I can fix this problem, please help me with my issue!

Thanks also sorry for my english.. I don't know how should I explain about this issue.
Reply
#2

Any ideas, please?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)