ID To Pickup.
#1

Tryng to make that it would take the ID from Db and place it as id, and then loop it with for loop.

Prob is that first pickup stands as all my max_houses = 2000.
SO I made this to check if things are correct.

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
	new string[128];
	for(new haI = 0; haI < MAX_HOUSES; haI++)
	{
   		if(pickupid == HousePickup[haI])
    	{
    	    format(string, sizeof(string), "This is test and house id is: %d", haI);
			SendClientMessage(playerid, COLOR_GREEN, string);
    	}
	}
	return 1;
}
But first house spams you everything I mean, ID:1, ID:2 ....... ID: 1999. Spams to the chat from 1 to 1999 (max num of houses).

and I think the 4 th house doesnt create. the seccond and 3rd works though haha..
Reply
#2

just space out the coordinates and make a loop variable
Reply
#3

Quote:
Originally Posted by Wingman
Посмотреть сообщение
just space out the coordinates and make a loop variable
The pickup is allready created automaticly, this defines what it does when u pick it up. So why would I need to space out coordinates?
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
You can't allocate IDs, just store them. When you create a pickup for a house, remember the ID it returns and compare that instead.
I allready did it, I think I did it lol.

Код:
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);
	new FormatBuffer[255];
	format(FormatBuffer,sizeof(FormatBuffer),"ID: %i", HousePickup[hID]);
	print(FormatBuffer);

	
	return 1;
}
and LoadHouses is on gamemodeint
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)