House system
#1

Hello, i found a house system tutorial and now i have some errors.:
Код:
CreateHouse("House 1", 35000 -3724.7620, -1651.9816, 4.4582, 442.8380, 508.8443, 1000.3121, 1, 25000);//1795
Код:
stock CreateHouse(const HouseName[], CostP, Float:EnterX, Float:EnterY, Float:EnterZ, Float:TeleX, Float:TeleY, Float:TeleZ, Interiorx, SellP)
{
    format(nInfo[houseid][namo_pav], 100, "%s", HouseName);
    nInfo[houseid][pirkimoverte] = CostP;
    nInfo[houseid][EnterPos][0] = EnterX;
    nInfo[houseid][EnterPos][1] = EnterY;
    nInfo[houseid][EnterPos][2] = EnterZ;
    nInfo[houseid][TelePos][0] = TeleX;
    nInfo[houseid][TelePos][1] = TeleY;
    nInfo[houseid][TelePos][2] = TeleZ;
    nInfo[houseid][pardavimoverte] = SellP;
    nInfo[houseid][interjeras] = Interiorx;
    new query[100];
    format(query, sizeof(query), "SELECT `savininko_vardas` FROM `namas` WHERE `namo_pav` = '%s'", HouseName); //Formats the SELECT query
	mysql_tquery(manomysql, query, "", "");
	
	new num_rows;
	cache_get_row_count(num_rows);
    if(num_rows != 0) cache_get_value_name(manomysql, "savininko_vardas", nInfo[houseid][savininko_vardas], MAX_PLAYER_NAME);//1748
    
    nInfo[houseid][checkpointidx][0] = CreateDynamicCP(EnterX, EnterY, EnterZ, 1.0);
    //CreateDynamicCP(Float:x, Float:y, Float:z, Float:size);
    nInfo[houseid][checkpointidx][1] = CreateDynamicCP(TeleX, TeleY, TeleZ, 1.0, 15500000+houseid, Interiorx);
    //CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid, interiorid);
    if(!nInfo[houseid][savininko_vardas][0]) format(query, sizeof(query), "Namas: %s \n Namo vertė:%d \n Pardavimo vertė: %d", HouseName, CostP, SellP);
    //If there is nothing in the owners variable, we check if the first cell doesn't have a character.
    else if(nInfo[houseid][savininko_vardas][0] != 0) format(query, sizeof(query), "Namas: %s \n Savininkas: %s", HouseName, nInfo[houseid][savininko_vardas]);
    //If there is something in the owners variable we check if the first cell has a character.
    nInfo[houseid][textid] = CreateDynamic3DTextLabel(query, 0xFFFFFF, EnterX, EnterY, EnterZ + 0.5, 50.0);
    //CreateDynamic3DTextLabel(const text[], color, Float:x, Float:y, Float:z, Float:drawdistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 100.0);
    houseid ++; //We go to the next free slot in our variable.
    return 1;
}
Tutorial: https://forum.sa-mp.com/showthread.p...ighlight=house


Errors:
Quote:

(1748 ) : warning 213: tag mismatch: expected tag none ("_"), but found "MySQL"
(1795) : warning 213: tag mismatch: expected tag none ("_"), but found "Float"
(1795) : warning 202: number of arguments does not match definition

Reply
#2

The MySQL version is different than the one you use.

Check your mysql (a_mysql I suppose) include and see what's different in the mysql_tquery function.
Reply
#3

Quote:
Originally Posted by NaS
Посмотреть сообщение
The MySQL version is different than the one you use.

Check your mysql (a_mysql I suppose) include and see what's different in the mysql_tquery function.
include and plugin is r41-4 and mysql_tquery i'm using a lot of times in my code but error is just here.
Reply
#4

Quote:
Originally Posted by NaS
Посмотреть сообщение
The MySQL version is different than the one you use.

Check your mysql (a_mysql I suppose) include and see what's different in the mysql_tquery function.
MySQL version has nothing to do with that errors.

@OP: Check your enum, probably you're missing a Float: somewhere.

Also check your "new". I had this problem before but after working with that functions i managed to fix it.
Reply
#5

Quote:
Originally Posted by SymonClash
Посмотреть сообщение
MySQL version has nothing to do with that errors.

@OP: Check your enum, probably you're missing a Float: somewhere.

Also check your "new". I had this problem before but after working with that functions i managed to fix it.
part of enum
Код:
	namo_pav[24],
	savininko_vardas[MAX_PLAYER_NAME],
	pirkimoverte,
 	Float:EnterPos[3],
    Float:TelePos[3],
	pardavimoverte,
	interjeras,
	bool:arUzrakintas,
	Text3D:textid,
	checkpointidx[2],
Reply
#6

maybe split your createhouse function into functions, its easier to work with it.
and stop using 2010 tutorials for creating systems.
it would be must easier for you to use YSI_Data\y_iterate for adding and removing houses.
Reply
#7

Код:
CreateHouse("House 1", 35000 ,-3724.7620, -1651.9816, 4.4582, 442.8380, 508.8443, 1000.3121, 1, 25000);//1795
Reply
#8

Quote:
Originally Posted by UFF
Посмотреть сообщение
Код:
CreateHouse("House 1", 35000 ,-3724.7620, -1651.9816, 4.4582, 442.8380, 508.8443, 1000.3121, 1, 25000);//1795
Yeah, i missed ",", but still have this error:
Quote:

(174 : warning 213: tag mismatch: expected tag none ("_"), but found "MySQL"

line:
Код:
	new num_rows;
	cache_get_row_count(num_rows);
    if(num_rows != 0) cache_get_value_name(manomysql, "savininko_vardas", nInfo[houseid][savininko_vardas], MAX_PLAYER_NAME);
Reply
#9

no need
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)