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;
}
}}}}
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;
}
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. |