I tried. It still bugs. Imma leave the code here:
Buying house command:
PHP код:
if(strcmp(cmd, "/comprarcasa", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new h = 0; h < sizeof(Houses); h++)
{
if(PlayerToPoint(2.0, playerid, Houses[h][EnterX], Houses[h][EnterY], Houses[h][EnterZ]) && Houses[h][Owned] == 0)
{
if(Houses[h][HousePrice] == 0)
{
SendClientMessage(playerid, COLOR_RED,"[ERRO:] O preco da casa nao foi escolhido, poder nao ser para uso.");
return 1;
}
if(PlayerInfo[playerid][pHouseKey] != 255 && strcmp(playername, Houses[PlayerInfo[playerid][pHouseKey]][Owner], true) == 0)
{
SendClientMessage(playerid, COLOR_RED,"[ERRO:] Apenas poderas ter uma casa, para compares uma nova, teras que vernder a tua acutal primeiro.");
return 1;
}
if(Houses[h][Owned] == 1)
{
SendClientMessage(playerid, COLOR_RED,"[ERRO:] Casa Jб tem Dono.");
return 1;
}
if(GetPlayerEuros(playerid) >= Houses[h][HousePrice])
{
if(PlayerInfo[playerid][pescritura] == 1)
{
PlayerInfo[playerid][pescritura] = 0;
PlayerInfo[playerid][pHouseKey] = h;
PlayerInfo[playerid][pAluguer] = 0;
Houses[h][Owned] = 1;
Houses[h][Money] = 0;
strmid(Houses[h][Owner], playername, 0, strlen(playername), 255);
GivePlayerEuros(playerid,-Houses[h][HousePrice]);
SetPlayerInterior(playerid,Houses[h][ExitInterior]);
SetPlayerVirtualWorld(playerid,h);
SetPlayerPos(playerid,Houses[h][ExitX],Houses[h][ExitY],Houses[h][ExitZ]);
SendClientMessage(playerid, COLOR_WHITE,"[INFO:] Compraste com sucesso a tua casa!");
PlayerActionMessage(playerid,15.0,"entrega uma mala cheia de dinheiro б agencia imobliaria, que dao em troca a chave da casa.");
ChangeStreamPickupModel(Houses[h][PickupID],1239);
SaveHouses();
UpdateHouses(h);
OnPlayerDataSave(playerid);
ChooseHouseInt(h, playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE,"[INFO:] Tens de tratar da papelada na camara municipal!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED,"[ERRO:] Nao tens dinheiro suficiente!");
return 1;
}
}
}
}
return 1;
}
PHP код:
public:ChooseHouseInt(h, playerid)
{
SendClientMessage(playerid, COLOR_GREEN, "Info: Podes escolher o tipo de interior que queres para a tua casa aqui! Usa /selecionar para teres acesso ao mouse.");
TextDrawShowForPlayer(playerid, houseint0);
TextDrawShowForPlayer(playerid, houseint1);
TextDrawShowForPlayer(playerid, houseint2);
TextDrawShowForPlayer(playerid, houseint3);
TextDrawShowForPlayer(playerid, houseint4);
currenthouseint[playerid] = 1;
TextDrawSetString(houseint4, "1");
SetPlayerPos(playerid, 295.138977, 1474.469971, 1080.519897);
SetPlayerInterior(playerid, 15);
SetPlayerVirtualWorld(playerid, h);
}
PHP код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(clickedid == houseint2)
{
if(currenthouseint[playerid] == 1)
{
currenthouseint[playerid] = 2;
SetPlayerInterior(playerid, 0);
SetTimerEx("int15", 200, false, "i", playerid);
TextDrawSetString(houseint4, "2");
}
else if(currenthouseint[playerid] == 2)
{
currenthouseint[playerid] = 3;
SetPlayerInterior(playerid, 0);
SetTimerEx("int4", 200, false, "i", playerid);
TextDrawSetString(houseint4, "3");
}
else if(currenthouseint[playerid] == 3)
{
currenthouseint[playerid] = 4;
SetPlayerInterior(playerid, 0);
SetTimerEx("int42", 200, false, "i", playerid);
TextDrawSetString(houseint4, "4");
}
else if(currenthouseint[playerid] == 4)
{
currenthouseint[playerid] = 5;
SetPlayerInterior(playerid, 6);
SetTimerEx("int6", 200, false, "i", playerid);
SetPlayerPos(playerid, -68.294098, 1353.469971, 1080.279907);
TextDrawSetString(houseint4, "5");
}
else if(currenthouseint[playerid] == 5)
{
currenthouseint[playerid] = 6;
SetPlayerInterior(playerid, 8);
SetTimerEx("int8", 200, false, "i", playerid);
SetPlayerPos(playerid, -42.581997, 1408.109985, 1084.449951);
TextDrawSetString(houseint4, "6");
}
else if(currenthouseint[playerid] == 6)
{
currenthouseint[playerid] = 7;
SetPlayerInterior(playerid, 9);
SetTimerEx("int9", 200, false, "i", playerid);
SetPlayerPos(playerid, 260.941986, 1238.509888, 1084.259888);
TextDrawSetString(houseint4, "7");
}
else if(currenthouseint[playerid] == 7)
{
currenthouseint[playerid] = 8;
SetPlayerInterior(playerid, 2);
SetTimerEx("int2", 200, false, "i", playerid);
SetPlayerPos(playerid, 447.734985, 1400.439941, 1084.339966);
TextDrawSetString(houseint4, "8");
}
else if(currenthouseint[playerid] == 8)
{
currenthouseint[playerid] = 9;
SetPlayerInterior(playerid, 5);
SetTimerEx("int5", 200, false, "i", playerid);
SetPlayerPos(playerid, 22.778299, 1404.959961, 1084.449951);
TextDrawSetString(houseint4, "9");
}
else if(currenthouseint[playerid] == 9)
{
currenthouseint[playerid] = 10;
SetPlayerInterior(playerid, 2);
SetTimerEx("int22", 200, false, "i", playerid);
SetPlayerPos(playerid, 2464.109863, -1698.659912, 1013.509949);
TextDrawSetString(houseint4, "10");
}
else if(currenthouseint[playerid] == 10)
{
currenthouseint[playerid] = 11;
SetPlayerInterior(playerid, 5);
SetTimerEx("int52", 200, false, "i", playerid);
SetPlayerPos(playerid, 318.564972, 1118.209961, 1083.979980);
TextDrawSetString(houseint4, "11");
}
else if(currenthouseint[playerid] == 11)
{
SendClientMessage(playerid, COLOR_RED, "[ERRO] Nгo se encontram disponiveis mais ints!");
return 1;
}
}
if(clickedid == houseint0)
{
if(currenthouseint[playerid] == 11)
{
currenthouseint[playerid] = 10;
SetPlayerInterior(playerid, 2);
SetPlayerPos(playerid, 2464.109863, -1698.659912, 1013.509949);
TextDrawSetString(houseint4, "10");
}
else if(currenthouseint[playerid] == 10)
{
currenthouseint[playerid] = 9;
SetPlayerInterior(playerid, 5);
SetPlayerPos(playerid, 22.778299, 1404.959961, 1084.449951);
TextDrawSetString(houseint4, "9");
}
else if(currenthouseint[playerid] == 9)
{
currenthouseint[playerid] = 8;
SetPlayerInterior(playerid, 2);
SetPlayerPos(playerid, 447.734985, 1400.439941, 1084.339966);
TextDrawSetString(houseint4, "8");
}
else if(currenthouseint[playerid] == 8)
{
currenthouseint[playerid] = 7;
SetPlayerInterior(playerid, 9);
SetPlayerPos(playerid, 260.941986, 1238.509888, 1084.259888);
TextDrawSetString(houseint4, "7");
}
else if(currenthouseint[playerid] == 7)
{
currenthouseint[playerid] = 6;
SetPlayerInterior(playerid, 8);
SetPlayerPos(playerid, -42.581997, 1408.109985, 1084.449951);
TextDrawSetString(houseint4, "6");
}
else if(currenthouseint[playerid] == 6)
{
currenthouseint[playerid] = 5;
SetPlayerInterior(playerid, 6);
SetPlayerPos(playerid, -68.294098, 1353.469971, 1080.279907);
TextDrawSetString(houseint4, "5");
}
else if(currenthouseint[playerid] == 5)
{
currenthouseint[playerid] = 4;
SetPlayerInterior(playerid, 4);
SetPlayerPos(playerid, 221.666992, 1143.389893, 1082.679932);
TextDrawSetString(houseint4, "4");
}
else if(currenthouseint[playerid] == 4)
{
currenthouseint[playerid] = 3;
SetPlayerInterior(playerid, 4);
SetPlayerPos(playerid, 260.983978, 1286.549927, 1080.299927);
TextDrawSetString(houseint4, "3");
}
else if(currenthouseint[playerid] == 3)
{
currenthouseint[playerid] = 2;
SetPlayerInterior(playerid, 15);
SetPlayerPos(playerid, 328.493988, 1480.589966, 1084.449951);
TextDrawSetString(houseint4, "2");
}
else if(currenthouseint[playerid] == 2)
{
TextDrawSetString(houseint4, "1");
SetPlayerInterior(playerid, 15);
SetPlayerPos(playerid, 295.138977, 1474.469971, 1080.519897);
currenthouseint[playerid] = 1;
}
else if(currenthouseint[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "[ERRO] Nгo se encontram disponiveis mais ints!");
return 1;
}
}
}
PHP код:
forward int15(playerid);
public int15(playerid)
{
if(currenthouseint[playerid] == 2)
{
SetPlayerInterior(playerid, 15);
SetPlayerPos(playerid, 328.493988, 1480.589966, 1084.449951);
}
}
forward int4(playerid);
public int4(playerid)
{
SetPlayerInterior(playerid, 4);
SetPlayerPos(playerid, 260.983978, 1286.549927, 1080.299927);
}
forward int42(playerid);
public int42(playerid)
{
SetPlayerInterior(playerid, 4);
SetPlayerPos(playerid, 221.666992, 1143.389893, 1082.679932);
}
forward int6(playerid);
public int6(playerid)
{
SetPlayerInterior(playerid, 6);
SetPlayerPos(playerid, -68.294098, 1353.469971, 1080.279907);
}
forward int8(playerid);
public int8(playerid)
{
SetPlayerInterior(playerid, 8);
SetPlayerPos(playerid, -42.581997, 1408.109985, 1084.449951);
}
forward int9(playerid);
public int9(playerid)
{
SetPlayerInterior(playerid, 9);
SetPlayerPos(playerid, 260.941986, 1238.509888, 1084.259888);
}
forward int2(playerid);
public int2(playerid)
{
SetPlayerInterior(playerid, 2);
SetPlayerPos(playerid, 447.734985, 1400.439941, 1084.339966);
}
forward int5(playerid);
public int5(playerid)
{
SetPlayerInterior(playerid, 5);
SetPlayerPos(playerid, 22.778299, 1404.959961, 1084.449951);
}
forward int22(playerid);
public int22(playerid)
{
SetPlayerInterior(playerid, 2);
SetPlayerPos(playerid, 2464.109863, -1698.659912, 1013.509949);
}
forward int52(playerid);
public int52(playerid)
{
SetPlayerInterior(playerid, 2);
SetPlayerPos(playerid, 318.564972, 1118.209961, 1083.979980);
}
Please if u find any errors that can be causing this lemme know please i just cant fix it