Problem with my lock and unlock in the housesystem
#1

Allright so recently I discovered this bug that still let's you lock and unlock the house form the outside but not from the inside in the interior. It says "You locked the house" and "You unlocked the house but still it won't lock the house when you are inside the house.
If I remove all "return 1;" from there it works but then it sends me a triple message saying "You locked the house" or "You unlocked the house"..
Here's the code.

pawn Код:
if(dialogid == 20){
    if(response == 1)
    {
    for(new h = 0; h < MAX_HOUSES; h++)
    {
    if(listitem == 0)
    {
    if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]))
    {
    HouseInfo[h][hLocked] = 1;
    SendClientMessage(playerid, COLOR_RED, "You locked your house.");
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hExitx], HouseInfo[h][hExity], HouseInfo[h][hExitz]))
    {
    HouseInfo[h][hLocked] = 1;
    SendClientMessage(playerid, COLOR_RED, "You locked your house.");
    return 1;
    }
    }
    if(listitem == 1)
    {
    if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]))
    {
    HouseInfo[h][hLocked] = 0;
    SendClientMessage(playerid, COLOR_RED, "You unlocked your house.");
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hExitx], HouseInfo[h][hExity], HouseInfo[h][hExitz]))
    {
    HouseInfo[h][hLocked] = 0;
    SendClientMessage(playerid, COLOR_RED, "You unlocked your house.");
    return 1;
    }

    }}}}
Reply
#2

pawn Код:
if(dialogid == 20)
{
    if(response == 1)
    {
        for(new h = 0; h < MAX_HOUSES; h++)
        {
            if(listitem == 0)
            {
                if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]))
                {
                    HouseInfo[h][hLocked] = 1;
                    SendClientMessage(playerid, COLOR_RED, "You locked your house.");
                    return 1;
                }
                if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hExitx], HouseInfo[h][hExity], HouseInfo[h][hExitz]))
                {
                    HouseInfo[h][hLocked] = 1;
                    SendClientMessage(playerid, COLOR_RED, "You locked your house.");
                    return 1;
                }
            }
            if(listitem == 1)
            {
                if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]))
                {
                    HouseInfo[h][hLocked] = 0;
                    SendClientMessage(playerid, COLOR_RED, "You unlocked your house.");
                    return 1;
                }
                if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[h][hExitx], HouseInfo[h][hExity], HouseInfo[h][hExitz]))
                {
                    HouseInfo[h][hLocked] = 0;
                    SendClientMessage(playerid, COLOR_RED, "You unlocked your house.");
                    return 1;
                }
            }
        }
    }
    return 1;
}
There's a cleaned up and indented version of it. I'm not quite sure what the problem is. You say it works fine from the outside but not at all from the inside?
Reply
#3

i`m n00b in the pawno beacose i just start learn how make a GM...Plz help me and tell what about you talk?
Reply
#4

BeriT: Search for tutorials and don't post off topic posts in these threads.

Backwardsman97: Yes, it works fine from the outside but not from the inside. The strange thing is that it works if you remove all "return1;" but then it sends a tripple message. It's probably some kind of bug in it but I don't know what.
Reply
#5

Quote:
Originally Posted by Mystique
Посмотреть сообщение
BeriT: Search for tutorials and don't post off topic posts in these threads.

Backwardsman97: Yes, it works fine from the outside but not from the inside. The strange thing is that it works if you remove all "return1;" but then it sends a tripple message. It's probably some kind of bug in it but I don't know what.
I think I've had the same problem. It loops trough all houses and checks if you are close to ANY of the houses, what the problem is is that if you have the same interior for multiple houses (so the same exit point aswell) it will find the all the houses with the same exit point thus it sends that ammount of messages. How I fixed it is using virtual worlds aswell to seperate each house (each house has his own virtual world you also look if that matches so you'll only get the house you're in, there are 2 billion+ virtual worlds availible, so don't worry about restrictions)

Sorry if it only confused you more, I can give you a better detailed example tommorow I don't have time now.
Reply
#6

Quote:
Originally Posted by playbox12
Посмотреть сообщение
I think I've had the same problem. It loops trough all houses and checks if you are close to ANY of the houses, what the problem is is that if you have the same interior for multiple houses (so the same exit point aswell) it will find the all the houses with the same exit point thus it sends that ammount of messages. How I fixed it is using virtual worlds aswell to seperate each house (each house has his own virtual world you also look if that matches so you'll only get the house you're in, there are 2 billion+ virtual worlds availible, so don't worry about restrictions)

Sorry if it only confused you more, I can give you a better detailed example tommorow I don't have time now.

Thank you. I actually had a own virtual world for every single house but I only had to add the statement of my HouseEntered variable like "if(HouseEntered[playerid] == h) etc. It works fine now.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)