03.12.2015, 12:12
(
Last edited by vassilis; 03/12/2015 at 01:12 PM.
)
Actually it doesn't even let me buy the house its like nothing happened.
I have created a command name /buyhouse which will spawn a dialog to set the name of the house
when i put the text it doesnt update the label and doesn't even buy the house?
I noticed at mysql_log that i have a syntax error but there is none.
So what i noticed is that it doesn't even call the BuyHouse function.. WHY? D:
Mysql_log
EDIT : SO I FIXED ONE - TWO THINGS I FOUND BY MY OWN BUT NOT I NOTICE THAT IT UPDATES THE LABEL BUT SETS HOUSENAME AS BLANK!
I have created a command name /buyhouse which will spawn a dialog to set the name of the house
when i put the text it doesnt update the label and doesn't even buy the house?
I noticed at mysql_log that i have a syntax error but there is none.
PHP Code:
case DIALOG_BUYHOUSE:
{
new hid = GetHouseID(playerid);
new query[200];
if(!response) return SendClientMessage(playerid, -1, ""COL_RED"SERVER"COL_WHITE": You decided not to buy a house. The house sale got cancelled!");
if(strlen(inputtext) > 30) return SendClientMessage(playerid, -1, ""COL_RED"SERVER"COL_WHITE"You must set a name less than 30 characters!");
mysql_format(mysql,query,sizeof(query),"UPDATE `houses` SET `HName` = '%s' WHERE `hID` = %d",inputtext,HouseInfo[hid][hID]);
mysql_tquery(mysql,query);
inputtext[30] = HouseInfo[hid][HName];
BuyHouse(playerid);
}
PHP Code:
function BuyHouse(playerid)
{
new query[400],label[150];
new houseid = GetHouseID(playerid);
HouseInfo[houseid][HOwned] = true;
mysql_format(mysql,query,sizeof(query), "UPDATE `houses` SET `HOwned` = 1",HouseInfo[houseid][HOwned]);
mysql_query(mysql, query);
mysql_format(mysql,query,sizeof(query),"UPDATE `houses` SET `HOwnerID`= (SELECT `ID` FROM `players` WHERE `Username` = '%s') WHERE `HID` = '%d'",Name[playerid],HouseInfo[houseid][hID]);
mysql_query(mysql,query);
format(label,sizeof(label),""COL_GREEN"HouseName"COL_WHITE":%s\n"COL_GREEN"",HouseInfo[houseid][HName]);
UpdateDynamic3DTextLabelText(HouseInfo[houseid][H3D],COLOR_YELLOW,label);
return 1;
}
pawn Code:
5:08:58] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE from `houses` SET `HName` = 'blah' WHERE `hID` = 0", callback: "(null)", format: "(null)"
[15:08:58] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[15:08:58] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from `houses` SET `HName` = 'blah' WHERE `hID` = 0' at line 1
[15:08:58] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
[15:08:58] [DEBUG] Calling callback "OnQueryError"..
EDIT : SO I FIXED ONE - TWO THINGS I FOUND BY MY OWN BUT NOT I NOTICE THAT IT UPDATES THE LABEL BUT SETS HOUSENAME AS BLANK!