// Maneira 1
CMD:teste(playerid)
{
for(new i = 0; i < MAX_CASAS; i++)
{
new Pasta[100];
format(Pasta, sizeof(Pasta), Casas, i);
if(DOF2_FileExists(Pasta))
{
if(!IsPlayerInRangeOfPoint(playerid, 1, DOF2_GetFloat(Pasta, "PosX"), DOF2_GetFloat(Pasta, "PosY"), DOF2_GetFloat(Pasta, "PosZ"))) return SendClientMessage(playerid, vermelho, "| ERRO | Vocк Nгo Estб Em Uma Casa!");
SendClientMessage(playerid, azul2, "Debug");
}
break;
}
return 1;
}
// Maneira 2
CMD:teste (playerid)
{
for(new i = 0; i < MAX_CASA; i++)
{
if(!IsPlayerInRangeOfPoint(playerid, 1, Casa[i][PosX], Casa[i][PosY], Casa[i][PosY)) return SendClientMessage(playerid, vermelho, "| ERRO | Vocк Nгo Estб Em Uma Casa");
SendClientMessage(playerid, azul2, "Debug");
break;
}
return 1;
}
// Tinha mais 2 maneiras, mas eu deletei porque nгo funcionaram.
enum InfoCasa
{
bool:tDono,
cInfo,
cID,
nDono[MAX_PLAYER_NAME],
Float:PosX,
Float:PosY,
Float:PosZ,
cContas,
bool:cPorta,
cInt,
cWorld,
cLevel,
};
new Casa[MAX_CASAS][InfoCasa];
GetPlayerClosestHouse(playerid, Float:range = 3.0)
{
new id = -1;
for (new i = 0; i < MAX_CASA; i ++)
{
if (IsPlayerInRangeOfPoint(playerid, range, Casa[i][PosX], Casa[i][PosY], Casa[i][PosZ]))
{
id = i;
break;
}
}
return id;
}
CMD:teste(playerid)
{
new id = GetPlayerClosestHouse(playerid);
if (id == -1)
return print("| ERRO | Vocк Nгo Estб Em Uma Casa");
print("Debug");
return 1;
}
PHP Code:
|
stock LoadCasas()
{
for(new i = 0; i < MAX_CASAS; i++)
{
new str[256], Label[256], Status[20], Pick, Pick2;
format(str, sizeof(str), Casas, i);
if(DOF2_FileExists(str))
{
new Casaid;
Casa[Casaid][tDono] = DOF2_GetBool( str, "tDono" );
format(Casa[Casaid][nDono], 24, "%s", DOF2_GetString(str, "nDono") );
Casa[Casaid][cInfo] = DOF2_GetInt ( str, "cInfo" );
Casa[Casaid][cID] = DOF2_GetInt( str, "cID" );
Casa[Casaid][PosX] = DOF2_GetFloat( str, "PosX" );
Casa[Casaid][PosY] = DOF2_GetFloat( str, "PosY" );
Casa[Casaid][PosZ] = DOF2_GetFloat( str, "PosZ" );
Casa[Casaid][cContas] = DOF2_GetInt( str, "cContas" );
Casa[Casaid][cPorta] = DOF2_GetBool( str, "cPorta" );
Casa[Casaid][cInt] = DOF2_GetInt( str, "cInt" );
Casa[Casaid][cWorld] = DOF2_GetInt( str, "cWorld" );
Casa[Casaid][cLevel] = DOF2_GetInt( str, "cLevel" );
if(Casa[Casaid][cPorta] == true) { Status = "{00E600}Aberta"; } else if(Casa[Casaid][cPorta] == false) { Status = "{FF0000}Fechada"; }
format(Label, sizeof(Label), "{c0c0c0}Level %i\nCasa %i\n{FFAE00}Dono: {FFFFFF}%s\n{c0c0c0}Porta: %s", Casa[Casaid][cLevel], Casa[Casaid][cID], Casa[Casaid][nDono], Status);
if(Casa[Casaid][tDono] == true) { Pick2 = 19522; } else if(Casa[Casaid][tDono] == false) { Pick2 = 1273; }
CasaP[Casaid] = CreatePickup(Pick2, 0, Casa[Casaid][PosX], Casa[Casaid][PosY], Casa[Casaid][PosZ], 0);
Create3DTextLabel(Label, -1, Casa[Casaid][PosX], Casa[Casaid][PosY], Casa[Casaid][PosZ], 15.0, 0, 0);
if(Casa[Casaid][tDono] == true) { Pick = 32; } else if(Casa[Casaid][tDono] == false) { Pick = 31; }
CreateDynamicMapIcon(Casa[Casaid][PosX], Casa[Casaid][PosY], Casa[Casaid][PosZ], Pick, -1, -1, -1, -1, 100.0);
}
}
return 1;
}
stock LoadCasas()
{
for(new i = 0; i < MAX_CASAS; i++)
{
new str[256], Label[256], Status[20], Pick, Pick2;
format(str, sizeof(str), Casas, i);
if(DOF2_FileExists(str))
{
Casa[i][tDono] = DOF2_GetBool( str, "tDono" );
format(Casa[i][nDono], 24, "%s", DOF2_GetString(str, "nDono") );
Casa[i][cInfo] = DOF2_GetInt ( str, "cInfo" );
Casa[i][cID] = DOF2_GetInt( str, "cID" );
Casa[i][PosX] = DOF2_GetFloat( str, "PosX" );
Casa[i][PosY] = DOF2_GetFloat( str, "PosY" );
Casa[i][PosZ] = DOF2_GetFloat( str, "PosZ" );
Casa[i][cContas] = DOF2_GetInt( str, "cContas" );
Casa[i][cPorta] = DOF2_GetBool( str, "cPorta" );
Casa[i][cInt] = DOF2_GetInt( str, "cInt" );
Casa[i][cWorld] = DOF2_GetInt( str, "cWorld" );
Casa[i][cLevel] = DOF2_GetInt( str, "cLevel" );
if(Casa[i][cPorta] == true) { Status = "{00E600}Aberta"; } else if(Casa[i][cPorta] == false) { Status = "{FF0000}Fechada"; }
format(Label, sizeof(Label), "{c0c0c0}Level %i\nCasa %i\n{FFAE00}Dono: {FFFFFF}%s\n{c0c0c0}Porta: %s", Casa[i][cLevel], Casa[i][cID], Casa[i][nDono], Status);
if(Casa[i][tDono] == true) { Pick2 = 19522; } else if(Casa[i][tDono] == false) { Pick2 = 1273; }
CasaP[i] = CreatePickup(Pick2, 0, Casa[i][PosX], Casa[i][PosY], Casa[i][PosZ], 0);
Create3DTextLabel(Label, -1, Casa[i][PosX], Casa[i][PosY], Casa[i][PosZ], 15.0, 0, 0);
if(Casa[i][tDono] == true) { Pick = 32; } else if(Casa[i][tDono] == false) { Pick = 31; }
CreateDynamicMapIcon(Casa[i][PosX], Casa[i][PosY], Casa[i][PosZ], Pick, -1, -1, -1, -1, 100.0);
printf("Casa %i carregada.", i);
}
}
return 1;
}