09.09.2013, 10:53
You send the message even if they are in range or not.
EDIT:
[I]CInfo[nomedacasa] is integer or string? It should store the owner's name, shouldn't it? But you're checking if it's equal to 1 too.
pawn Код:
CMD:entrar(playerid,params[])
{
new pName[24], bool: inrange = false;
for(new i = 0; i < MAX_CASAS;i++)
{
if(!IsPlayerInRangeOfPoint(playerid,8.0,CInfo[i][entradax],CInfo[entraday][entraday],CInfo[i][entradaz])) continue;
GetPlayerName(playerid,pName,24);//Storing the players name
if(CInfo[i][nomedacasa] == 1 && strcmp(CInfo[i][nomedacasa],pName) == 0)//String comparing between the players name and the house owners name, to check if they match.
{
SetPVarInt(playerid,"PlayersInteriorHouse",GetPlay erInterior(playerid));//Storing, so later we can reset it back
SetPVarInt(playerid,"PlayerVirtualWorldHouse",GetP layerVirtualWorld(playerid));//Storing, so later we can reset it back
SetPlayerInterior(playerid,12);//Setting the players interior.
SetPlayerPos(playerid,446.7281,507.0475,1001.4195) ;//Setting the players position.
SetPlayerVirtualWorld(playerid,CInfo[i][vw]);//Preventing players from different houses, finding each other.
inrange = true;
}
}
if(!inrange) SendClientMessage(playerid,-1,"You aren't near a house!");
return 1;
}
pawn Код:
if(CInfo[i][nomedacasa] == 1 && strcmp(CInfo[i][nomedacasa],pName) == 0)