House System Problem
#1

I've created a house system and the pickup doesn't create

Code:
Код:
forward LoadHouses();
public LoadHouses()
{
	new rows;
	cache_get_row_count(rows);

	if(rows)
	{
		new id, loaded;
		for(new i = 0; i < rows; i++) {
			cache_get_value_name_int(loaded, "ID", id);
			cache_get_value_name_float(loaded, "EnterX", hInfo[id][hEnterX]);
			cache_get_value_name_float(loaded, "EnterY", hInfo[id][hEnterY]);
			cache_get_value_name_float(loaded, "EnterZ", hInfo[id][hEnterZ]);
			cache_get_value_name_float(loaded, "ExitX", hInfo[id][hExitX]);
			cache_get_value_name_float(loaded, "ExitX", hInfo[id][hExitY]);
			cache_get_value_name_float(loaded, "ExitY", hInfo[id][hExitZ]);
			cache_get_value_name_float(loaded, "ExitZ", hInfo[id][hExitX]);
			cache_get_value_name_int(loaded, "InsideInt", hInfo[id][hInsideInt]);
			cache_get_value_name_int(loaded, "InsideVir", hInfo[id][hInsideVir]);
			cache_get_value_name_int(loaded, "OutsideInt", hInfo[id][hOutsideInt]);
			cache_get_value_name_int(loaded, "Level", hInfo[id][hLevel]);
			cache_get_value_name(loaded, "Owner", hInfo[id][hOwner], 48);
			cache_get_value_name_int(loaded, "Price", hInfo[id][hPrice]);

			new string[255];
			format(string, sizeof(string), "House %d, x: %d, y:%d, z:%d", id, hInfo[id][hEnterX], hInfo[id][hEnterY], hInfo[id][hEnterZ]);
			print(string);

			loaded++;

			hInfo[id][hPickup] = CreatePickup(1273, 0, hInfo[id][hEnterX], hInfo[id][hEnterY], hInfo[id][hEnterZ], -1);
		}

		new string[255];
		format(string, sizeof(string), "Loaded %d houses from Database.", rows);
		print(string);
	}
	else
	{
		print("No house loaded on Database.");
		return 1;
	}
	return 1;
}
Reply
#2

Try to use streamer and make it like CreateDynamicPickup
Or try to change the virtual world of it to 0 then gimme results here
Reply
#3

I tried with virtual world 0 and it's not working, i will test with createdynamicpickup
Reply
#4

Quote:
Originally Posted by C0oL3r
Посмотреть сообщение
I tried with virtual world 0 and it's not working, i will test with createdynamicpickup
Test and leave reply
Reply
#5

try this
PHP код:
CreatePickup(12731hInfo[id][hEnterX], hInfo[id][hEnterY], hInfo[id][hEnterZ], -1); 
Reply
#6

Not working any methods
Reply
#7

What does the following show you in server log:
PHP код:
format(stringsizeof(string), "House %d, x: %d, y:%d, z:%d"idhInfo[id][hEnterX], hInfo[id][hEnterY], hInfo[id][hEnterZ]); 
are the coords correct?

I have had this problem once.
try this:
PHP код:
forward LoadHouses();
public 
LoadHouses()
{
    new 
rows;
    
cache_get_row_count(rows);
    
    new 
Float:XFloat:YFloat:Z;

    if(
rows)
    {
        new 
idloaded;
        for(new 
0rowsi++) {
            
cache_get_value_name_int(loaded"ID"id);
            
cache_get_value_name_float(loaded"EnterX"hInfo[id][hEnterX]);
            
cache_get_value_name_float(loaded"EnterY"hInfo[id][hEnterY]);
            
cache_get_value_name_float(loaded"EnterZ"hInfo[id][hEnterZ]);
            
cache_get_value_name_float(loaded"ExitX"hInfo[id][hExitX]);
            
cache_get_value_name_float(loaded"ExitX"hInfo[id][hExitY]);
            
cache_get_value_name_float(loaded"ExitY"hInfo[id][hExitZ]);
            
cache_get_value_name_float(loaded"ExitZ"hInfo[id][hExitX]);
            
cache_get_value_name_int(loaded"InsideInt"hInfo[id][hInsideInt]);
            
cache_get_value_name_int(loaded"InsideVir"hInfo[id][hInsideVir]);
            
cache_get_value_name_int(loaded"OutsideInt"hInfo[id][hOutsideInt]);
            
cache_get_value_name_int(loaded"Level"hInfo[id][hLevel]);
            
cache_get_value_name(loaded"Owner"hInfo[id][hOwner], 48);
            
cache_get_value_name_int(loaded"Price"hInfo[id][hPrice]);
            
            
hInfo[id][hEnterX];
            
hInfo[id][hEnterY];
            
hInfo[id][hEnterZ];

            new 
string[255];
            
format(stringsizeof(string), "House %d, x: %d, y:%d, z:%d"idhInfo[id][hEnterX], hInfo[id][hEnterY], hInfo[id][hEnterZ]);
            print(string);

            
loaded++;

            
hInfo[id][hPickup] = CreatePickup(12730XYZ, -1);
        }

        new 
string[255];
        
format(stringsizeof(string), "Loaded %d houses from Database."rows);
        print(string);
    }
    else
    {
        print(
"No house loaded on Database.");
        return 
1;
    }
    return 
1;

Reply
#8

Oh, the coords are not correct, if i check my position, for example is:

1941.3182, 1314.4194, 9.2578

and in database is

1156753967, 1151618412, 1091837952

The /addhouse command:

Код:
CMD:addhouse(playerid, params[])
{
	new model;
	if(sscanf(params, "d", model)) return SendClientMessage(playerid, COLOR_WHITE, ""dr"Usage: "w"/addhouse [1-small 2-medium 3-big]");
	if(model > 3 || model < 1) return SendClientMessage(playerid, COLOR_WHITE, ""dr"Usage: "w"/addhouse [1-small 2-medium 3-big]");

	new Float:px, Float:py, Float:pz, Float:pinterior;
	GetPlayerPos(playerid, px, py, pz);
	pinterior = GetPlayerInterior(playerid);

	if(model == 1)
	{
		new randomsmall = random(sizeof(SmallHouses));
		new DB_Query[600];
	 	mysql_format(Database, DB_Query, sizeof(DB_Query), "INSERT INTO `HOUSES` (`EnterX`, `EnterY`, `EnterZ`, `ExitX`, `ExitY`, `ExitZ`, `InsideInt`, `OutsideInt`, `Level`, `Owner`, `Price`) \
	 		VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', 'None', '%d')", \
	 		px, py, pz, SmallHouses[randomsmall][EH_X], SmallHouses[randomsmall][EH_Y], SmallHouses[randomsmall][EH_Z], SmallHouses[randomsmall][EH_Interior], pinterior, 5, 50000000, 1, 1);
	 	mysql_query(Database, DB_Query);

		mysql_query(Database, "SELECT * FROM `HOUSES`");
		new rows = cache_num_rows();
		new string[255];
		format(string, sizeof(string), ""dr"Small House added (%d) at %d, %d, %d", rows, px, py, pz);
		SendClientMessage(playerid, COLOR_WHITE, string);

		LoadHouses();
		return 1;
	}
i put only the model = 1 because the rest is same
Reply
#9

Quote:
Originally Posted by C0oL3r
Посмотреть сообщение
Oh, the coords are not correct, if i check my position, for example is:

1941.3182, 1314.4194, 9.2578

and in database is

1156753967, 1151618412, 1091837952

The /addhouse command:

Код:
CMD:addhouse(playerid, params[])
{
	new model;
	if(sscanf(params, "d", model)) return SendClientMessage(playerid, COLOR_WHITE, ""dr"Usage: "w"/addhouse [1-small 2-medium 3-big]");
	if(model > 3 || model < 1) return SendClientMessage(playerid, COLOR_WHITE, ""dr"Usage: "w"/addhouse [1-small 2-medium 3-big]");

	new Float:px, Float:py, Float:pz, Float:pinterior;
	GetPlayerPos(playerid, px, py, pz);
	pinterior = GetPlayerInterior(playerid);

	if(model == 1)
	{
		new randomsmall = random(sizeof(SmallHouses));
		new DB_Query[600];
	 	mysql_format(Database, DB_Query, sizeof(DB_Query), "INSERT INTO `HOUSES` (`EnterX`, `EnterY`, `EnterZ`, `ExitX`, `ExitY`, `ExitZ`, `InsideInt`, `OutsideInt`, `Level`, `Owner`, `Price`) \
	 		VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', 'None', '%d')", \
	 		px, py, pz, SmallHouses[randomsmall][EH_X], SmallHouses[randomsmall][EH_Y], SmallHouses[randomsmall][EH_Z], SmallHouses[randomsmall][EH_Interior], pinterior, 5, 50000000, 1, 1);
	 	mysql_query(Database, DB_Query);

		mysql_query(Database, "SELECT * FROM `HOUSES`");
		new rows = cache_num_rows();
		new string[255];
		format(string, sizeof(string), ""dr"Small House added (%d) at %d, %d, %d", rows, px, py, pz);
		SendClientMessage(playerid, COLOR_WHITE, string);

		LoadHouses();
		return 1;
	}
i put only the model = 1 because the rest is same
try this:
PHP код:
VALUES ('%f''%f''%f''%d''%d''%d''%d''%d''%d''None''%d')", \
             px, py, pz, SmallHouses[randomsmall][EH_X], SmallHouses[randomsmall][EH_Y], SmallHouses[randomsmall][EH_Z], SmallHouses[randomsmall][EH_Interior], pinterior, 5, 50000000, 1, 1); 
Reply
#10

edit your database, change the intergers into the float.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)