House system
#1

Hello guys recently i found a house system but the problem is that when i delete the house which a player owns and he is offline when he logs in he still can use some cmds, so here is the code

pawn Код:
CMD:deletehouse(playerid, params[])
{

    for(new h = 1; h < sizeof(HouseInfo); h++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hEntranceX], HouseInfo[h][hEntranceY], HouseInfo[h][hEntranceZ]))
        {
            if(GetPlayerVirtualWorld(playerid) == HouseInfo[h][hWorld])
            {
                if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY,"You're not authorized to use this command.");
                if(HouseInfo[h][hOwned] == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "This house is owned.");

                HouseInfo[h][hOwned] = 0;
                HouseInfo[h][hPrice] = 0;
                HouseInfo[h][hOwner] = 0;
                HouseInfo[h][hLocked] = 0;
                HouseInfo[h][hMoney] = 0;
                HouseInfo[h][hEntranceX] = 0;
                HouseInfo[h][hEntranceY] = 0;
                HouseInfo[h][hEntranceZ] = 0;
                HouseInfo[h][hEntranceA] = 0;
                HouseInfo[h][hExitX] = 0;
                HouseInfo[h][hExitY] = 0;
                HouseInfo[h][hExitZ] = 0;
                HouseInfo[h][hExitA] = 0;
                HouseInfo[h][hInt] = 0;
                HouseInfo[h][hWorld] = 0;

                Delete3DTextLabel(HouseInfo[h][hDLabel]);
                DestroyDynamicPickup(HouseInfo[h][hOutsideIcon]);

                new string[64];

                format(string, sizeof(string), HPATH, h);
                fremove(string);
            }
        }
    }
    return 1;
}
So what i need is that when an admin removes a house for example house id 3 and if someone owns it, it should get auto removed from his data base

EDIT: I am using y_ini
Reply
#2

Quote:
Originally Posted by WoodPecker
Посмотреть сообщение
Hello guys recently i found a house system but the problem is that when i delete the house which a player owns and he is offline when he logs in he still can use some cmds, so here is the code

pawn Код:
CMD:deletehouse(playerid, params[])
{

    for(new h = 1; h < sizeof(HouseInfo); h++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hEntranceX], HouseInfo[h][hEntranceY], HouseInfo[h][hEntranceZ]))
        {
            if(GetPlayerVirtualWorld(playerid) == HouseInfo[h][hWorld])
            {
                if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY,"You're not authorized to use this command.");
                if(HouseInfo[h][hOwned] == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "This house is owned.");

                HouseInfo[h][hOwned] = 0;
                HouseInfo[h][hPrice] = 0;
                HouseInfo[h][hOwner] = 0;
                HouseInfo[h][hLocked] = 0;
                HouseInfo[h][hMoney] = 0;
                HouseInfo[h][hEntranceX] = 0;
                HouseInfo[h][hEntranceY] = 0;
                HouseInfo[h][hEntranceZ] = 0;
                HouseInfo[h][hEntranceA] = 0;
                HouseInfo[h][hExitX] = 0;
                HouseInfo[h][hExitY] = 0;
                HouseInfo[h][hExitZ] = 0;
                HouseInfo[h][hExitA] = 0;
                HouseInfo[h][hInt] = 0;
                HouseInfo[h][hWorld] = 0;

                Delete3DTextLabel(HouseInfo[h][hDLabel]);
                DestroyDynamicPickup(HouseInfo[h][hOutsideIcon]);

                new string[64];

                format(string, sizeof(string), HPATH, h);
                fremove(string);
            }
        }
    }
    return 1;
}
So what i need is that when an admin removes a house for example house id 3 and if someone owns it, it should get auto removed from his data base

EDIT: I am using y_ini
This is my code but I use Dof2.

pawn Код:
CMD:deletehouse(playerid, params[])
{

    for(new h = 1; h < sizeof(HouseInfo); h++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hEntranceX], HouseInfo[h][hEntranceY], HouseInfo[h][hEntranceZ]))
        {
            if(GetPlayerVirtualWorld(playerid) == HouseInfo[h][hWorld])
            {
                if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY,"You're not authorized to use this command.");
                if(HouseInfo[h][hOwned] == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "This house is owned.");

                HouseInfo[h][hOwned] = 0;
                HouseInfo[h][hPrice] = 0;            
                HouseInfo[h][hLocked] = 0;
                HouseInfo[h][hMoney] = 0;
                HouseInfo[h][hEntranceX] = 0;
                HouseInfo[h][hEntranceY] = 0;
                HouseInfo[h][hEntranceZ] = 0;
                HouseInfo[h][hEntranceA] = 0;
                HouseInfo[h][hExitX] = 0;
                HouseInfo[h][hExitY] = 0;
                HouseInfo[h][hExitZ] = 0;
                HouseInfo[h][hExitA] = 0;
                HouseInfo[h][hInt] = 0;
                HouseInfo[h][hWorld] = 0;

                Delete3DTextLabel(HouseInfo[h][hDLabel]);
                DestroyDynamicPickup(HouseInfo[h][hOutsideIcon]);

                new string[64];

                format(string, sizeof(string), HPATH, h);
                fremove(string);      
                                              format(string, sizeof(string), "Users/%s.ini", HouseInfo[h][hOwner]); //Your users save file location.
                                              if(DOF2_FileExists(string))
                                    {
                                                   HouseInfo[h][hOwner] = 0;
                                                   DOF2_SetInt(string, "House", -1); //or what ever your code to your players house save is.
                                              }
            }
        }
    }
    return 1;
}

I can't be asked making it for Y_INI but it should be the same there abouts.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)