[02:03:52] CMySQLHandler::Query(UPDATE `house` SET EnterX=-329.548034,EnterY=-329.548034,EnterZ=-329.548034,ExitX=2350.339843,ExitY=-1181.649902,ExitZ=1027.976562,Owner=Sa[]e,Owned=97,Price=101,Inter=5 WHERE id='1') - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[]e,Owned=97,Price=101,Inter=5 WHERE id='1'' at line 1) |
strmid(HouseInfo[home][hOwner], pname, 0, strlen(pname), 255);
stock HouseUpdate(idx)
{
new src[MAX_STRING],query[MAX_QUERY];
format(query,sizeof(query),"UPDATE `"HouseTable"` SET ");
format(src,sizeof(src),"EnterX=%f,",HouseInfo[idx][hEnterX]);
strcat(query,src,sizeof(query));
format(src,sizeof(src),"EnterY=%f,",HouseInfo[idx][hEnterY]);
strcat(query,src,sizeof(query));
format(src,sizeof(src),"EnterZ=%f,",HouseInfo[idx][hEnterZ]);
strcat(query,src,sizeof(query));
format(src,sizeof(src),"ExitX=%f,",HouseInfo[idx][hExitX]);
strcat(query,src,sizeof(query));
format(src,sizeof(src),"ExitY=%f,",HouseInfo[idx][hExitY]);
strcat(query,src,sizeof(query));
format(src,sizeof(src),"ExitZ=%f,",HouseInfo[idx][hExitZ]);
strcat(query,src,sizeof(query));
format(src,sizeof(src),"Owner=%s,",HouseInfo[idx][hOwner]);
strcat(query,src,sizeof(query));
format(src,sizeof(src),"Owned=%d,",HouseInfo[idx][hOwned]);
strcat(query,src,sizeof(query));
format(src,sizeof(src),"Price=%d,",HouseInfo[idx][hPrice]);
strcat(query,src,sizeof(query));
format(src,sizeof(src),"Inter=%d",HouseInfo[idx][hInt]);
strcat(query,src,sizeof(query));
format(src,sizeof(src)," WHERE id='%d'",idx);
strcat(query,src,sizeof(query));
mysql_query(query);
return 1;
}
format(src,sizeof(src),"Owner='%s',",HouseInfo[idx][hOwner]);
if(dialogid == 22)
{
if(response)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new home = 1; home < MAX_HOUSE; home++)
{
if (PlayerToPoint(2, playerid,HouseInfo[home][hEnterX],HouseInfo[home][hEnterY],HouseInfo[home][hEnterZ]))
{
if(GetPVarInt(playerid,"House") != 0)
{
SendClientMessage(playerid, COLOR_WHITE, " У вас уже есть дом, продайте его через меню >> дома >> продать");
return 1;
}
if(GetPlayerMoney(playerid) > HouseInfo[home][hPrice])
{
new plname[MAX_PLAYER_NAME],sql[256],string[256];
GetPlayerName(playerid,plname,sizeof(plname));
GivePlayerMoney(playerid,-HouseInfo[home][hPrice]);
SetPVarInt(playerid,"House",home);
SetPVarInt(playerid,"Int",HouseInfo[home][hInt]);
SetPVarInt(playerid,"Local",HouseInfo[home][hInt]);
SendClientMessage(playerid, COLOR_WHITE, "Поздравляем, с покупкой дома !");
SendClientMessage(playerid, COLOR_WHITE, "Используйте /help чтобы посмотреть команды для дома !");
SendClientMessage(playerid, COLOR_WHITE, "Используйте C(кнопка присесть) что бы войти в дом !");
HouseInfo[home][hId] = home; // для цифр
HouseInfo[home][hEnterX] = x;
HouseInfo[home][hEnterY] = y;
HouseInfo[home][hEnterZ] = z;
HouseInfo[home][hExitX] = 2350.33984;
HouseInfo[home][hExitY] = -1181.64990;
HouseInfo[home][hExitZ] = 1027.97656;
HouseInfo[home][hOwned] = 1;
strmid(HouseInfo[home][hOwner], plname, 0, sizeof(plname)*4, sizeof(plname)*4);
HouseInfo[home][hInt] = 5;
HouseInfo[home][hPrice] = HouseInfo[home][hPrice];
format(sql, 256, "UPDATE `"HouseTable"` SET EnterX='%f',EnterY='%f',EnterZ='%f',ExitX='%f',ExitY='%f',ExitZ='%f',Owner='%s',Owned='%d',Price='%d',Inter='%d' WHERE id=%d",
HouseInfo[home][hEnterX],
HouseInfo[home][hEnterY],
HouseInfo[home][hEnterZ],
HouseInfo[home][hExitX],
HouseInfo[home][hExitY],
HouseInfo[home][hExitZ],
HouseInfo[home][hOwner],
plname,
HouseInfo[home][hPrice],
HouseInfo[home][hInt],
home );
mysql_query(sql);
MySQL_Player_Update(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, " У вас нет столько денег !");
return 1;
}
}
}
}
else
{
return 1;
}
}