19.03.2014, 18:40
Hello first I was create house and check database and it's created with all data also I use auto_incremenet and know I buy house but my name and houseowned not saving to that house id so this is part where I buy house. I try all day to fix it but no sucess. Thanks also I check log and in log says that it all fine
here is also part of mysql log when I buy house
pawn Код:
if(dialogid == 37)
{
if(response)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx,Float:oldposy,Float:oldposz;
new playername[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,playername,sizeof(playername));
GetPlayerPos(playerid,oldposx,oldposy,oldposz);
for(new h; h < MAX_KUCA; h++)
{
if(PlayerToPoint(2.0,playerid,KucaInfo[h][hUlazX],KucaInfo[h][hUlazY],KucaInfo[h][hUlazZ]) && KucaInfo[h][hImaVlasnika] == 0)
{
if(PlayerInfo[playerid][Level] < KucaInfo[h][hLevel])
{
format(string,sizeof(string),"Morate biti level %d za kupnju ove kuce!",KucaInfo[h][hLevel]);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
if(PlayerInfo[playerid][Novac] < KucaInfo[h][hCijena]) return SCM(playerid,COLOR_WHITE,"Nemate dovoljno novca za kupnju ove kuce!");
if(PlayerInfo[playerid][Kuca] != -1 && strcmp(playername,KucaInfo[PlayerInfo[playerid][Kuca]][hVlasnik],true) == 0)
{
SendClientMessage(playerid,COLOR_WHITE,"Vec posjedujete kucu,kucajte /kuca prodaj ako zelite da kupite ovu!");
return 1;
}
if(GetPlayerMoney(playerid) > KucaInfo[h][hCijena])
{
new sendername[MAX_PLAYER_NAME];
PlayerInfo[playerid][Kuca] = h;
KucaInfo[h][hImaVlasnika] = 1;
KucaInfo[h][hLock] = 1;
GetPlayerName(playerid,sendername,sizeof(sendername));
strmid(KucaInfo[h][hVlasnik],sendername,0,strlen(sendername),255);
NovacMinus(playerid,KucaInfo[h][hCijena]);
SendClientMessage(playerid,COLOR_WHITE,"Cestitamo na kupovini kuce!");
SendClientMessage(playerid,COLOR_WHITE,"Za vise informacija kucajte /kuca!");
UpdateLabels();
new upit[128];
mysql_format(mysql,upit, sizeof(upit),"UPDATE `users` SET `Kuca` = '%d' WHERE `ID` = '%d'",h,PlayerInfo[playerid][ID]);
mysql_tquery(mysql,upit,"","");
mysql_format(mysql,upit,sizeof(upit),"UPDATE `houses` SET `HouseOwned` = '1',`HouseOwner` = '%s',`Locked` = '1' WHERE `ID` = '%d'",sendername,KucaInfo[h][ID]-this is some id of house also I try just instead of that use h but nothing,);
mysql_tquery(mysql,upit,"","");
return 1;
}
else
{
SendClientMessage(playerid,COLOR_GRAD2,"{F81414}[Greska!] {C3C3C3}Nemas dovoljno novca!");
return 1;
}
}
}
}
}
return 1;
}
here is also part of mysql log when I buy house
pawn Код:
connection: 1, len: 128, format: "UPDATE `houses` SET `HouseOwned` = '1',`HouseOwner` = '%s',`Locked` = '1' WHERE `ID` = '%d'"
19:03:18 mysql_tquery OK connection: 1, query: "UPDATE `houses` SET `HouseOwned` = '1',`HouseOwner` = 'Luca_Rally',`Z", callback: "(null)", format: "(null)"