Filterscript ondialogresponse won't work
#1

Hi. On my server, I put an house filterscript.

Every command works, but when you press "BUY" at dialogresponse, it won't do anything.

Can you help?

PHP код:
if(dialogid == DIALOG_HOUSE)
    {
        if(!
response) return 1;
        new 
id GetPVarInt(playerid"PickupHouseID");
        if(!
IsPlayerInRangeOfPoint(playerid2.0HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ])) return SendClientMessage(playerid0xE74C3CFF"You're not near any house.");
        if(
HouseData[id][Price] > pInfo[playerid][Money]) return SendClientMessage(playerid0xE74C3CFF"You can't afford this house.");
        
pInfo[playerid][Money] -= HouseData[id][Price];
        
GetPlayerName(playeridHouseData[id][Owner], MAX_PLAYER_NAME);
        
HouseData[id][LastEntered] = gettime();
        
HouseData[id][Save] = true;
        
        
UpdateHouseLabel(id);
        
Streamer_SetIntData(STREAMER_TYPE_PICKUPHouseData[id][HousePickup], E_STREAMER_MODEL_ID19522);
        
Streamer_SetIntData(STREAMER_TYPE_MAP_ICONHouseData[id][HouseIcon], E_STREAMER_TYPE32);
        
SendToHouse(playeridid);
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+1)
    {
        if(!
response) return 1;
        new 
id GetPVarInt(playerid"PickupHouseID");
        if(!
IsPlayerInRangeOfPoint(playerid2.0HouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ])) return SendClientMessage(playerid0xE74C3CFF"You're not near any house.");
        if(!(
<= strlen(inputtext) <= MAX_HOUSE_PASSWORD)) return ShowPlayerDialog(playeridDIALOG_HOUSE+1DIALOG_STYLE_INPUT"House Password""This house is password protected.\n\nEnter house password:\n\n{E74C3C}The password you entered is either too short or too long.""Try Again""Close");
        if(
strcmp(HouseData[id][Password], inputtext)) return ShowPlayerDialog(playeridDIALOG_HOUSE+1DIALOG_STYLE_INPUT"House Password""This house is password protected.\n\nEnter house password:\n\n{E74C3C}Wrong password.""Try Again""Close");
        
SendToHouse(playeridid);
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+2)
    {
        if(!
response) return 1;
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        if(
listitem == 0ShowPlayerDialog(playeridDIALOG_HOUSE+3DIALOG_STYLE_INPUT"House Name""Write a new name for this house:""Change""Back");
        if(
listitem == 1ShowPlayerDialog(playeridDIALOG_HOUSE+4DIALOG_STYLE_INPUT"House Password""Write a new password for this house:""Change""Back");
        if(
listitem == 2ShowPlayerDialog(playeridDIALOG_HOUSE+5DIALOG_STYLE_LIST"House Lock""Not Locked\nPassword Lock\nKeys\nOwner Only""Change""Back");
        if(
listitem == 3)
        {
            new 
string[144];
            
format(stringsizeof(string), "Take Money From Safe {2ECC71}($%s)\nPut Money To Safe {2ECC71}($%s)\nView Safe History\nClear Safe History"convertNumber(HouseData[id][SafeMoney]), convertNumber(GetPlayerMoney(playerid)));
            
ShowPlayerDialog(playeridDIALOG_HOUSE+6DIALOG_STYLE_LIST"House Safe"string"Choose""Back");
        }
        
        if(
listitem == 4ShowPlayerDialog(playeridDIALOG_HOUSE+11DIALOG_STYLE_LIST"Furnitures""Buy Furniture\nEdit Furniture\nSell Furniture\nSell All Furnitures""Choose""Back");
        if(
listitem == 5ShowPlayerDialog(playeridDIALOG_HOUSE+9DIALOG_STYLE_LIST"Guns""Put Gun\nTake Gun""Choose""Back");
        if(
listitem == 6)
        {
            
ListPage[playerid] = 0;
            
ShowPlayerDialog(playeridDIALOG_HOUSE+14DIALOG_STYLE_LIST"Visitors""Look Visitor History\nClear Visitor History""Choose""Back");
        }
        
        if(
listitem == 7)
        {
            
ListPage[playerid] = 0;
            
ShowPlayerDialog(playeridDIALOG_HOUSE+16DIALOG_STYLE_LIST"Keys""View Key Owners\nChange Locks""Choose""Back");
        }
        
        if(
listitem == 8)
        {
            new 
string[128];
            
format(stringsizeof(string), "House owner %s kicked everybody from the house."HouseData[id][Owner]);
            
            foreach(new 
Player)
            {
                if(
== playerid) continue;
                if(
InHouse[i] == id)
                {
                    
SetPVarInt(i"HousePickupCooldown"tickcount()+8000);
                    
SetPlayerVirtualWorld(i0);
                    
SetPlayerInterior(i0);
                    
SetPlayerPos(iHouseData[id][houseX], HouseData[id][houseY], HouseData[id][houseZ]);
                    
InHouse[i] = INVALID_HOUSE_ID;
                    
SendClientMessage(i, -1string);
                }
            }
            
            
SendClientMessage(playerid, -1"You kicked everybody from your house.");
        }
        
        if(
listitem == 9)
        {
            new 
money floatround(HouseData[id][Price] * 0.85) + HouseData[id][SafeMoney];
            
pInfo[playerid][Money] += money;
            
ResetHouse(id);
        }
        
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+3)
    {
        if(!
response) return ShowHouseMenu(playerid);
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        if(!(
<= strlen(inputtext) <= MAX_HOUSE_NAME)) return ShowPlayerDialog(playeridDIALOG_HOUSE+3DIALOG_STYLE_INPUT"House Name""Write a new name for this house:\n\n{E74C3C}The name you entered is either too short or too long.""Change""Back");
        
format(HouseData[id][Name], MAX_HOUSE_NAME"%s"inputtext);
        
HouseData[id][Save] = true;
        
        
UpdateHouseLabel(id);
        
ShowHouseMenu(playerid);
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+4)
    {
        if(!
response) return ShowHouseMenu(playerid);
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        if(!(
<= strlen(inputtext) <= MAX_HOUSE_PASSWORD)) return ShowPlayerDialog(playeridDIALOG_HOUSE+3DIALOG_STYLE_INPUT"House Name""Write a new name for this house:\n\n{E74C3C}The name you entered is either too short or too long.""Change""Back");
        
format(HouseData[id][Password], MAX_HOUSE_PASSWORD"%s"inputtext);
        
HouseData[id][Save] = true;
        
ShowHouseMenu(playerid);
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+5)
    {
        if(!
response) return ShowHouseMenu(playerid);
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        
HouseData[id][LockMode] = listitem;
        
HouseData[id][Save] = true;
        
UpdateHouseLabel(id);
        
ShowHouseMenu(playerid);
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+6)
    {
        if(!
response) return ShowHouseMenu(playerid);
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        if(
listitem == 0ShowPlayerDialog(playeridDIALOG_HOUSE+7DIALOG_STYLE_INPUT"Safe: Take Money""Write the amount you want to take from safe:""Take""Back");
        if(
listitem == 1ShowPlayerDialog(playeridDIALOG_HOUSE+8DIALOG_STYLE_INPUT"Safe: Put Money""Write the amount you want to put to safe:""Put""Back");
        if(
listitem == 2)
        {
            
ListPage[playerid] = 0;
            
            new 
query[200], Cachesafelog;
            
mysql_format(SQLHandlequerysizeof(query), "SELECT Type, Amount, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as TransactionDate FROM housesafelogs WHERE HouseID=%d ORDER BY Date DESC LIMIT 0, 15"id);
            
safelog mysql_query(SQLHandlequery);
            new 
rows cache_num_rows();
            if(
rows) {
                new list[
1024], date[20];
                
format(list, sizeof(list), "Action\tDate\n");
                for(new 
irows; ++i)
                {
                    
cache_get_field_content(i"TransactionDate"date);
                    
format(list, sizeof(list), "%s%s $%s\t{FFFFFF}%s\n", list, TransactionNamescache_get_field_content_int(i"Type") ], convertNumber(cache_get_field_content_int(i"Amount")), date);
                }
                
ShowPlayerDialog(playeridDIALOG_HOUSE+18DIALOG_STYLE_TABLIST_HEADERS"Safe History (Page 1)", list, "Next""Previous");
            }else{
                
SendClientMessage(playerid0xE74C3CFF"Can't find any safe history.");
            }
            
cache_delete(safelog);
        }
        
        if(
listitem == 3)
        {
            new 
query[64];
            
mysql_format(SQLHandlequerysizeof(query), "DELETE FROM housesafelogs WHERE HouseID=%d"id);
            
mysql_tquery(SQLHandlequery"""");
            
ShowHouseMenu(playerid);
        }
        
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+7)
    {
        if(!
response) return ShowHouseMenu(playerid);
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        new 
amount strval(inputtext);
        if(!(
<= amount <= 10000000)) return ShowPlayerDialog(playeridDIALOG_HOUSE+7DIALOG_STYLE_INPUT"Safe: Take Money""Write the amount you want to take from safe:\n\n{E74C3C}Invalid amount. You can take between $1 - $10,000,000 at a time.""Take""Back");
        if(
amount HouseData[id][SafeMoney]) return ShowPlayerDialog(playeridDIALOG_HOUSE+7DIALOG_STYLE_INPUT"Safe: Take Money""Write the amount you want to take from safe:\n\n{E74C3C}You don't have that much money in your safe.""Take""Back");
        new 
query[128];
        
mysql_format(SQLHandlequerysizeof(query), "INSERT INTO housesafelogs SET HouseID=%d, Type=0, Amount=%d, Date=UNIX_TIMESTAMP()"idamount);
        
mysql_tquery(SQLHandlequery"""");
        
pInfo[playerid][Money] += amount;
        
HouseData[id][SafeMoney] -= amount;
        
HouseData[id][Save] = true;
        
ShowHouseMenu(playerid);
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+8)
    {
        if(!
response) return ShowHouseMenu(playerid);
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        new 
amount strval(inputtext);
        if(!(
<= amount <= 10000000)) return ShowPlayerDialog(playeridDIALOG_HOUSE+8DIALOG_STYLE_INPUT"Safe: Put Money""Write the amount you want to put to safe:\n\n{E74C3C}Invalid amount. You can put between $1 - $10,000,000 at a time.""Put""Back");
        if(
amount GetPlayerMoney(playerid)) return ShowPlayerDialog(playeridDIALOG_HOUSE+8DIALOG_STYLE_INPUT"Safe: Put Money""Write the amount you want to put to safe:\n\n{E74C3C}You don't have that much money on you.""Put""Back");
        new 
query[128];
        
mysql_format(SQLHandlequerysizeof(query), "INSERT INTO housesafelogs SET HouseID=%d, Type=1, Amount=%d, Date=UNIX_TIMESTAMP()"idamount);
        
mysql_tquery(SQLHandlequery"""");
        
        
pInfo[playerid][Money] += -amount;
        
HouseData[id][SafeMoney] += amount;
        
HouseData[id][Save] = true;
        
ShowHouseMenu(playerid);
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+9)
    {
        if(!
response) return ShowHouseMenu(playerid);
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        if(
listitem == 0)
        {
            if(
GetPlayerWeapon(playerid) == 0) return SendClientMessage(playerid0xE74C3CFF"You can't put your fists in your house.");
            new 
query[128], weapon GetPlayerWeapon(playerid), ammo GetPlayerAmmo(playerid);
            
RemovePlayerWeapon(playeridweapon);
            
mysql_format(SQLHandlequerysizeof(query), "INSERT INTO houseguns VALUES (%d, %d, %d) ON DUPLICATE KEY UPDATE Ammo=Ammo+%d"idweaponammoammo);
            
mysql_tquery(SQLHandlequery"""");
            
ShowHouseMenu(playerid);
        }
        
        if(
listitem == 1)
        {
            new 
query[80], Cacheweapons;
            
mysql_format(SQLHandlequerysizeof(query), "SELECT WeaponID, Ammo FROM houseguns WHERE HouseID=%d ORDER BY WeaponID ASC"id);
            
weapons mysql_query(SQLHandlequery);
            new 
rows cache_num_rows();
            if(
rows) {
                new list[
512], weapname[32];
                
format(list, sizeof(list), "#\tWeapon Name\tAmmo\n");
                for(new 
irows; ++i)
                {
                    
GetWeaponName(cache_get_field_content_int(i"WeaponID"), weapnamesizeof(weapname));
                    
format(list, sizeof(list), "%s%d\t%s\t%s\n", list, i+1weapnameconvertNumber(cache_get_field_content_int(i"Ammo")));
                }
                
                
ShowPlayerDialog(playeridDIALOG_HOUSE+10DIALOG_STYLE_TABLIST_HEADERS"House Guns", list, "Take""Back");
            }else{
                
SendClientMessage(playerid0xE74C3CFF"You don't have any guns in your house.");
            }
            
            
cache_delete(weapons);
        }
        
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+10)
    {
        if(!
response) return ShowHouseMenu(playerid);
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
          new 
query[96], Cacheweapon;
        
mysql_format(SQLHandlequerysizeof(query), "SELECT WeaponID, Ammo FROM houseguns WHERE HouseID=%d ORDER BY WeaponID ASC LIMIT %d, 1"idlistitem);
        
weapon mysql_query(SQLHandlequery);
        new 
rows cache_num_rows();
        if(
rows) {
              new 
string[64], weapname[32], weaponid cache_get_field_content_int(0"WeaponID");
              
GetWeaponName(weaponidweapnamesizeof(weapname));
              
GivePlayerWeapon(playeridweaponidcache_get_field_content_int(0"Ammo"));
            
format(stringsizeof(string), "You've taken a %s from your house."weapname);
            
SendClientMessage(playerid0xFFFFFFFFstring);
            
mysql_format(SQLHandlequerysizeof(query), "DELETE FROM houseguns WHERE HouseID=%d AND WeaponID=%d"idweaponid);
            
mysql_tquery(SQLHandlequery"""");
        }else{
            
SendClientMessage(playerid0xE74C3CFF"Can't find that weapon.");
        }
        
cache_delete(weapon);
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+11)
    {
        if(!
response) return ShowHouseMenu(playerid);
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        
        if(
listitem == 0)
        {
            new list[
512];
            
format(list, sizeof(list), "#\tFurniture Name\tPrice\n");
            for(new 
isizeof(HouseFurnitures); ++i)
            {
                
format(list, sizeof(list), "%s%d\t%s\t$%s\n", list, i+1HouseFurnitures[i][Name], convertNumber(HouseFurnitures[i][Price]));
            }
            
ShowPlayerDialog(playeridDIALOG_HOUSE+12DIALOG_STYLE_TABLIST_HEADERS"Buy Furniture", list, "Buy""Back");
        }
        
        if(
listitem == 1)
        {
            
SelectMode[playerid] = SELECT_MODE_EDIT;
            
SelectObject(playerid);
            
SendClientMessage(playerid0xFFFFFFFF"Click on the furniture you want to edit.");
        }
        
        if(
listitem == 2)
        {
            
SelectMode[playerid] = SELECT_MODE_SELL;
            
SelectObject(playerid);
            
SendClientMessage(playerid0xFFFFFFFF"Click on the furniture you want to sell.");
        }
        
        if(
listitem == 3)
        {
            new 
moneysolddata[e_furniture], query[64];
            for(new 
iStreamer_GetUpperBound(STREAMER_TYPE_OBJECT); ++i)
            {
                if(!
IsValidDynamicObject(i)) continue;
                
Streamer_GetArrayData(STREAMER_TYPE_OBJECTiE_STREAMER_EXTRA_IDdata);
                if(
data[SQLID] > && data[HouseID] == id)
                {
                    
sold++;
                    
money += HouseFurnituresdata[ArrayID] ][Price];
                    
DestroyDynamicObject(i);
                }
            }
            
            new 
string[64];
            
format(stringsizeof(string), "Sold %d furnitures for $%s."soldconvertNumber(money));
            
SendClientMessage(playerid, -1string);
            
pInfo[playerid][Money] += money;
            
            
mysql_format(SQLHandlequerysizeof(query), "DELETE FROM housefurnitures WHERE HouseID=%d"id);
            
mysql_tquery(SQLHandlequery"""");
        }
        
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+12)
    {
        if(!
response) return ShowHouseMenu(playerid);
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        if(
HouseFurnitures[listitem][Price] > pInfo[playerid][Money]) return SendClientMessage(playerid0xE74C3CFF"You can't afford this furniture.");
        
pInfo[playerid][Money] += -HouseFurnitures[listitem][Price];
        new 
FloatxFloatyFloatz;
        
GetPlayerPos(playeridxyz);
        
GetXYInFrontOfPlayer(playeridxy3.0);
        new 
objectid CreateDynamicObject(HouseFurnitures[listitem][ModelID], xyz0.00.00.0GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)), query[256];
        
mysql_format(SQLHandlequerysizeof(query), "INSERT INTO housefurnitures SET HouseID=%d, FurnitureID=%d, FurnitureX=%f, FurnitureY=%f, FurnitureZ=%f, FurnitureVW=%d, FurnitureInt=%d"idlistitemxyzGetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
        new 
Cacheadd mysql_query(SQLHandlequery), data[e_furniture];
        
data[SQLID] = cache_insert_id();
        
data[HouseID] = id;
        
data[ArrayID] = listitem;
        
data[furnitureX] = x;
        
data[furnitureY] = y;
        
data[furnitureZ] = z;
        
data[furnitureRX] = 0.0;
        
data[furnitureRY] = 0.0;
        
data[furnitureRZ] = 0.0;
        
cache_delete(add);
        
Streamer_SetArrayData(STREAMER_TYPE_OBJECTobjectidE_STREAMER_EXTRA_IDdata);
        
EditDynamicObject(playeridobjectid);
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+13)
    {
        if(!
response) return 1;
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        new 
objectid GetPVarInt(playerid"SelectedFurniture"), query[64], data[e_furniture];
        
Streamer_GetArrayData(STREAMER_TYPE_OBJECTobjectidE_STREAMER_EXTRA_IDdata);
        
pInfo[playerid][Money] += HouseFurnituresdata[ArrayID] ][Price];
        
mysql_format(SQLHandlequerysizeof(query), "DELETE FROM housefurnitures WHERE ID=%d"data[SQLID]);
        
mysql_tquery(SQLHandlequery"""");
        
DestroyDynamicObject(objectid);
        
DeletePVar(playerid"SelectedFurniture");
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+14)
    {
        if(!
response) return ShowHouseMenu(playerid);
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        if(
listitem == 0)
        {
            new 
query[200], Cachevisitors;
            
mysql_format(SQLHandlequerysizeof(query), "SELECT Visitor, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as VisitDate FROM housevisitors WHERE HouseID=%d ORDER BY Date DESC LIMIT 0, 15"id);
            
visitors mysql_query(SQLHandlequery);
            new 
rows cache_num_rows();
            if(
rows) {
                new list[
1024], visitor_name[MAX_PLAYER_NAME], visit_date[20];
                
format(list, sizeof(list), "Visitor Name\tDate\n");
                for(new 
irows; ++i)
                {
                    
cache_get_field_content(i"Visitor"visitor_name);
                    
cache_get_field_content(i"VisitDate"visit_date);
                    
format(list, sizeof(list), "%s%s\t%s\n", list, visitor_namevisit_date);
                }
                
ShowPlayerDialog(playeridDIALOG_HOUSE+15DIALOG_STYLE_TABLIST_HEADERS"House Visitors (Page 1)", list, "Next""Previous");
            }else{
                
SendClientMessage(playerid0xE74C3CFF"You didn't had any visitors.");
            }
            
cache_delete(visitors);
        }
        if(
listitem == 1)
        {
            new 
query[64];
            
mysql_format(SQLHandlequerysizeof(query), "DELETE FROM housevisitors WHERE HouseID=%d"id);
            
mysql_tquery(SQLHandlequery"""");
            
ShowHouseMenu(playerid);
        }
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+15)
    {
        if(!
response) {
            
ListPage[playerid]--;
            if(
ListPage[playerid] < 0)
            {
                
ListPage[playerid] = 0;
                
ShowHouseMenu(playerid);
                return 
1;
            }
        }else{
            
ListPage[playerid]++;
        }
        
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
          new 
query[200], Cachevisitors;
        
mysql_format(SQLHandlequerysizeof(query), "SELECT Visitor, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as VisitDate FROM housevisitors WHERE HouseID=%d ORDER BY Date DESC LIMIT %d, 15"idListPage[playerid]*15);
        
visitors mysql_query(SQLHandlequery);
        new 
rows cache_num_rows();
        if(
rows) {
              new list[
1024], visitor_name[MAX_PLAYER_NAME], visit_date[20];
            
format(list, sizeof(list), "Visitor Name\tDate\n");
            for(new 
irows; ++i)
            {
                  
cache_get_field_content(i"Visitor"visitor_name);
                
cache_get_field_content(i"VisitDate"visit_date);
                
format(list, sizeof(list), "%s%s\t%s\n", list, visitor_namevisit_date);
            }
            new 
title[32];
            
format(titlesizeof(title), "House Visitors (Page %d)"ListPage[playerid]+1);
            
ShowPlayerDialog(playeridDIALOG_HOUSE+15DIALOG_STYLE_TABLIST_HEADERStitle, list, "Next""Previous");
        }else{
            
SendClientMessage(playerid0xE74C3CFF"Can't find any more visitors.");
            
ListPage[playerid] = 0;
               
ShowHouseMenu(playerid);
        }
        
cache_delete(visitors);
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+16)
    {
        if(!
response) return ShowHouseMenu(playerid);
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        if(
listitem == 0)
        {
            new 
query[200], Cachekeyowners;
            
mysql_format(SQLHandlequerysizeof(query), "SELECT Player, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as KeyDate FROM housekeys WHERE HouseID=%d ORDER BY Date DESC LIMIT %d, 15"idListPage[playerid]*15);
            
keyowners mysql_query(SQLHandlequery);
            new 
rows cache_num_rows();
            if(
rows) {
                new list[
1024], key_name[MAX_PLAYER_NAME], key_date[20];
                
format(list, sizeof(list), "Key Owner\tKey Given On\n");
                for(new 
irows; ++i)
                {
                    
cache_get_field_content(i"Player"key_name);
                    
cache_get_field_content(i"KeyDate"key_date);
                    
format(list, sizeof(list), "%s%s\t%s\n", list, key_namekey_date);
                }
                
ShowPlayerDialog(playeridDIALOG_HOUSE+17DIALOG_STYLE_TABLIST_HEADERS"Key Owners (Page 1)", list, "Next""Previous");
            }else{
                
SendClientMessage(playerid0xE74C3CFF"Can't find any key owners.");
            }
            
cache_delete(keyowners);
        }
        if(
listitem == 1)
        {
            foreach(new 
Player)
            {
                if(
Iter_Contains(HouseKeys[i], id)) Iter_Remove(HouseKeys[i], id);
            }
            
            new 
query[64];
            
mysql_format(SQLHandlequerysizeof(query), "DELETE FROM housekeys WHERE HouseID=%d"id);
            
mysql_tquery(SQLHandlequery"""");
            
ShowHouseMenu(playerid);
        }
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+17)
    {
        if(!
response) {
            
ListPage[playerid]--;
            if(
ListPage[playerid] < 0)
            {
                
ListPage[playerid] = 0;
                
ShowHouseMenu(playerid);
                return 
1;
            }
        }else{
            
ListPage[playerid]++;
        }
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        new 
query[200], Cachekeyowners;
          
mysql_format(SQLHandlequerysizeof(query), "SELECT Player, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as KeyDate FROM housekeys WHERE HouseID=%d ORDER BY Date DESC LIMIT %d, 15"idListPage[playerid]*15);
        
keyowners mysql_query(SQLHandlequery);
        new 
rows cache_num_rows();
        if(
rows) {
              new list[
1024], key_name[MAX_PLAYER_NAME], key_date[20];
            
format(list, sizeof(list), "Key Owner\tKey Given On\n");
            for(new 
irows; ++i)
            {
                  
cache_get_field_content(i"Player"key_name);
                
cache_get_field_content(i"KeyDate"key_date);
                
format(list, sizeof(list), "%s%s\t%s\n", list, key_namekey_date);
            }
            new 
title[32];
            
format(titlesizeof(title), "Key Owners (Page %d)"ListPage[playerid]+1);
            
ShowPlayerDialog(playeridDIALOG_HOUSE+17DIALOG_STYLE_TABLIST_HEADERStitle, list, "Next""Previous");
        }else{
            
ListPage[playerid] = 0;
               
ShowHouseMenu(playerid);
            
SendClientMessage(playerid0xE74C3CFF"Can't find any more key owners.");
        }
        
cache_delete(keyowners);
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+18)
    {
        if(!
response) {
            
ListPage[playerid]--;
            if(
ListPage[playerid] < 0)
            {
                
ListPage[playerid] = 0;
                
ShowHouseMenu(playerid);
                return 
1;
            }
        }else{
            
ListPage[playerid]++;
        }
        new 
id InHouse[playerid], name[24];
        if(
id == INVALID_HOUSE_ID) return SendClientMessage(playerid0xE74C3CFF"You're not in a house.");
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        if(
strcmp(HouseData[id][Owner], name)) return SendClientMessage(playerid0xE74C3CFF"You're not the owner of this house.");
        new 
query[200], Cachesafelog;
          
mysql_format(SQLHandlequerysizeof(query), "SELECT Type, Amount, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as TransactionDate FROM housesafelogs WHERE HouseID=%d ORDER BY Date DESC LIMIT %d, 15"idListPage[playerid]*15);
        
safelog mysql_query(SQLHandlequery);
        new 
rows cache_num_rows();
        if(
rows) {
              new list[
1024], date[20];
            
format(list, sizeof(list), "Action\tDate\n");
            for(new 
irows; ++i)
            {
                
cache_get_field_content(i"TransactionDate"date);
                
format(list, sizeof(list), "%s%s $%s\t{FFFFFF}%s\n", list, TransactionNamescache_get_field_content_int(i"Type") ], convertNumber(cache_get_field_content_int(i"Amount")), date);
            }
            new 
title[32];
            
format(titlesizeof(title), "Safe History (Page %d)"ListPage[playerid]+1);
            
ShowPlayerDialog(playeridDIALOG_HOUSE+18DIALOG_STYLE_TABLIST_HEADERStitle, list, "Next""Previous");
        }else{
            
SendClientMessage(playerid0xE74C3CFF"Can't find any more safe history.");
        }
        
cache_delete(safelog);
        return 
1;
    }
    
    if(
dialogid == DIALOG_HOUSE+19)
    {
        if(!
response) {
            
ListPage[playerid]--;
            if(
ListPage[playerid] < 0)
            {
                
ListPage[playerid] = 0;
                return 
1;
            }
        }else{
            
ListPage[playerid]++;
        }
        new 
query[200], name[MAX_PLAYER_NAME], Cachemykeys;
        
GetPlayerName(playeridnameMAX_PLAYER_NAME);
        
mysql_format(SQLHandlequerysizeof(query), "SELECT HouseID, FROM_UNIXTIME(Date, '%%d/%%m/%%Y %%H:%%i') as KeyDate FROM housekeys WHERE Player='%e' ORDER BY Date DESC LIMIT %d, 15"nameListPage[playerid]*15);
        
mykeys mysql_query(SQLHandlequery);
        new 
rows cache_num_rows();
        if(
rows) {
              new list[
1024], idkey_date[20];
               
format(list, sizeof(list), "House Info\tKey Given On\n");
            for(new 
irows; ++i)
            {
                
id cache_get_field_content_int(i"HouseID");
                   
cache_get_field_content(i"KeyDate"key_date);
                
format(list, sizeof(list), "%s%s's %s\t%s\n", list, HouseData[id][Owner], HouseData[id][Name], key_date);
            }
            new 
title[32];
            
format(titlesizeof(title), "My Keys (Page %d)"ListPage[playerid]+1);
            
ShowPlayerDialog(playeridDIALOG_HOUSE+19DIALOG_STYLE_TABLIST_HEADERStitle, list, "Next""Previous");
        }else{
            
ListPage[playerid] = 0;
            
SendClientMessage(playerid0xE74C3CFF"Can't find any more keys.");
        }
        
cache_delete(mykeys);
        return 
1;
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)