SA-MP Forums Archive
Cannot get 3D text label to display after loading. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Cannot get 3D text label to display after loading. (/showthread.php?tid=569812)



[MySQL] Cannot get 3D text label to display after loading. - willsuckformoney - 03.04.2015

The pickup creates, the houses load etc. But it does not show the text label. The code looks fine in my eyes.

pawn Код:
//OnGameModeInIt
        for(new h; h < MAX_HOUSES; h++)
    {
        mysql_format(mysql, query, sizeof(query), "SELECT * FROM `houses` WHERE `hID` = '%d' LIMIT 1", h);
        mysql_tquery(mysql, query, "OnHousesLoad", "d", h);
    }

//callback
public OnHousesLoad(houseid)
{
    hInfo[houseid][hID] = cache_get_field_content_int(0, "hID");
    if(hInfo[houseid][hID] > 0)
    {
        hInfo[houseid][owned] = cache_get_field_content_int(0, "owned");
        cache_get_field_content(0, "owner",hInfo[houseid][owner]);
        cache_get_field_content(0, "address",hInfo[houseid][address]);
        hInfo[houseid][cost] = cache_get_field_content_int(0, "cost");
        hInfo[houseid][Int] = cache_get_field_content_int(0, "Int");
        hInfo[houseid][hX] = cache_get_field_content_float(0, "hX");
        hInfo[houseid][hY] = cache_get_field_content_float(0, "hY");
        hInfo[houseid][hZ] = cache_get_field_content_float(0, "hZ");
        hInfo[houseid][tX] = cache_get_field_content_float(0, "tX");
        hInfo[houseid][tY] = cache_get_field_content_float(0, "tY");
        hInfo[houseid][tZ] = cache_get_field_content_float(0, "tZ");
   
        hPickup[houseid] = CreateDynamicPickup(1273,1,hInfo[houseid][hX],hInfo[houseid][hY],hInfo[houseid][hZ]);
        House[houseid] = CreateDynamic3DTextLabel(hInfo[houseid][address], COLOR_GREEN, hInfo[houseid][hX], hInfo[houseid][hY], hInfo[houseid][hZ], 50);
   
        Houses++;
        printf("%d Houses Have Been Loaded.",Houses);
    }
    return 1;
}



Re: Cannot get 3D text label to display after loading. - X337 - 03.04.2015

Код:
public OnHousesLoad(houseid)
{
	new tempString[128];
    	hInfo[houseid][hID] = cache_get_field_content_int(0, "hID");
	if(hInfo[houseid][hID] > 0)
	{
		hInfo[houseid][owned] = cache_get_field_content_int(0, "owned");
		cache_get_field_content(0, "owner", tempString);
		format(hInfo[houseid][owner], 128, "%s", tempString);
		cache_get_field_content(0, "address", tempString);
		format(hInfo[houseid][address], 128, "%s", tempString);
		hInfo[houseid][cost] = cache_get_field_content_int(0, "cost");
		hInfo[houseid][Int] = cache_get_field_content_int(0, "Int");
		hInfo[houseid][hX] = cache_get_field_content_float(0, "hX");
		hInfo[houseid][hY] = cache_get_field_content_float(0, "hY");
		hInfo[houseid][hZ] = cache_get_field_content_float(0, "hZ");
		hInfo[houseid][tX] = cache_get_field_content_float(0, "tX");
		hInfo[houseid][tY] = cache_get_field_content_float(0, "tY");
		hInfo[houseid][tZ] = cache_get_field_content_float(0, "tZ");
	
	   	hPickup[houseid] = CreateDynamicPickup(1273,1,hInfo[houseid][hX],hInfo[houseid][hY],hInfo[houseid][hZ]);
		House[houseid] = CreateDynamic3DTextLabel(hInfo[houseid][address], COLOR_GREEN, hInfo[houseid][hX], hInfo[houseid][hY], hInfo[houseid][hZ] + 1.0, 50);
	
		Houses++;
		printf("%d Houses Have Been Loaded.",Houses);
	}
	return 1;
}
Hope it'll work sir


Re: Cannot get 3D text label to display after loading. - [ABK]Antonio - 03.04.2015

Quote:
Originally Posted by bondowocopz
Посмотреть сообщение
Код:
public OnHousesLoad(houseid)
{
	new tempString[128];
    	hInfo[houseid][hID] = cache_get_field_content_int(0, "hID");
	if(hInfo[houseid][hID] > 0)
	{
		hInfo[houseid][owned] = cache_get_field_content_int(0, "owned");
		cache_get_field_content(0, "owner", tempString);
		format(hInfo[houseid][owner], 128, "%s", tempString);
		cache_get_field_content(0, "address", tempString);
		format(hInfo[houseid][address], 128, "%s", tempString);
		hInfo[houseid][cost] = cache_get_field_content_int(0, "cost");
		hInfo[houseid][Int] = cache_get_field_content_int(0, "Int");
		hInfo[houseid][hX] = cache_get_field_content_float(0, "hX");
		hInfo[houseid][hY] = cache_get_field_content_float(0, "hY");
		hInfo[houseid][hZ] = cache_get_field_content_float(0, "hZ");
		hInfo[houseid][tX] = cache_get_field_content_float(0, "tX");
		hInfo[houseid][tY] = cache_get_field_content_float(0, "tY");
		hInfo[houseid][tZ] = cache_get_field_content_float(0, "tZ");
	
	   	hPickup[houseid] = CreateDynamicPickup(1273,1,hInfo[houseid][hX],hInfo[houseid][hY],hInfo[houseid][hZ]);
		House[houseid] = CreateDynamic3DTextLabel(hInfo[houseid][address], COLOR_GREEN, hInfo[houseid][hX], hInfo[houseid][hY], hInfo[houseid][hZ] + 1.0, 50);
	
		Houses++;
		printf("%d Houses Have Been Loaded.",Houses);
	}
	return 1;
}
Hope it'll work sir
cache_get_field_content(row, field_name[], destination[], connectionHandle = 1, max_len = sizeof(destination)

Why he would need a separate string for this is beyond me.

Not sure what the problem is, just thought I'd show this guy that.


There's 1 way to find out what's happening though.
pawn Код:
printf("HouseID: %i | Address: %s | X,Y,Z: %f,%f,%f", houseid, hInfo[houseid][address], hInfo[houseid][hX], hInfo[houseid][hY], hInfo[houseid][hZ]);
Though, if the pickup is being created as well it seems a bit weird.


Re: Cannot get 3D text label to display after loading. - willsuckformoney - 03.04.2015

Quote:
Originally Posted by bondowocopz
Посмотреть сообщение
Код:
public OnHousesLoad(houseid)
{
	new tempString[128];
    	hInfo[houseid][hID] = cache_get_field_content_int(0, "hID");
	if(hInfo[houseid][hID] > 0)
	{
		hInfo[houseid][owned] = cache_get_field_content_int(0, "owned");
		cache_get_field_content(0, "owner", tempString);
		format(hInfo[houseid][owner], 128, "%s", tempString);
		cache_get_field_content(0, "address", tempString);
		format(hInfo[houseid][address], 128, "%s", tempString);
		hInfo[houseid][cost] = cache_get_field_content_int(0, "cost");
		hInfo[houseid][Int] = cache_get_field_content_int(0, "Int");
		hInfo[houseid][hX] = cache_get_field_content_float(0, "hX");
		hInfo[houseid][hY] = cache_get_field_content_float(0, "hY");
		hInfo[houseid][hZ] = cache_get_field_content_float(0, "hZ");
		hInfo[houseid][tX] = cache_get_field_content_float(0, "tX");
		hInfo[houseid][tY] = cache_get_field_content_float(0, "tY");
		hInfo[houseid][tZ] = cache_get_field_content_float(0, "tZ");
	
	   	hPickup[houseid] = CreateDynamicPickup(1273,1,hInfo[houseid][hX],hInfo[houseid][hY],hInfo[houseid][hZ]);
		House[houseid] = CreateDynamic3DTextLabel(hInfo[houseid][address], COLOR_GREEN, hInfo[houseid][hX], hInfo[houseid][hY], hInfo[houseid][hZ] + 1.0, 50);
	
		Houses++;
		printf("%d Houses Have Been Loaded.",Houses);
	}
	return 1;
}
Hope it'll work sir
No change, and Antonio, I added the print that you suggested, and it prints out the right coordinates. I'm clueless right now.


Re: Cannot get 3D text label to display after loading. - Chlorine - 03.04.2015

Try this:
pawn Код:
ublic OnHousesLoad(houseid)
{
    hInfo[houseid][hID] = cache_get_field_content_int(0, "hID");
    if(hInfo[houseid][hID] > 0)
    {
        hInfo[houseid][owned] = cache_get_field_content_int(0, "owned");
        cache_get_field_content(0, "owner",hInfo[houseid][owner]);
        cache_get_field_content(0, "address",hInfo[houseid][address]);
        hInfo[houseid][cost] = cache_get_field_content_int(0, "cost");
        hInfo[houseid][Int] = cache_get_field_content_int(0, "Int");
        hInfo[houseid][hX] = cache_get_field_content_float(0, "hX");
        hInfo[houseid][hY] = cache_get_field_content_float(0, "hY");
        hInfo[houseid][hZ] = cache_get_field_content_float(0, "hZ");
        hInfo[houseid][tX] = cache_get_field_content_float(0, "tX");
        hInfo[houseid][tY] = cache_get_field_content_float(0, "tY");
        hInfo[houseid][tZ] = cache_get_field_content_float(0, "tZ");
   
        hPickup[houseid] = CreateDynamicPickup(1273,1,hInfo[houseid][hX],hInfo[houseid][hY],hInfo[houseid][hZ]);
        House[houseid] = CreateDynamic3DTextLabel(hInfo[houseid][address], COLOR_GREEN, hInfo[houseid][hX], hInfo[houseid][hY], hInfo[houseid][hZ]+0.5, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 50);
   
        Houses++;
        printf("%d Houses Have Been Loaded.",Houses);
    }
    return 1;
}



Re: Cannot get 3D text label to display after loading. - willsuckformoney - 03.04.2015

Quote:
Originally Posted by Chlorine
Посмотреть сообщение
Try this:
pawn Код:
ublic OnHousesLoad(houseid)
{
    hInfo[houseid][hID] = cache_get_field_content_int(0, "hID");
    if(hInfo[houseid][hID] > 0)
    {
        hInfo[houseid][owned] = cache_get_field_content_int(0, "owned");
        cache_get_field_content(0, "owner",hInfo[houseid][owner]);
        cache_get_field_content(0, "address",hInfo[houseid][address]);
        hInfo[houseid][cost] = cache_get_field_content_int(0, "cost");
        hInfo[houseid][Int] = cache_get_field_content_int(0, "Int");
        hInfo[houseid][hX] = cache_get_field_content_float(0, "hX");
        hInfo[houseid][hY] = cache_get_field_content_float(0, "hY");
        hInfo[houseid][hZ] = cache_get_field_content_float(0, "hZ");
        hInfo[houseid][tX] = cache_get_field_content_float(0, "tX");
        hInfo[houseid][tY] = cache_get_field_content_float(0, "tY");
        hInfo[houseid][tZ] = cache_get_field_content_float(0, "tZ");
   
        hPickup[houseid] = CreateDynamicPickup(1273,1,hInfo[houseid][hX],hInfo[houseid][hY],hInfo[houseid][hZ]);
        House[houseid] = CreateDynamic3DTextLabel(hInfo[houseid][address], COLOR_GREEN, hInfo[houseid][hX], hInfo[houseid][hY], hInfo[houseid][hZ]+0.5, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 50);
   
        Houses++;
        printf("%d Houses Have Been Loaded.",Houses);
    }
    return 1;
}
This still did not display the label..


Respuesta: Cannot get 3D text label to display after loading. - angelxeneize - 27.05.2015

CreateDynamic3DTextLabel(hInfo[houseid][address], COLOR_GREEN, hInfo[houseid][hX], hInfo[houseid][hY], hInfo[houseid][hZ]+0.5, 25,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0,-1,-1, -1, 100);


Re: Cannot get 3D text label to display after loading. - Vince - 27.05.2015

Please do not treat SQL like a dirty file system. Please read: https://sampforum.blast.hk/showthread.php?tid=366019. Bit outdated in terms of code, but the mindset still applies.