Pickup ID make for loop from mysql.
#1

Hello, how can I make for loop to create what the pickup does with mysql data. Hare what Ive got now:

Код:
stock LoadHouses()
{
	new
		Str[255],
		hID,
		Float:intX,
		Float:intY,
		Float:intZ,
		Float:exitX,
		Float:exitY,
		Float:exitZ,
		hOwner[24],
		hWorld,
		hPrice,
		hIntID,
		hLocked;

	mysql_query("SELECT * FROM `houses`");
	mysql_store_result();
	new haI = 1;
    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_row(Str))
        {
		    sscanf(Str, "p<|>iffffffs[24]iiii", hID, intX, intY, intZ, exitX, exitY, exitZ, hOwner, hWorld, hPrice, hIntID, hLocked);
		    HousePickup[hID] = CreatePickup(1273, 1, exitX, exitY, exitZ);
		    iHos[haI][haID] = haI;
			iHos[haI][haIntX] = intX;
			iHos[haI][haIntY] = intY;
			iHos[haI][haIntZ] = intZ;
 		    iHos[haI][haExitX] = exitX;
			iHos[haI][haExitY] = exitY;
			iHos[haI][haExitZ] = exitZ;
			iHos[haI][haIntID] = hIntID;
			iHos[haI][haPrice] = hPrice;
			iHos[haI][haLocked] = hLocked;
			iHos[haI][haWorld] = hWorld;
			format(iHos[haI][haOwner], 24, "%s", hOwner);
			haI++;
			hTotal++;
		}
	}
	mysql_free_result();
	printf("** %i\t<->\tHouses Loaded from\t<->\tMySQL\t\t   **", hTotal);
	return 1;
}
Код:
enum _HDATA
{
	haID,
	Float:haIntX,
	Float:haIntY,
	Float:haIntZ,
	Float:haExitX,
	Float:haExitY,
	Float:haExitZ,
	haOwner[24],
	haWorld,
	haPrice,
	haIntID,
	haLocked
};
Код:
new iHos[MAX_HOUSES][_HDATA];

new HousePickup[MAX_HOUSES], hTotal;
So that gets all the pick ups, and pickup ID is hID I think.

and this defines what what all pick id does.

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	for(new haI = 1; haI++;)
	{
		if(pickupid == HousePickup[haI])
		{
			GameTextForPlayer(playerid, "~w~Type ~r~/enter~w~ to go inside: ", 5000, 5);
		}
	}
	return 1;
}
i think I need to use the iHos somehow, but Im lost. Help me figure this out please.
Reply
#2

bump ;_;
Reply
#3

bumpy road
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)