29.03.2014, 17:35
Well, MySQL part is fine as I checked the connection as well and it worked before, just recently added a new system and OnDialogResponse got messed up (I assume) since when I tried to run a debug on OnDialogResponse (at the very beginning of the public), it didn't work (didn't print).
The last things I've added:
And I'm not sure why it ain't working. Thanks!
The last things I've added:
pawn Код:
case DIALOG_FURNITURE_MMENU:
{
if(response)
{
new hid = PlayerInfo[playerid][pInHouse], obj;
switch(listitem)
{
case 0:
ShowPlayerDialog(playerid, DIALOG_FURNITURE_FMENU, DIALOG_STYLE_LIST, "Select one of the categories:", "Tables\nChairs\nBeds\nSofas\nApplicances\nDecorations", "Select", "Back");
case 2: {
new flist[1000];
for(new f=0;f<10;f++)
{
if(HouseInfo[hid][hObject][f] > 0)
{
obj = HouseInfo[hid][hObject][f];
format(flist,sizeof(flist),"%s%s\n",flist,ObjectInfo[obj][oName]);
}
}
ShowPlayerDialog(playerid, DIALOG_FURNITURE_SELL, DIALOG_STYLE_LIST, "Furniture list:", flist, "Continue", "Back");
}
}
}
}
case DIALOG_FURNITURE_FMENU:
{
if(response)
{
new string[1024];
switch(listitem)
{
case 0:
{
for(new t=0;t<sizeof(Tables);t++)
{
format(string,sizeof(string),"%s%s\n",string,Tables[t][tablename]);
ShowPlayerDialog(playerid, DIALOG_FURNITURE_TMENU, DIALOG_STYLE_LIST, "Select a table:", string, "Select", "Back");
}
}
case 1:
{
for(new t=0;t<sizeof(Chairs);t++)
{
format(string,sizeof(string),"%s%s\n",string,Chairs[t][chairname]);
ShowPlayerDialog(playerid, DIALOG_FURNITURE_CMENU, DIALOG_STYLE_LIST, "Select a chair:", string, "Select", "Back");
}
}
case 2:
{
for(new t=0;t<sizeof(Beds);t++)
{
format(string,sizeof(string),"%s%s\n",string,Beds[t][bedname]);
ShowPlayerDialog(playerid, DIALOG_FURNITURE_BMENU, DIALOG_STYLE_LIST, "Select a bed:", string, "Select", "Back");
}
}
case 3:
{
for(new t=0;t<sizeof(Sofas);t++)
{
format(string,sizeof(string),"%s%s\n",string,Sofas[t][sofaname]);
ShowPlayerDialog(playerid, DIALOG_FURNITURE_SMENU, DIALOG_STYLE_LIST, "Select a sofa:", string, "Select", "Back");
}
}
}
}
}
case DIALOG_FURNITURE_TMENU:
{
if(response)
{
new Float:pX, Float: pY, Float:pZ, string[128];
GetPlayerPos(playerid, pX, pY, pZ);
ObjPreview[playerid] = CreateDynamicObject(Tables[listitem][tid], pX, pY+2, pZ, 0, 0, 0, 0, -1, -1, 15);
ObjModel[playerid] = Tables[listitem][tid];
ObjPrice[playerid] = Tables[listitem][tableprice];
format(string,sizeof(string),"You are about to buy a new object\n{00FFFF}Object name: {b7ba00}%s\n{00FFFF}Object price: {b7ba00}%d\n\n {00FFFF}Are you sure you want that object?",Tables[listitem][tablename],Tables[listitem][tableprice]);
ShowPlayerDialog(playerid, DIALOG_FURNITURE_BUY, DIALOG_STYLE_MSGBOX, "Furniture", string, "Yes", "No");
}
}
case DIALOG_FURNITURE_CMENU:
{
if(response)
{
new Float:pX, Float: pY, Float:pZ, string[128];
GetPlayerPos(playerid, pX, pY, pZ);
ObjPreview[playerid] = CreateDynamicObject(Chairs[listitem][cid], pX, pY+2, pZ, 0, 0, 0, 0, -1, -1, 15);
ObjModel[playerid] = Chairs[listitem][cid];
ObjPrice[playerid] = Chairs[listitem][chairprice];
format(string,sizeof(string),"You are about to buy a new object\n{00FFFF}Object name: {b7ba00}%s\n{00FFFF}Object price: {b7ba00}%d\n\n {00FFFF}Are you sure you want that object?",Chairs[listitem][chairname],Chairs[listitem][chairprice]);
ShowPlayerDialog(playerid, DIALOG_FURNITURE_BUY, DIALOG_STYLE_MSGBOX, "Furniture", string, "Yes", "No");
}
}
case DIALOG_FURNITURE_BMENU:
{
if(response)
{
new Float:pX, Float: pY, Float:pZ, string[128];
GetPlayerPos(playerid, pX, pY, pZ);
ObjPreview[playerid] = CreateDynamicObject(Beds[listitem][bid], pX, pY+2, pZ, 0, 0, 0, 0, -1, -1, 15);
ObjModel[playerid] = Beds[listitem][bid];
ObjPrice[playerid] = Beds[listitem][bedprice];
format(string,sizeof(string),"You are about to buy a new object\n{00FFFF}Object name: {b7ba00}%s\n{00FFFF}Object price: {b7ba00}%d\n\n {00FFFF}Are you sure you want that object?",Beds[listitem][bedname],Beds[listitem][bedprice]);
ShowPlayerDialog(playerid, DIALOG_FURNITURE_BUY, DIALOG_STYLE_MSGBOX, "Furniture", string, "Yes", "No");
}
}
case DIALOG_FURNITURE_SMENU:
{
if(response)
{
new Float:pX, Float: pY, Float:pZ, string[128];
GetPlayerPos(playerid, pX, pY, pZ);
ObjPreview[playerid] = CreateDynamicObject(Sofas[listitem][sid], pX, pY+2, pZ, 0, 0, 0, 0, -1, -1, 15);
ObjModel[playerid] = Sofas[listitem][sid];
ObjPrice[playerid] = Sofas[listitem][sofaprice];
format(string,sizeof(string),"You are about to buy a new object\n{00FFFF}Object name: {b7ba00}%s\n{00FFFF}Object price: {b7ba00}%d\n\n {00FFFF}Are you sure you want that object?",Sofas[listitem][sofaname],Sofas[listitem][sofaprice]);
ShowPlayerDialog(playerid, DIALOG_FURNITURE_BUY, DIALOG_STYLE_MSGBOX, "Furniture", string, "Yes", "No");
}
}
case DIALOG_FURNITURE_BUY:
{
if(response)
{
if(GetPlayerMoney(playerid) < ObjPrice[playerid])
{
SendClientMessage(playerid,COLOR_WHITE,"Not enough money!");
DestroyDynamicObject(ObjPreview[playerid]);
ObjPreview[playerid] = 0;
ObjModel[playerid] = 0;
ObjPrice[playerid] = 0;
return 1;
}
new Float:oX,Float:oY,Float:oZ;
new Float:rX,Float:rY,Float:rZ;
new q[256];
GetDynamicObjectRot(ObjPreview[playerid],rX,rY,rZ);
new wid = GetPlayerVirtualWorld(playerid);
new pint = GetPlayerInterior(playerid);
new freeslot;
GetDynamicObjectPos(ObjPreview[playerid],oX,oY,oZ);
format(q,sizeof(q),"INSERT INTO `objects` (`modelid`,`x`,`y`,`z`,`rx,`ry`,`rz`,`worldid`,`interiorid`,`type`,`houseid`,`name`,`oid`) VALUES ('%i','%f','%f','%f','%f','%f','%f','%i','%i','0','%i','%s','%i')",
ObjModel[playerid],oX,oY,oZ,rX,rY,rZ,wid,pint,PlayerInfo[playerid][pInHouse],ObjName[playerid],ObjPreview[playerid]);
mysql_query(q);
for(new i=0;i<10;i++)
if(!HouseInfo[PlayerInfo[playerid][pInHouse]][hObject][i])
freeslot = i;
HouseInfo[PlayerInfo[playerid][pInHouse]][hObject][freeslot] = ObjPreview[playerid];
usingslot[playerid] = freeslot;
ObjectInfo[ObjPreview[playerid]][oID] = ObjPreview[playerid];
ObjectInfo[ObjPreview[playerid]][oModel] = ObjModel[playerid];
ObjectInfo[ObjPreview[playerid]][x] = oX;
ObjectInfo[ObjPreview[playerid]][y] = oY;
ObjectInfo[ObjPreview[playerid]][z] = oZ;
ObjectInfo[ObjPreview[playerid]][rx] = rX;
ObjectInfo[ObjPreview[playerid]][ry] = rY;
ObjectInfo[ObjPreview[playerid]][rz] = rZ;
ObjectInfo[ObjPreview[playerid]][worldid] = wid;
ObjectInfo[ObjPreview[playerid]][interiorid] = pint;
ObjectInfo[ObjPreview[playerid]][hID] = PlayerInfo[playerid][pInHouse];
DestroyDynamicObject(ObjPreview[playerid]);
Obj[ObjPreview[playerid]] = CreateDynamicObject(ObjectInfo[ObjPreview[playerid]][oModel],ObjectInfo[ObjPreview[playerid]][x],ObjectInfo[ObjPreview[playerid]][y],ObjectInfo[ObjPreview[playerid]][z],ObjectInfo[ObjPreview[playerid]][rx],ObjectInfo[ObjPreview[playerid]][ry],ObjectInfo[ObjPreview[playerid]][rz],ObjectInfo[ObjPreview[playerid]][worldid],ObjectInfo[ObjPreview[playerid]][interiorid],-1,50.0);
EditDynamicObject(playerid,HouseInfo[PlayerInfo[playerid][pInHouse]][hObject][freeslot]);
editingobject[playerid] = HouseInfo[PlayerInfo[playerid][pInHouse]][hObject][freeslot];
usingslot[playerid] = -1;
ObjPreview[playerid] = 0;
ObjModel[playerid] = 0;
ObjPrice[playerid] = 0;
}
}
}
return 0;
}
And I'm not sure why it ain't working. Thanks!