03.01.2014, 18:27
Using break should work, because it continues until it reaches the totalhouse, so break should work, so what this means if it finds the current house you're near, it breaks the loop, it would not continue
pawn Код:
public OnPlayerPickUpDynamicPickup(playerid,pickupid)
{
new Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, cx, cy, cz);
for(new houseid = 0; houseid < totalhouses; houseid++)
{
if(pickupid == HousePickup[houseid])
{
if(PlayerToPointStripped(1, playerid,HouseInfo[houseid][hEntrancex], HouseInfo[houseid][hEntrancey], HouseInfo[houseid][hEntrancez], cx, cy, cz))
{
if(house_isProprio(playerid, houseid) || house_isLocataire(playerid, houseid) || HouseInfo[houseid][hLock] == 0 || HouseInfo[houseid][hOwned] == 0 || (HouseInfo[houseid][hLock] == 1 && HouseInfo[houseid][hOwned] == 0))
{
if(HouseInfo[houseid][hOwned] == 0) // No buy
{
//None
}
else if(HouseInfo[houseid][hEdited] == 0)
{
SetVirtualWorld(playerid, houseid);
}
else if(HouseInfo[houseid][hEdited] == 1)
{
SetVirtualWorld(playerid, 0);
}
else if(house_isProprio(playerid, houseid) || house_isLocataire(playerid, houseid))
{
HouseInfo[houseid][hFrigo] += biz_recupration[playerid], biz_recupration[playerid] = 0;
}
SetInterior(playerid,HouseInfo[houseid][hInt]), SetPlayerPos(playerid, HouseInfo[houseid][hExitx], HouseInfo[houseid][hExity], HouseInfo[houseid][hExitz]);
PlayerInfo[playerid][pInHouse] = houseid;
if(HouseInfo[houseid][hOwned] == 0) SendClientMessage(playerid, COLOR_MAISON, "You see a house. You can buy.");
}
else GameTextForPlayer(playerid, "~r~Door closed..", 5000, 1);
}
break;
}
}
return 1;
}