MySQL r39 "cache_get_field_content" problem.
#1

Hi. My problem is: I have 2 "cache_get_field_content" one for House owner and another to House Address. When i made printf to check if it works then "cache_get_field_content" for House address trying/writing over House Owner "cache_get_field_content".

Код:
forward OnHouseLoad();
public OnHouseLoad()
{
	new housestring[256];
    if(cache_num_rows())
    {
        for(new i = 0; i<cache_num_rows(); i++)
        {
            new hID = cache_get_field_content_int(i,"HouseID",mysql_con);
            new Float:enterx =  cache_get_field_content_float(i,"EnterX",mysql_con);
            new Float:entery =  cache_get_field_content_float(i,"EnterY",mysql_con);
            new Float:enterz =  cache_get_field_content_float(i,"EnterZ",mysql_con);
            new hworld = cache_get_field_content_int(i,"InteriorVW",mysql_con);
            new Float:exitx = cache_get_field_content_float(i,"ExitX",mysql_con);
            new Float:exity = cache_get_field_content_float(i,"ExitY",mysql_con);
            new Float:exitz = cache_get_field_content_float(i,"ExitY",mysql_con);
	    cache_get_field_content(i,"HouseOwner",hInfo[i][HouseOwner],mysql_con,25);
	    cache_get_field_content(i,"HouseAdress",hInfo[i][HouseAdress],mysql_con,50);
            CreateDynamicPickup(1273, 1, enterx, entery, enterz, 0, 0);
            CreateDynamicPickup(1318, 1, exitx, exity, exitz, hworld, 0);
            format(housestring, sizeof(housestring), "Aadres: %s\nOmanik: %s", hInfo[i][HouseAdress], hInfo[i][HouseOwner]);
    	    Create3DTextLabel(housestring, -1, enterx, entery, enterz, 5.0, 0, 0);
            printf("MAJA IDga %d ON LAETUD!Omanik:%s Aadres:%s",hID,hInfo[i][HouseOwner], hInfo[i][HouseAdress]);
        }
    }
    else print("Maju EI leitud.");
    return 1;
}
printf
Код:
[00:49:39] Andmebaasiga ьhendus loodud!
[00:49:39] Number of vehicle models: 0
[00:49:39] MAJA IDga 1 ON LAETUD!Omanik:RParna Aadres:Parna
[00:49:39] MAJA IDga 2 ON LAETUD!Omanik:RLilla Aadres:Lilla
Reply
#2

I am not sure what you mean? I see the correct behaviour it seems like? What should the printf actually say?
Reply
#3

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
I am not sure what you mean? I see the correct behaviour it seems like? What should the printf actually say?
[00:49:39] MAJA IDga 1 ON LAETUD!Omanik:RParna Aadres:Parna
[00:49:39] MAJA IDga 2 ON LAETUD!Omanik:RLilla Aadres:Lilla

It must be Omanik: Riik and Aadres:Parna but that Aadres is writing over Omanik. I hope it's more understandable.
Reply
#4

Ah I see. What does your enum look like and in particular the fields HouseOwner and HouseAdress
Reply
#5

Код:
enum HouseDATA
{
	HouseID,
	HouseOwner,
	HouseAdress,
	Float:EnterX,
	Float:EnterY,
	Float:EnterZ,
	Float:ExitX,
	Float:ExitY,
	Float:ExitZ,
	InteriorVW
}
new hInfo[MAX_HOUSES][HouseDATA];
Reply
#6

Quote:
Originally Posted by maxmax1
Посмотреть сообщение
Код:
enum HouseDATA
{
	HouseID,
	HouseOwner,
	HouseAdress,
	Float:EnterX,
	Float:EnterY,
	Float:EnterZ,
	Float:ExitX,
	Float:ExitY,
	Float:ExitZ,
	InteriorVW
}
new hInfo[MAX_HOUSES][HouseDATA];
Add a string array to HouseOwner (HouseOwner[MAX_PLAYER_NAME]) and for the HouseAddress.
By the way, make it equal to the size you wrote in cache_get_field_content.
Reply
#7

cache_get_field_content(); //loads strings. EG: HouseOwner[24]
cache_get_field_content_int(); //loads int values. EG: 1234
cache_get_field_content_float(); //loads float values. EG: 133.7
Reply
#8

Thanks Ox1gEN. It's working.
Reply
#9

Quote:
Originally Posted by maxmax1
Посмотреть сообщение
Thanks Ox1gEN. It's working.
np
Reply
#10

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
cache_get_field_content(); //loads strings. EG: HouseOwner[24]
cache_get_field_content_int(); //loads int values. EG: 1234
cache_get_field_content_float(); //loads float values. EG: 133.7
I almost understand what values they are for. But because i'm beginner i forgot, that string needs these arrays or how they called. Sorry for bad English
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)