05.01.2014, 17:22
Olб,um tempo atrбs eu baixei um GM de RPG pra estudб-lo.Era o Brasil World Equality.Hoje eu resolvi abri-lo e testar os comandos.O que acontece й que toda vez que alguйm compra/vende uma casa,a pickup fica estranha.Quando passamos nela,ela manda o player para um 24/7.Eu examinei o cуdigo.Mas como sou inexperiente nгo achei falha.Segue o sistema de casa:
Isso й tudo que tem em relaзгo a casa no GM.E antes que me excomunguem,sim,eu usei o Search.Estarei esperando que alguйm possa me ajudar.agradeзo desde jб <3
Код:
#define MAX_CASAS 500 #define PASTA_CASAS "/Casas/%s.ini" //Diretуrio onde as contas sгo salvas new emcasa[MAX_PLAYERS]; new proximacasa; new morar[MAX_PLAYERS]; new moradia[MAX_PLAYERS]; new Float:CasaX[MAX_PLAYERS]; new Float:CasaY[MAX_PLAYERS]; new Float:CasaZ[MAX_PLAYERS]; forward CasaLog(string[]); for(new c = 0; c < MAX_CASAS; c++) { format(string, sizeof(string), "/Casas/casa%d.ini", c); if(dini_Exists(string)){ new pickupid; if(dini_Int(string, "TDono") == 0){ pickupid = CreatePickup(1273, 1, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"), -1); dini_IntSet(string, "Id", pickupid); proximacasa++; } else { if(dini_Int(string, "TDono") == 1){ pickupid = CreatePickup(1272, 1, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"), -1); dini_IntSet(string, "Id", pickupid); proximacasa++; } else { proximacasa++; } } } } if(!dini_Exists("/Interiores/int0.ini")){ dini_Create("/Interiores/int0.ini"); dini_IntSet("/Interiores/int0.ini", "Int", 1); dini_FloatSet("/Interiores/int0.ini", "EX", 222.9534); dini_FloatSet("/Interiores/int0.ini", "EY", 1287.7649); dini_FloatSet("/Interiores/int0.ini", "EZ", 1082.1406); } if(!dini_Exists("/Interiores/int1.ini")){ dini_Create("/Interiores/int1.ini"); dini_IntSet("/Interiores/int1.ini", "Int", 4); dini_FloatSet("/Interiores/int1.ini", "EX", 261.0827); dini_FloatSet("/Interiores/int1.ini", "EY", 1284.6899); dini_FloatSet("/Interiores/int1.ini", "EZ", 1080.2578); } if(!dini_Exists("/Interior/int2.ini")){ dini_Create("/Interiores/int2.ini"); dini_IntSet("/Interiores/int2.ini", "Int", 9); dini_FloatSet("/Interiores/int2.ini", "EX", 260.6734); dini_FloatSet("/Interiores/int2.ini", "EY", 1237.7909); dini_FloatSet("/Interiores/int2.ini", "EZ", 1084.2578); } if(!dini_Exists("/Interior/int3.ini")){ dini_Create("/Interiores/int3.ini"); dini_IntSet("/Interiores/int3.ini", "Int", 15); dini_FloatSet("/Interiores/int3.ini", "EX", 376.8426); dini_FloatSet("/Interiores/int3.ini", "EY", 1417.3226); dini_FloatSet("/Interiores/int3.ini", "EZ", 1081.3281); } if(!dini_Exists("/Interiores/int4.ini")){ dini_Create("/Interiores/int4.ini"); dini_IntSet("/Interiores/int4.ini", "Int", 15); dini_FloatSet("/Interiores/int4.ini", "EX", 295.2874); dini_FloatSet("/Interiores/int4.ini", "EY", 1473.2769); dini_FloatSet("/Interiores/int4.ini", "EZ", 1080.2578); } if(!dini_Exists("/Interiores/int5.ini")){ dini_Create("/Interiores/int5.ini"); dini_IntSet("/Interiores/int5.ini", "Int", 15); dini_FloatSet("/Interiores/int5.ini", "EX", 327.9431); dini_FloatSet("/Interiores/int5.ini", "EY", 1478.3801); dini_FloatSet("/Interiores/int5.ini", "EZ", 1084.4375); } if(!dini_Exists("/Interiores/int6.ini")){ dini_Create("/Interiores/int6.ini"); dini_IntSet("/Interiores/int6.ini", "Int", 10); dini_FloatSet("/Interiores/int6.ini", "EX", 2270.1050); dini_FloatSet("/Interiores/int6.ini", "EY", -1210.3917); dini_FloatSet("/Interiores/int6.ini", "EZ", 1047.5625); } if(!dini_Exists("/Interiores/int7.ini")){ dini_Create("/Interiores/int7.ini"); dini_IntSet("/Interiores/int7.ini", "Int", 2); dini_FloatSet("/Interiores/int7.ini", "EX", 447.1211); dini_FloatSet("/Interiores/int7.ini", "EY", 1397.8444); dini_FloatSet("/Interiores/int7.ini", "EZ", 1084.3047); } if(!dini_Exists("/Interiores/int8.ini")){ dini_Create("/Interiores/int8.ini"); dini_IntSet("/Interiores/int8.ini", "Int", 6); dini_FloatSet("/Interiores/int8.ini", "EX", 2196.0063); dini_FloatSet("/Interiores/int8.ini", "EY", -1204.6326); dini_FloatSet("/Interiores/int8.ini", "EZ", 1049.0234); } if(!dini_Exists("/Interiores/int9.ini")){ dini_Create("/Interiores/int9.ini"); dini_IntSet("/Interiores/int9.ini", "Int", 3); dini_FloatSet("/Interiores/int9.ini", "EX", 235.3416); dini_FloatSet("/Interiores/int9.ini", "EY", 1187.2882); dini_FloatSet("/Interiores/int9.ini", "EZ", 1080.2578); } if(!dini_Exists("/Interiores/int10.ini")){ dini_Create("/Interiores/int10.ini"); dini_IntSet("/Interiores/int10.ini", "Int", 2); dini_FloatSet("/Interiores/int10.ini", "EX", 490.9987); dini_FloatSet("/Interiores/int10.ini", "EY", 1399.4164); dini_FloatSet("/Interiores/int10.ini", "EZ", 1080.2578); } if(!dini_Exists("/Interiores/int11.ini")){ dini_Create("/Interiores/int11.ini"); dini_IntSet("/Interiores/int11.ini", "Int", 5); dini_FloatSet("/Interiores/int11.ini", "EX", 227.1212); dini_FloatSet("/Interiores/int11.ini", "EY", 1114.1840); dini_FloatSet("/Interiores/int11.ini", "EZ", 1080.9972); } if(!dini_Exists("/Interiores/int12.ini")){ dini_Create("/Interiores/int12.ini"); dini_IntSet("/Interiores/int12.ini", "Int", 7); dini_FloatSet("/Interiores/int12.ini", "EX", 225.6624); dini_FloatSet("/Interiores/int12.ini", "EY", 1022.5345); dini_FloatSet("/Interiores/int12.ini", "EZ", 1084.0145); } new Float:CasaXx, Float:CasaYx, Float:CasaZx; temp = fopen("Casa.cfg", io_readwrite); while(fread(temp, tmp, sizeof(tmp), false)) { index = 0; CasaXx = Float:floatstr(strtok(tmp, index)); CasaYx = Float:floatstr(strtok(tmp, index)); CasaZx = Float:floatstr(strtok(tmp, index)); CreatePickup(1273, 1, CasaXx, CasaYx, CasaZx, -1); } fclose(temp); return 1;public OnPlayerConnect(playerid) { morar[playerid] = 0; moradia[playerid] = 0; emcasa[playerid] = 0; ResetPlayerGrana(playerid); new aname[MAX_PLAYER_NAME]; GetPlayerName(playerid, aname, MAX_PLAYER_NAME); format(file, sizeof(file), PASTA_CONTAS, aname); if(dini_Int(file, "Casa") == 1){ Create3DTextLabel(aname,Amarelo,dini_Int(file, "CasaX"),dini_Int(file, "CasaY"),dini_Int(file, "CasaZ"),80.0,0); } } //outros SetSpawnInfo(playerid, 1, dini_Int(file, "Skin"), dini_Int(file, "CasaX"), dini_Int(file, "CasaY"), dini_Int(file, "CasaZ"),0, 0, 0, 0, 0, 0, 0); return 1; } public OnPlayerSpawn(playerid) { emcasa[playerid] = 0; if(strcmp(cmdtext, "/ajudacasa", true) == 0) { new aname[MAX_PLAYER_NAME]; GetPlayerName(playerid, aname, MAX_PLAYER_NAME); SendClientMessage(playerid, Azul, "/casa [id]: Mostra infos de uma casa determinada."); SendClientMessage(playerid, Azul, "/infocasa: Mostra infos de uma casa."); SendClientMessage(playerid, Azul, "/comprarcasa: Compra uma casa."); SendClientMessage(playerid, Azul, "/vendercasa: Vende uma casa."); SendClientMessage(playerid, Azul, "/convidarcasa [id](Dono): Convida alguйm a morar na sua casa."); SendClientMessage(playerid, Azul, "/expulsarcasa [nome](Dono): Expulsa um morador da sua casa."); //SendClientMessage(playerid, Verde,"Digite /play para comeзar e /stop para parar.");} return 1; } if(strcmp(cmd, "/criarcasa", true) == 0) { new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); if(pAdmin[playerid] == 5 || IsPlayerAdmin(playerid)){ new tmp[256]; new preco, int; tmp = strtok(cmdtext, idx); if(!strlen(tmp)){ SendClientMessage(playerid, Vermelho, "/criarcasa [preзo] [interiorID]"); return 1; } preco = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)){ SendClientMessage(playerid, Vermelho, "/criarcasa [preзo] [interiorID]"); return 1; } int = strval(tmp); format(string, sizeof(string), "/Casas/casa%d.ini", proximacasa); if(!dini_Exists(string)){ new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); dini_Create(string); dini_FloatSet(string, "PosX", X); dini_FloatSet(string, "PosY", Y); dini_FloatSet(string, "PosZ", Z); dini_IntSet(string, "Int", int); //dini_FloatSet(string, "IntX", X); //dini_FloatSet(string, "IntY", Y); //dini_FloatSet(string, "IntZ", Z); dini_IntSet(string, "Mundo", proximacasa); dini_IntSet(string, "TDono", 0); dini_Set(string, "Dono", "Ninguem"); dini_IntSet(string, "Preco", preco); dini_IntSet(string, "Trancada", 0); dini_IntSet(string, "TMorador", 0); dini_Set(string, "Morador", "Ninguem"); new pickupid; pickupid = CreatePickup(1273, 1, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"), -1); dini_IntSet(string, "Id", pickupid); proximacasa++; } } return 1; } if(strcmp(cmdtext, "/comprarcasa", true) == 0) { for(new c = 0; c < MAX_CASAS; c++) { format(string, sizeof(string), "/Casas/casa%d.ini", c); if(dini_Exists(string)){ // new Float:X, Float:Y, Float:Z; //GetPlayerPos(playerid, X, Y, Z); if(IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))){ if(dini_Int(string, "TDono") == 0){ if(GetPlayerGrana(playerid) >= dini_Int(string, "Preco")){ if(GetCasas(playerid) < 1){ new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); dini_IntSet(string, "TDono", 1); dini_Set(string, "Dono", pname); GivePlayerGrana(playerid, -dini_Int(string, "Preco")); new pickupid; DestroyPickup(dini_Int(string, "Id")); pickupid = CreatePickup(1272, 1, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"), -1); dini_IntSet(string, "Id", pickupid); OnPlayerCommandText(playerid, "/nascercasa"); } else { SendClientMessage(playerid, Vermelho, "(ERRO) Vocк sу pode ter uma casa!"); } } else { SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem dinheiro!"); } } else { SendClientMessage(playerid, Vermelho, "(ERRO) Esta casa nгo estб a venda!"); } } else { //SendClientMessage(playerid, Vermelho, "Vocк nгo estб em uma propriedade."); } } } return 1; } if(strcmp(cmd, "/precocasa", true) == 0) { new preco; new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)){ SendClientMessage(playerid, Vermelho, "/precocasa [preзo]"); return 1; } preco = strval(tmp); for(new c = 0; c < MAX_CASAS; c++) { format(string, sizeof(string), "/Casas/casa%d.ini", c); if(dini_Exists(string)){ // new Float:X, Float:Y, Float:Z; //GetPlayerPos(playerid, X, Y, Z); if(IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))){ if(pAdmin[playerid] >= 5){ new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); dini_IntSet(string, "Preco", preco); } else { SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem permissгo."); } } else { //SendClientMessage(playerid, Vermelho, "Vocк nгo estб em uma propriedade."); } } } return 1; } if(strcmp(cmd, "/convidarcasa", true) == 0) { new preco; new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)){ SendClientMessage(playerid, Vermelho, "/convidarcasa [id]"); return 1; } preco = strval(tmp); if(IsPlayerConnected(preco)){ new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); for(new c = 0; c < MAX_CASAS; c++) { format(string, sizeof(string), "/Casas/casa%d.ini", c); if(IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))){ if(dini_Exists(string)){ if(dini_Int(string, "TMorador") == 1){ return 1; } if(strcmp(dini_Get(string, "Dono"), pname, true) == 0){ format(STRX, sizeof(STRX), "(INFO) %s (ID: %d) estб convidando vocк para morar na casa dele.", pname, playerid); SendClientMessage(preco, Amarelo, STRX); SendClientMessage(preco, Amarelo, "(INFO) Para aceitar o convite, use: /aceitarmoradia || Para recusar, use: /recusarmoradia"); SendClientMessage(playerid, Vermelho, "(INFO) Convite enviado."); morar[preco] = 1; moradia[preco] = c; convitede[preco] = playerid; SetTimerEx("Moradia", 30000, false, "d",preco); } else { SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem permissгo."); } } else { //SendClientMessage(playerid, Vermelho, "Vocк nгo estб em uma propriedade."); } } } } else { SendClientMessage(playerid, Vermelho, "(ERRO) ID Invбlido."); } return 1; } if(strcmp(cmd, "/expulsarcasa", true) == 0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen (tmp)){ SendClientMessage(playerid, Vermelho, "/expulsarcasa [nome]"); return 1; } new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); for(new c = 0; c < MAX_CASAS; c++) { format(file, sizeof(file), PASTA_CONTAS, dini_Get(string, "Morador")); format(string, sizeof(string), "/Casas/casa%d.ini", c); if(dini_Exists(string)){ if(IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))){ if(strcmp(dini_Get(string, "Dono"), pname, true) == 0){ if(strcmp(dini_Get(string, "Morador"), tmp, true) == 0 && dini_Int(string, "TMorador") == 1){ SendClientMessage(playerid, Verde, "Expulso !."); dini_IntSet(string, "TMorador", 0); dini_Set(string, "Morador", "Ninguem"); dini_FloatSet(file,"CasaX",Float:1480.8500); dini_FloatSet(file,"CasaY",Float:-1764.5500); dini_FloatSet(file,"CasaZ",Float:18.8000); return 1; } else { SendClientMessage(playerid, Vermelho, "(ERRO) Esse jogador nгo mora aqui!"); return 1; } } else { SendClientMessage(playerid, Vermelho, "(ERRO) Sua casa nгo tem morador."); return 1; } } else { SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem permissгo."); return 1; } } else { //SendClientMessage(playerid, Vermelho, "Vocк nгo estб em uma propriedade."); } } return 1; } if(strcmp(cmd, "/deletarcasa", true) == 0) { new preco; new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)){ SendClientMessage(playerid, Vermelho, "/deletarcasa [casaID]"); return 1; } preco = strval(tmp); format(string, sizeof(string), "/Casas/casa%d.ini", preco); if(dini_Exists(string)){ // new Float:X, Float:Y, Float:Z; //GetPlayerPos(playerid, X, Y, Z); if(pAdmin[playerid] >= 5){ new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); DestroyPickup(dini_Int(string, "Id")); dini_IntSet(string, "TDono", 3); dini_Set(string, "Dono", "Nenhum"); dini_IntSet(string, "Id", 999); return 1; } else { SendClientMessage(playerid, Vermelho, "(ERRO)Vocк nгo tem permissгo."); } } return 1; } if(strcmp(cmd, "/casa", true) == 0) { new preco; new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)){ SendClientMessage(playerid, Vermelho, "/casa [casaID]"); return 1; } preco = strval(tmp); new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(string, sizeof(string), "/Casas/casa%d.ini", preco); if(dini_Exists(string)){ // new Float:X, Float:Y, Float:Z; //GetPlayerPos(playerid, X, Y, Z); format(STRX, sizeof(STRX), "Id[%d] Dono[%s] Morador[%s] Preзo[R$%d] InteriorID[%d]", preco, dini_Get(string, "Dono"),dini_Get(string, "Morador") , dini_Int(string, "Preco"), dini_Int(string, "Int")); SendClientMessage(playerid, Amarelo, STRX); } return 1; } if(strcmp(cmd, "/liberarcasa", true) == 0) { new preco; new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)){ SendClientMessage(playerid, Vermelho, "/liberarcasa [casaID]"); return 1; } preco = strval(tmp); format(string, sizeof(string), "/Casas/casa%d.ini", preco); if(dini_Exists(string)){ // new Float:X, Float:Y, Float:Z; //GetPlayerPos(playerid, X, Y, Z); if(pAdmin[playerid] >= 5){ format(file, sizeof(file), PASTA_CONTAS, dini_Get(string, "Dono")); dini_FloatSet(file,"CasaX",Float:1410.5046); dini_FloatSet(file,"CasaY",Float:-1789.7197); dini_FloatSet(file,"CasaZ",Float:13.8285); new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); dini_IntSet(string, "TDono", 0); dini_Set(string, "Dono", "Nenhum"); new pickupid; DestroyPickup(dini_Int(string, "Id")); pickupid = CreatePickup(1273, 1, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"), -1); dini_IntSet(string, "Id", pickupid); format(string, sizeof(string), "{00FF00}(INFO) O administrador %s liberou a casa %d", pname,preco); SendClientMessageToAll(tcadm, string); return 1; } else { SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem permissгo."); } } return 1; } if(strcmp(cmd, "/interiorcasa", true) == 0) { new preco; new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)){ SendClientMessage(playerid, Vermelho, "/interiorcasa [interiorID]"); return 1; } preco = strval(tmp); for(new c = 0; c < MAX_CASAS; c++) { format(string, sizeof(string), "/Casas/casa%d.ini", c); if(dini_Exists(string)){ // new Float:X, Float:Y, Float:Z; //GetPlayerPos(playerid, X, Y, Z); if(IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))){ if(pAdmin[playerid] >= 5){ new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); dini_IntSet(string, "Int", preco); } else { SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem permissгo."); } } else { //SendClientMessage(playerid, Vermelho, "Vocк nгo estб em uma propriedade."); } } } return 1; } if(strcmp(cmd, "/ircasa", true) == 0) { new id; new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)){ SendClientMessage(playerid, Vermelho, "/ircasa [id]"); return 1; } id = strval(tmp); format(string, sizeof(string), "/Casas/casa%d.ini", id); if(dini_Exists(string)){ // new Float:X, Float:Y, Float:Z; //GetPlayerPos(playerid, X, Y, Z); // if(IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))){ if(pAdmin[playerid] >= 5){ new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); SetPlayerPos(playerid, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ")); } else { SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo tem permissгo."); } } return 1; } if(strcmp(cmdtext, "/vendercasa", true) == 0) { new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(file, sizeof(file), PASTA_CONTAS, pname); for(new c = 0; c < MAX_CASAS; c++) { format(string, sizeof(string), "/Casas/casa%d.ini", c); if(dini_Exists(string)){ // new Float:X, Float:Y, Float:Z; //GetPlayerPos(playerid, X, Y, Z); if(IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))){ if(dini_Int(string, "TDono") == 1){ if(strcmp(dini_Get(string, "Dono"), pname, true) == 0 || pAdmin[playerid] == 5 || IsPlayerAdmin(playerid)){ if(strcmp(dini_Get(string, "Dono"), pname, true) == 0){ dini_FloatSet(file,"CasaX",Float:1410.5046); dini_FloatSet(file,"CasaY",Float:-1789.7197); dini_FloatSet(file,"CasaZ",Float:13.8285); } dini_IntSet(string, "TDono", 0); dini_Set(string, "Dono", "Ninguem"); GivePlayerGrana(playerid, dini_Int(string, "Preco")); new pickupid; DestroyPickup(dini_Int(string, "Id")); pickupid = CreatePickup(1273, 1, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"), -1); dini_IntSet(string, "Id", pickupid); } else { SendClientMessage(playerid, Vermelho, "(ERRO) Esta casa nгo й sua."); } } else { SendClientMessage(playerid, Vermelho, "(ERRO) Esta casa jб estб a venda !"); } } else { // SendClientMessage(playerid, Vermelho, "Vocк nгo estб em uma propriedade."); } } } return 1; } if(strcmp(cmdtext, "/infocasa", true) == 0) { new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); for(new c = 0; c < MAX_CASAS; c++) { format(string, sizeof(string), "/Casas/casa%d.ini", c); if(dini_Exists(string)){ // new Float:X, Float:Y, Float:Z; //GetPlayerPos(playerid, X, Y, Z); if(IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))){ format(STRX, sizeof(STRX), "~~~~ » Proprietбrio: %s » Morador: %s » Valor: R$%d » Nъmero: %d ~~~~", c, dini_Get(string, "Dono"),dini_Get(string, "Morador") , dini_Int(string, "Preco"), dini_Int(string, "Int")); SendClientMessage(playerid, Amarelo, STRX); } else { // SendClientMessage(playerid, Vermelho, "Vocк nгo estб em uma propriedade."); } } } return 1; } if(strcmp(cmdtext, "/nascercasa", true) == 0) { new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(file, sizeof(file), PASTA_CONTAS, pname); for(new c = 0; c < MAX_CASAS; c++) { format(string, sizeof(string), "/Casas/casa%d.ini", c); if(dini_Exists(string)){ // new Float:X, Float:Y, Float:Z; //GetPlayerPos(playerid, X, Y, Z); if(IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))){ if(dini_Int(string, "TDono") == 1){ if(strcmp(dini_Get(string, "Dono"), pname, true) == 0){ new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); dini_FloatSet(file,"CasaX",Float:X); dini_FloatSet(file,"CasaY",Float:Y); dini_FloatSet(file,"CasaZ",Float:Z); SetSpawnInfo(playerid, 1, dini_Int(file, "Skin"), dini_Int(file, "CasaX"), dini_Int(file, "CasaY"), dini_Int(file, "CasaZ"), 354.1657, 0, 0, 0, 0, 0, 0); } else { SendClientMessage(playerid, Vermelho, "(ERRO) Esta casa nгo й sua."); } } else { SendClientMessage(playerid, Vermelho, "(ERRO) Esta casa nгo й sua."); } } else { // SendClientMessage(playerid, Vermelho, "Vocк nгo estб em uma propriedade."); } } } return 1; } if(strcmp(cmdtext, "/aceitarmoradia", true) == 0) { new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(file, sizeof(file), PASTA_CONTAS, pname); for(new c = 0; c < MAX_CASAS; c++) { format(string, sizeof(string), "/Casas/casa%d.ini", c); if(dini_Int(string, "TMorador") == 1){ if(strcmp(dini_Get(string, "Morador"), pname, true) == 0){ dini_IntSet(string, "TMorador", 0); dini_Set(string, "Morador", "Ninguem"); } } } format(string, sizeof(string), "/Casas/casa%d.ini", moradia[playerid]); if(dini_Exists(string)){ // new Float:X, Float:Y, Float:Z; //GetPlayerPos(playerid, X, Y, Z); if(morar[playerid] == 1){ dini_IntSet(string, "TMorador", 1); dini_Set(string, "Morador", pname); new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); dini_FloatSet(file,"CasaX", dini_Float(string, "PosX")); dini_FloatSet(file,"CasaY", dini_Float(string, "PosY")); dini_FloatSet(file,"CasaZ", dini_Float(string, "PosZ")); SetSpawnInfo(playerid, 1, dini_Int(file, "Skin"), dini_Int(file, "CasaX"), dini_Int(file, "CasaY"), dini_Int(file, "CasaZ"), 354.1657, 0, 0, 0, 0, 0, 0); SendClientMessage(playerid, Amarelo, "(INFO) Agora vocк estб morando em uma casa!"); SendClientMessage(convitede[playerid], Amarelo, "(INFO) O jogador aceitou!"); morar[playerid] = 0; moradia[playerid] = 0; convitede[playerid] = 0; } else { SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo foi convidado!"); } } return 1; } if(strcmp(cmdtext, "/recusarmoradia", true) == 0) { new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(file, sizeof(file), PASTA_CONTAS, pname); if(morar[playerid] == 1){ SendClientMessage(playerid, Amarelo, "(INFO) Vocк recusou."); SendClientMessage(convitede[playerid], Amarelo, "(ERRO) O jogador recusou."); morar[playerid] = 0; moradia[playerid] = 0; convitede[playerid] = 0; } else { SendClientMessage(playerid, Vermelho, "(ERRO) Vocк nгo foi convidado!"); } return 1; } if(strcmp(cmdtext, "/entrarcasa", true) == 0) { new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); for(new c = 0; c < MAX_CASAS; c++) { format(string, sizeof(string), "/Casas/casa%d.ini", c); if (IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))) { if(dini_Int(string, "Trancada") == 1){ if(strcmp(dini_Get(string, "Dono"), pname, true) == 0 || IsPlayerAdmin(playerid)){ new strx[256]; format(strx, sizeof(strx), "/Interiores/int%d.ini", dini_Int(string, "Int")); if(dini_Exists(strx)){ emcasa[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, dini_Int(strx, "Int")); SetPlayerPos(playerid, dini_Float(strx, "EX"), dini_Float(strx, "EY"), dini_Float(strx, "EZ")); SendClientMessage(playerid, Vermelho, "(INFO) Vocк entrou na casa, para sair pressione <ENTER>."); } } } else { new strx[256]; format(strx, sizeof(strx), "/Interiores/int%d.ini", dini_Int(string, "Int")); if(dini_Exists(strx)){ emcasa[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, dini_Int(strx, "Int")); SetPlayerPos(playerid, dini_Float(strx, "EX"), dini_Float(strx, "EY"), dini_Float(strx, "EZ")); SendClientMessage(playerid, Vermelho, "(INFO) Vocк entrou na casa, para sair pressione <ENTER>."); } } } } return 1; } if(strcmp(cmd, "/verinterior", true) == 0) { new preco; new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)){ SendClientMessage(playerid, Vermelho, "/verinterior [InteriorID]"); return 1; } preco = strval(tmp); format(string, sizeof(string), "/Interiores/int%d.ini", preco); if(dini_Exists(string)){ // new Float:X, Float:Y, Float:Z; //GetPlayerPos(playerid, X, Y, Z); if(IsPlayerAdmin(playerid)){ new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); // dini_IntSet(string, "Int", preco); if(GetPlayerInterior(playerid) == 0){ emcasa[playerid] = 1; new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); CasaX[playerid] = X; CasaY[playerid] = Y; CasaZ[playerid] = Z; } SetPlayerInterior(playerid, dini_Int(string, "Int")); SetPlayerPos(playerid, dini_Float(string, "EX"), dini_Float(string, "EY"), dini_Float(string, "EZ")); SendClientMessage(playerid, Amarelo, "Para voltar aperte ENTER."); } else { SendClientMessage(playerid, Vermelho, "Vocк nгo tem permissгo."); } } return 1; } for(new c = 0; c < MAX_CASAS; c++) { format(string, sizeof(string), "/Casas/casa%d.ini", c); if(dini_Exists(string)){ if(pickupid == dini_Int(string, "Id")){ if(dini_Int(string, "TDono") == 1){ format(STRX, sizeof(STRX), "~b~]Casa]~n~~y~Dono:~w~%s~n~~r~ENTER", dini_Get(string, "Dono")); GameTextForPlayer(playerid, STRX, 5000, 5); //format(STRX, sizeof(STRX), "Dono da casa: %s, Pagou nela: R$%d", dini_Get(string, "Dono"), dini_Int(string, "Preco")); //SendClientMessage(playerid, Azul, STRX); } else { //format(STRX, sizeof(STRX), "Casa a venda, Valor de compra: R$%d, use /comprarcasa", dini_Int(string, "Preco")); //SendClientMessage(playerid, Verde, STRX); format(STRX, sizeof(STRX), "~g~]Casa]~n~~y~Dono:~w~Ninguem~n~~y~Valor:~w~R$%d~n~~g~/comprarcasa~n~~r~ENTER", dini_Int(string, "Preco")); GameTextForPlayer(playerid, STRX, 5000, 5); } } } } if (newkeys==KEY_SECONDARY_ATTACK && incar[playerid] == 1) { TogglePlayerControllable(playerid, 1); RemovePlayerFromVehicle(playerid); incar[playerid] = 0; } if (newkeys==KEY_SECONDARY_ATTACK && emcasa[playerid] == 0) { OnPlayerCommandText(playerid, "/entrarcasa"); return 1; } if (newkeys==KEY_SECONDARY_ATTACK && emcasa[playerid] == 1) { emcasa[playerid] = 0; SetPlayerVirtualWorld(playerid, 0); SetPlayerInterior(playerid, 0); SetPlayerPos(playerid, CasaX[playerid], CasaY[playerid], CasaZ[playerid]); SendClientMessage(playerid, Vermelho, "Vocк saiu da casa."); return 1; } new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, MAX_PLAYER_NAME); new string[256]; 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, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))) { if(strcmp(dini_Get(string, "Dono"), pname, true) == 0 || IsPlayerAdmin(playerid)){ if(dini_Int(string, "Trancada") == 1){ dini_IntSet(string, "Trancada", 0); SendClientMessage(playerid, Verde, "Casa Destrancada"); } else { dini_IntSet(string, "Trancada", 1); SendClientMessage(playerid, Verde, "Casa Trancada"); } } } if(newkeys==KEY_SECONDARY_ATTACK && IsPlayerInRangeOfPoint(playerid, 2.0, dini_Float(string, "PosX"), dini_Float(string, "PosY"), dini_Float(string, "PosZ"))) { if(dini_Int(string, "Trancada") == 1){ if(strcmp(dini_Get(string, "Dono"), pname, true) == 0 || IsPlayerAdmin(playerid)){ new strx[256]; format(strx, sizeof(strx), "/Interiores/int%d.ini", dini_Int(string, "Int")); if(dini_Exists(strx)){ emcasa[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, dini_Int(strx, "Int")); SetPlayerPos(playerid, dini_Float(strx, "EX"), dini_Float(strx, "EY"), dini_Float(strx, "EZ")); SendClientMessage(playerid, Vermelho, "Vocк entrou na casa para sair use ENTER."); } } } else { new strx[256]; format(strx, sizeof(strx), "/Interiores/int%d.ini", dini_Int(string, "Int")); if(dini_Exists(strx)){ emcasa[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, dini_Int(strx, "Int")); SetPlayerPos(playerid, dini_Float(strx, "EX"), dini_Float(strx, "EY"), dini_Float(strx, "EZ")); SendClientMessage(playerid, Vermelho, "Vocк entrou na casa para sair use ENTER."); } } } return 1; } public CasaLog(string[]) { new entry[256]; format(entry, sizeof(entry), "%s\r\n",string); new File:hFile; hFile = fopen("Casa.cfg", io_append); fwrite(hFile, entry); fclose(hFile); } stock GetCasas(playerid){ new props; new string[256]; new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof (pname)); for(new p = 0; p < MAX_CASAS; p++) { format(string, sizeof(string), "/Casas/casa%d.ini", p); if(dini_Int(string, "TDono") == 1){ if(strcmp(dini_Get(string, "Dono"), pname, true) == 0){ props = props+1; } } } return props; }