20.02.2014, 19:07
You don't need a return, break will break the loop. By the way, the message and LoadPlayerSpawnData must be inside the if statement about owned and the same owner.
@PowerPC603: 2 separated if is the same thing. If the house is not owned, it will not check the strcmp match.
pawn Код:
if(PlayerInfo[playerid][pPlayerOwnsHouse] == 1)
{
new playername[24];
new string[64];
GetPlayerName(playerid, playername, sizeof(playername));
for(new idz = 1; idz < sizeof(HouseInfo); idz++)
{
if(HouseInfo[idz][hOwned] == 1 && strcmp(HouseInfo[idz][hOwner], playername) == 0)
{
SetPlayerPos(playerid, HouseInfo[idz][hEntranceX], HouseInfo[idz][hEntranceY], HouseInfo[idz][hEntranceZ]);
TextDrawHideForPlayer(playerid,Textdraw0);
TextDrawHideForPlayer(playerid,Textdraw1);
SendClientMessage(playerid,COLOR_WHITE, string);
format(string,sizeof(string), "Welcome back to your home, %s.", GetName(playerid));
LoadPlayerSpawnData(playerid);
break;
}
}
}