[House] Get New House ID
#5

Hi

So I tried to do what you told me and everything works EXCEPT for the 2 first ID's ( 0 and 1)

This is the code:



Код:
(( Top of my script I have new idMaison;
ID_MAISON_INVALIDE is defined to 0))

stock GetNewHouseID()
{
	new query[128];
	mysql_format(mysql, query, sizeof(query), "SELECT * FROM `maisons`");
	mysql_tquery(mysql, query, "OnGetHouseID", "");
	return 1;
}

public OnGetHouseID()
{
	new rows, fields, id;
    cache_get_data(rows, fields, mysql);
    if(rows)
    {
		id = cache_get_row_count();
		printf("Il y a %d maison", cache_get_row_count());
		idMaison = id;
		printf("Il y a dйjа des maison, le futur ID est: %d", id);
		return id;
    }
	id = ID_MAISON_INVALIDE;
	idMaison = id;
	return id;
}
The part of my createhouse CMD:

Код:
new id = GetNewHouseID();
		mInfo[id][mWorld] = idMaison;
format(string, sizeof(string), "La maison ID %d a bien йtй crйe.", mInfo[id][mWorld]);
		SendClientMessage(playerid, -1, string);
But when I create a house, I got something like this:
House ID 0 have been created.
House ID 0 have been created.
House ID 1 have been created.
House ID 2 have been created.
House ID 3 have been created.

So the second house created always have id equal 0.



I'm still trying to correct this but I have no ideas right now.
Could somebody help me with this please ?

Thank you !



EDIT: I modified my cmd but it still the same,

Код:
GetNewHouseID();
		new id = idMaison;
Reply


Messages In This Thread
[House] Get New House ID - by anou1 - 08.03.2014, 20:53
Re: [House] Get New House ID - by PowerPC603 - 08.03.2014, 21:05
Re: [House] Get New House ID - by Mriss - 08.03.2014, 21:06
Re: [House] Get New House ID - by anou1 - 08.03.2014, 21:25
Re : [House] Get New House ID - by anou1 - 09.03.2014, 12:45
Respuesta: [House] Get New House ID - by CuervO - 09.03.2014, 15:12
Re : [House] Get New House ID - by anou1 - 09.03.2014, 16:01

Forum Jump:


Users browsing this thread: 2 Guest(s)