Trouble with a simple command!
#2

I guess IsPlayerInsideHouse(playerid) returns the house id, but what if you aren't in any house, can you show IsPlayerInsideHouse(playerid) or try to check what is it returning ?
pawn Код:
CMD:lockhouse(playerid, params[])
{
    new id = IsPlayerNearHouseEnt(playerid);
    new id2 = IsPlayerInsideHouse(playerid);

    if(id != PlayerInfo[playerid][HouseID] || id2 != PlayerInfo[playerid][HouseID])
    {
        printf("id = %i", id);
        printf("id2 = %i", id2);
        printf("HouseID = %i", PlayerInfo[playerid][HouseID]);
        return SCM(playerid, COLOR_LIGHTRED, "[Error]: You do not own this house.");
    }
    if(HouseInfo[id][hLocked] == 1)
    {
        HouseInfo[id][hLocked] = 0;
        GameTextForPlayer(playerid, "~w~house ~g~ UNLOCKED", 3000, 6);
        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);

        new file4[40];
        format(file4, sizeof(file4), HPATH, id);
        new INI:File = INI_Open(file4);
        INI_SetTag(File,"data");
        INI_WriteInt(File,"hLocked", HouseInfo[id][hLocked]);
        INI_Close(File);
    }
    else
    {
        HouseInfo[id][hLocked] = 1;
        GameTextForPlayer(playerid, "~w~house ~r~ LOCKED", 3000, 6);
        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);

        new file4[40];
        format(file4, sizeof(file4), HPATH, id);
        new INI:File = INI_Open(file4);
        INI_SetTag(File,"data");
        INI_WriteInt(File,"hLocked", HouseInfo[id][hLocked]);
        INI_Close(File);
    }
    return 1;
}
Just to debug it, Check if any of them are different and that's where the problem is..
Reply


Messages In This Thread
Trouble with a simple command! - by Chrillzen - 27.11.2013, 23:09
Re: Trouble with a simple command! - by xVIP3Rx - 27.11.2013, 23:22
Re: Trouble with a simple command! - by Loot - 27.11.2013, 23:28
Re: Trouble with a simple command! - by Chrillzen - 27.11.2013, 23:34
Re: Trouble with a simple command! - by xVIP3Rx - 27.11.2013, 23:49

Forum Jump:


Users browsing this thread: 1 Guest(s)