deleting a house
#1

i am just wondering how i can delete a house and using that id for a new house.
if i have this new HInfo[MAX_Houses][Houses]; and i want to delete the houseid and when i use the /createhouse command i use the id again.
anyone know any form to do that?
Reply
#2

Try this:

pawn Код:
CMD:hdelete(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 4)
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
        return 1;
    }
    new h, string[128];
    if(sscanf(params,"d",h)) return SendClientMessage(playerid, COLOR_WHITE,"USAGE: /hdelete [HouseID]");
    if(!IsValidDynamicPickup(HouseInfo[h][hPickupID])) return SendClientMessage(playerid, COLOR_WHITE,"House does not exist.");
    HouseInfo[h][hLevel] = 0;
    HouseInfo[h][hHInteriorWorld] = 0;
    HouseInfo[h][hCustomInterior] = 0;
    HouseInfo[h][hDescription] = 0;
    format(HouseInfo[h][hOwner],MAX_PLAYER_NAME, "Nobody");
    HouseInfo[h][hExteriorX] = 0;
    HouseInfo[h][hExteriorY] = 0;
    HouseInfo[h][hExteriorZ] = 0;
    HouseInfo[h][hExteriorR] = 0;
    HouseInfo[h][hExteriorA] = 0;
    HouseInfo[h][hInteriorX] = 0;
    HouseInfo[h][hInteriorY] = 0;
    HouseInfo[h][hInteriorZ] = 0;
    HouseInfo[h][hInteriorR] = 0;
    HouseInfo[h][hInteriorA] = 0;
    HouseInfo[h][hLock] = 0;
    HouseInfo[h][hRentable] = 0;
    HouseInfo[h][hRentFee] = 0;
    HouseInfo[h][hValue] = 0;
    ClearHouse(h);
    DestroyDynamicPickup(HouseInfo[h][hPickupID]);
    DestroyDynamic3DTextLabel(HouseInfo[h][hTextID]);
    HouseInfo[h][hCustomExterior] = 0;
    SaveHouses();
    format(string, sizeof(string), "You have deleted HouseID %d.", h);
    SendClientMessageEx(playerid, COLOR_WHITE, string);
    format(string, sizeof(string), "%s has deleted HouseID %d.", GetPlayerNameEx(playerid), h);
    Log("logs/hedit.log", string);
    return 1;
}
Once you've deleted the house, you should be able to create another house with the ID.
Reply
#3

setting all the settings to 0 will delete the house?
Reply
#4

It's what I use and it works perfect.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)