16.02.2012, 20:48
Meu sistema de casas e bem simples eu nao sei como funciona mas ve se isso ajuda '-'
This forum requires that you wait 120 seconds between posts. Please try again in 65 seconds.
.-.
pawn Код:
for(new c = 0; c < MAX_CASAS; c++)
{
new string[128];
format(string, sizeof(string), "/Casas/casa%d.ini", c);
if(DOF2_FileExists(string))
{
new pickupid;
if(DOF2_GetInt(string, "TDonoC") == 0)
{
pickupid = CreatePickup(1273, 1, DOF2_GetFloat(string, "PosX"), DOF2_GetFloat(string, "PosY"), DOF2_GetFloat(string, "PosZ"), -1);
DOF2_SetInt(string, "Id", pickupid);
new meguste[128];
/*new pp[30];
if(DOF2_GetInt(string,"CTrancada") == 1) format(pp, sizeof(pp), "Trancada");
if(DOF2_GetInt(string,"CTrancada") == 0) format(pp, sizeof(pp), "Destrancada");*/
format(meguste, sizeof(meguste), "Casa Nъmero [ %d ]", c);
Create3DTextLabel(meguste,0xFFFFFFAA, DOF2_GetFloat(string, "PosX"), DOF2_GetFloat(string, "PosY"), DOF2_GetFloat(string, "PosZ")+0.75,20.0,0,1);
proximacasa++;
}
else {
if(DOF2_GetInt(string, "TDonoC") == 1)
{
pickupid = CreatePickup(1272, 1, DOF2_GetFloat(string, "PosX"), DOF2_GetFloat(string, "PosY"), DOF2_GetFloat(string, "PosZ"), -1);
DOF2_SetInt(string, "Id", pickupid);
proximacasa++;
new meguste[128];
/*new pp[30];
if(DOF2_GetInt(string,"CTrancada") == 1) format(pp, sizeof(pp), "Trancada");
if(DOF2_GetInt(string,"CTrancada") == 0) format(pp, sizeof(pp), "Destrancada");*/
format(meguste, sizeof(meguste), "Casa Nъmero [ %d ]", c);
Create3DTextLabel(meguste,0xFFFFFFAA, DOF2_GetFloat(string, "PosX"), DOF2_GetFloat(string, "PosY"), DOF2_GetFloat(string, "PosZ")+0.75,20.0,0,1);
}
else {
proximacasa++;
}
}
}
}
pawn Код:
if(newkeys==KEY_SECONDARY_ATTACK && nacasa[playerid] == 1)
{
for(new c = 0; c < MAX_CASAS; c++)
{
new string[24];
new str[128];
format(string, sizeof(string), "/Casas/casa%d.ini", c);
nacasa[playerid] = 0;
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, CasaX[playerid], CasaY[playerid], CasaZ[playerid]);
format(str, sizeof(str), "(INFO) Vocк saiu da Casa Nъmero: [ %d ]", c);
SendClientMessage(playerid, VerdeFraco, str);
return 1;
}
}
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
new string[128];
for(new c = 0; c < MAX_CASAS; c++)
{
format(string, sizeof(string), "/Casas/casa%d.ini", c);
if(newkeys==KEY_WALK && IsPlayerInRangeOfPoint(playerid, 2.0, DOF2_GetFloat(string, "PosX"), DOF2_GetFloat(string, "PosY"), DOF2_GetFloat(string, "PosZ")))
{
if(strcmp(DOF2_GetString(string, "Dono"), pname, true) == 0 || IsPlayerAdmin(playerid) || vAdmin[playerid] >= 2 && vAdmin[playerid] <= 7)
{
if(DOF2_GetInt(string, "CTrancada") == 1)
{
DOF2_SetInt(string, "CTrancada", 0);
SendClientMessage(playerid, Verde, "(x) Esta Casa estб Destrancada");
}
else {
DOF2_SetInt(string, "CTrancada", 1);
SendClientMessage(playerid, Verde, "(x) Esta Casa estб Trancada");
}
}
}
if(newkeys == KEY_SECONDARY_ATTACK && IsPlayerInRangeOfPoint(playerid, 2.0, DOF2_GetFloat(string, "PosX"), DOF2_GetFloat(string, "PosY"), DOF2_GetFloat(string, "PosZ")))
{
if(DOF2_GetInt(string, "CTrancada") == 1)
{
if(strcmp(DOF2_GetString(string, "Dono"), pname, true) == 0 || IsPlayerAdmin(playerid) || vAdmin[playerid] >= 2 && vAdmin[playerid] <= 7)
{
new strx[128];
new str[128];
format(strx, sizeof(strx), "/Interiores/int%d.ini", DOF2_GetInt(string, "Int"));
if(DOF2_FileExists(strx))
{
nacasa[playerid] = 1;
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
CasaX[playerid] = X;
CasaY[playerid] = Y;
CasaZ[playerid] = Z;
SetPlayerVirtualWorld(playerid, c);
SetPlayerInterior(playerid, DOF2_GetInt(strx, "Int"));
SetPlayerPos(playerid, DOF2_GetFloat(strx, "EX"), DOF2_GetFloat(strx, "EY"), DOF2_GetFloat(strx, "EZ"));
format(str, sizeof(str), "(INFO) Vocк entrou na Casa Nъmero: [ %d ] - Para Sair Aperte a Tecla 'F' ou Pressione <ENTER>", c);
SendClientMessage(playerid, VerdeFraco, str);
}
}
}
else {
new strx[128];
new str[128];
format(strx, sizeof(strx), "/Interiores/int%d.ini", DOF2_GetInt(string, "Int"));
if(DOF2_FileExists(strx))
{
nacasa[playerid] = 1;
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
CasaX[playerid] = X;
CasaY[playerid] = Y;
CasaZ[playerid] = Z;
SetPlayerVirtualWorld(playerid, c);
SetPlayerInterior(playerid, DOF2_GetInt(strx, "Int"));
SetPlayerPos(playerid, DOF2_GetFloat(strx, "EX"), DOF2_GetFloat(strx, "EY"), DOF2_GetFloat(strx, "EZ"));
format(str, sizeof(str), "(INFO) Vocк entrou na Casa Nъmero: [ %d ] - Para Sair Aperte a Tecla 'F' ou Pressione <ENTER>", c);
SendClientMessage(playerid, VerdeFraco, str);
}
}
}
return 1;
}
.-.