02.07.2018, 09:51
Entгo pessoal quando os jogadores compram ou vendem a casa, ela nгo muda a pickup... Sу quando reinicia o servidor que mostra o pickup correto. alguйm poderia me ajudar?
O cуdigo й esse:
O cуdigo й esse:
PHP код:
dcmd_comprarcasa(playerid,params[])
{
#pragma unused params
new timestamp = GetTickCount();
if(timestamp - inhousepickup[playerid] > 5000)
{
SendClientMessage(playerid, 0xFF4500AA, " | ERRO | Vocк nгo estб em uma casa.");
return 1;
}
new str[128],pname[24];
GetPlayerName(playerid, pname, 24);
format(STRX, sizeof(STRX), "Casas/Usuarios/%s", pname);
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), PASTA_CONTAS, pname);
new grana;
grana = dini_Int(file, "SaldoBancario");
dini_IntSet(file, "TemCasa", 0);
if(dini_Exists(STRX))
{
if (dini_Int(STRX, "Houseid")!=-255) return SendClientMessage(playerid, 0xFF4500AA, " | ERRO | Vocк jб tem uma casa.");
}
format(STRX, sizeof(STRX), "Casas/Casaid%d", playericonhouse[playerid]);
if (strcmp(hInfo[playericonhouse[playerid]][aName],"Ninguem",true)) return SendClientMessage(playerid, 0xFF4500AA, " | ERRO | Esta casa jб tem dono.");
if(grana > hInfo[playericonhouse[playerid]][Cost]){
format(str,sizeof(str),"| INFO - CASA | Vocк comprou a casa de nъmero [ %d] .", hInfo[playericonhouse[playerid]][Casaid]);
SendClientMessage(playerid,Branco,str);
print(str);
dini_IntSet(STRX, "TemDono", 1);
new ano,mes,dia;
new string[266];
getdate(ano, mes, dia);
format(string, sizeof(string), " (%d/%d/%d)", dia,mes,ano);
dini_Set(STRX, "Login", string);
format(hInfo[playericonhouse[playerid]][Login],255, string);
dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")-hInfo[playericonhouse[playerid]][Cost]);
dini_Set(STRX, "Name", pname);
hInfo[playericonhouse[playerid]][aName]=pname;
hInfo[playericonhouse[playerid]][Locked] = 0;
new Float:sy, Float:sx, Float:sz;
GetPlayerPos(playerid, sx,sy,sz);
dini_FloatSet(STRX, "SpawnX", sx);
dini_FloatSet(STRX, "SpawnY", sy);
dini_FloatSet(STRX, "SpawnZ", sz);
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
format(STRX, sizeof(STRX), "Casas/Usuarios/%s", nome);
if (!dini_Exists(STRX)) dini_Create(STRX);
dini_IntSet(STRX, "Houseid", playericonhouse[playerid]);
if(!dini_Isset(STRX,"Rentid"))
{
dini_IntSet(STRX, "Rentid", -255);
}
GetPlayerPos(playerid, sx,sy,sz);
dini_FloatSet(STRX, "SpawnX", sx);
dini_FloatSet(STRX, "SpawnY", sy);
dini_FloatSet(STRX, "SpawnZ", sz);
dini_IntSet(STRX, "SpawnInt", GetPlayerInterior(playerid));
dini_IntSet(STRX, "Luz", 0);
dini_IntSet(STRX, "Agua", 0);
DestroyDynamicMapIcon(housemapicon[playericonhouse[playerid]]);
housemapicon[playericonhouse[playerid]] = CreateDynamicMapIcon(hInfo[playericonhouse[playerid]][iconx],hInfo[playericonhouse[playerid]][icony],hInfo[playericonhouse[playerid]][iconz],32,0, -1, -1, -1, 100.0);
DestroyPickup(HousePickup[playericonhouse[playerid]]);
GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
HousePickup[playericonhouse[playerid]] = CreatePickup(19522, 23, hInfo[playericonhouse[playerid]][iconx], hInfo[playericonhouse[playerid]][icony], hInfo[playericonhouse[playerid]][iconz]);
format(STRX, sizeof(STRX), "| INFO - CASA | O(A) Jogador(a): %s comprou a casa nъmero [ %d ] {FF8247} Localizada Em: %s",pname,hInfo[playericonhouse[playerid]][Casaid], zone);
SendClientMessageToAll(Branco,STRX);
foreach(Player, i)
{
RemovePlayerMapIcon(i, housemapicon[playerid]);
housemapicon[playerid] = SetPlayerMapIcon(i,32,hInfo[playericonhouse[playerid]][iconx], hInfo[playericonhouse[playerid]][icony], hInfo[playericonhouse[playerid]][iconz],32,0xFF0000AA);
}
} else {
SendClientMessage(playerid, 0xFF4500AA," | ERRO | Vocк nгo tem esse dinheiro em seu banco.");
}
return 1;
}
dcmd_vendercasa(playerid,params[])
{
#pragma unused params
new timestamp = GetTickCount();
if(timestamp - inhousepickup[playerid] > 5000)
{
return 1;
}
new pname[24];
GetPlayerName(playerid, pname, 24);
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), PASTA_CONTAS, pname);
format(pf, sizeof(pf), "Casas/Casaid%d", playericonhouse[playerid]);
format(gStr, sizeof(gStr), "Casas/Usuarios/%s", hInfo[playericonhouse[playerid]][aName]);
if (strcmp(hInfo[playericonhouse[playerid]][aName],pname,false)) return SendClientMessage(playerid, 0xFF4500AA, "| ERRO | Vocк nгo й dono dessa casa.");
dini_Remove(gStr);
new string[128];
format(string,sizeof(string),"| INFO - CASA | Vocк vendeu a casa de nъmero [ %d ] .", hInfo[playericonhouse[playerid]][Casaid]);
SendClientMessage(playerid,Branco,string);
dini_IntSet(file, "TemCasa", 0);
dini_IntSet(file, "SaldoBancario", dini_Int(file, "SaldoBancario")+hInfo[playericonhouse[playerid]][Cost]);
dini_Set(pf, "Name", "Ninguem");
dini_Set(pf, "Renter", "Ninguem");
dini_Set(pf, "Des", "Nada");
dini_Set(pf, "Login", "(00/00/0000)");
dini_IntSet(pf, "TemDono", 0);
dini_IntSet(pf, "alarme", 0);
dini_IntSet(pf, "liberado", 0);
dini_IntSet(pf, "Carrof", 0);
hInfo[playericonhouse[playerid]][Locked] = 0;
format(hInfo[playericonhouse[playerid]][aName],255,"Ninguem");
format(hInfo[playericonhouse[playerid]][Renter],255,"Ninguem");
format(hInfo[playericonhouse[playerid]][Des],255,"Nada");
format(hInfo[playericonhouse[playerid]][Login],255,"(0/0/0000)");
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
format(pf, sizeof(pf), "Casas/Usuarios/%s", nome);
dini_IntSet(pf, "Houseid", -255);
DestroyDynamicMapIcon(housemapicon[playericonhouse[playerid]]);
housemapicon[playericonhouse[playerid]] = CreateDynamicMapIcon(hInfo[playericonhouse[playerid]][iconx],hInfo[playericonhouse[playerid]][icony],hInfo[playericonhouse[playerid]][iconz],31,0, -1, -1, -1, 100.0);
DestroyPickup(HousePickup[playericonhouse[playerid]]);
GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
HousePickup[playericonhouse[playerid]] = CreatePickup(1273, 23, hInfo[playericonhouse[playerid]][iconx], hInfo[playericonhouse[playerid]][icony], hInfo[playericonhouse[playerid]][iconz]);
format(pf, sizeof(pf), "| INFO - CASA | O(A) Jogador(a): %s vendeu a sua casa nъmero [ %d ] {FF8247} Localizada Em: %s",pname ,hInfo[playericonhouse[playerid]][Casaid],zone);
SendClientMessageToAll(0xF8F8FFAA,pf);
foreach(Player, i)
{
RemovePlayerMapIcon(i, housemapicon[i]);
housemapicon[playerid] = SetPlayerMapIcon(i,32,hInfo[playericonhouse[i]][iconx], hInfo[playericonhouse[i]][icony], hInfo[playericonhouse[i]][iconz],31,0xFF0000AA);
}
return 1;
}