//comando para sair da casa
CMD:saircasa(playerid)
{
for(new c; c < MAX_CASAS; c++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, hCasaInfo[c][hExitX], hCasaInfo[c][hExitY], hCasaInfo[c][hExitZ]) && hCasaInfo[c][zCasaID] == c)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, hCasaInfo[c][hEnterX], hCasaInfo[c][hEnterY], hCasaInfo[c][hEnterZ]);
SetPlayerVirtualWorld(playerid, 0);
}
}
return 1;
}
//comando para entrar na casa
CMD:entrarcasa(playerid)
{
for(new c; c < MAX_CASAS; c++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, hCasaInfo[c][hEnterX], hCasaInfo[c][hEnterY], hCasaInfo[c][hEnterZ]))
{
SetPlayerInterior(playerid, hCasaInfo[c][hInt]);
SetPlayerPos(playerid, hCasaInfo[c][hSpawnX], hCasaInfo[c][hSpawnY], hCasaInfo[c][hSpawnZ]);
SetPlayerVirtualWorld(playerid, hCasaInfo[c][hVWDentro]);
}
}
return 1;
}
new hCasaEntrou[MAX_PLAYERS];
CMD:entrarcasa(playerid)
{
for(new c; c < MAX_CASAS; c++)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, hCasaInfo[c][hEnterX], hCasaInfo[c][hEnterY], hCasaInfo[c][hEnterZ]))
{
SetPlayerInterior(playerid, hCasaInfo[c][hInt]);
SetPlayerPos(playerid, hCasaInfo[c][hSpawnX], hCasaInfo[c][hSpawnY], hCasaInfo[c][hSpawnZ]);
SetPlayerVirtualWorld(playerid, hCasaInfo[c][hVWDentro]);
hCasaEntrou[playerid] = c;
}
}
return true;
}
CMD:saircasa(playerid)
{
new idcasa = hCasaEntrou[playerid];
if (IsPlayerInRangeOfPoint(playerid, 1.0, hCasaInfo[idcasa][hExitX], hCasaInfo[idcasa][hExitY], hCasaInfo[idcasa][hExitZ]))
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, hCasaInfo[idcasa][hEnterX], hCasaInfo[idcasa][hEnterY], hCasaInfo[idcasa][hEnterZ]);
SetPlayerVirtualWorld(playerid, 0);
}
return true;
}
Vocк pode criar uma variбvel global que salva o id da casa que o player estб dessa forma:
PHP код:
|
hCasaEntrou[playerid] = c;
CMD:saircasa(playerid)
{
for(new c; c < MAX_CASAS; c++)
{
if(hCasaEntrou[playerid] >= 0)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, hCasaInfo[c][hExitX], hCasaInfo[c][hExitY], hCasaInfo[c][hExitZ]) && hCasaInfo[c][zCasaID] == c)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, hCasaInfo[c][hEnterX], hCasaInfo[c][hEnterY], hCasaInfo[c][hEnterZ]);
SetPlayerVirtualWorld(playerid, 0);
hCasaEntrou[playerid] = -1;
}
}
}
return 1;
}