deleting a house
#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


Messages In This Thread
deleting a house - by caoraivoso3 - 17.10.2013, 19:44
Re: deleting a house - by James Bob - 17.10.2013, 19:59
Re: deleting a house - by caoraivoso3 - 17.10.2013, 20:14
Re: deleting a house - by James Bob - 17.10.2013, 20:20

Forum Jump:


Users browsing this thread: 1 Guest(s)