16.05.2015, 12:55
Hello guys.
So i made my house system and everything works fine but.. (there is always but >.<)
The problem is in the 3D texts and saving...
Here is my /makehouse command:
Here is mine 'house saving'..
/buyhouse command:
..ModeInIt:
"news":
++ If you really don't understand some words and stuff like that just say i will translate.
++ So at the end problem is: When i buy house, 3D before this which is showing now didn't hide.
Also the problem is saving names I mean i bought house,left the server and in file still says "Nitko" ("Nobody" or "None" on English).
Thanks in advance. !
So i made my house system and everything works fine but.. (there is always but >.<)
The problem is in the 3D texts and saving...
Here is my /makehouse command:
PHP код:
CMD:napravikucu(playerid,params[])
{
new Cijena, tip, SefMoney, ID,string[128], GetInterijer, svijet, Float:XInterior, Float:YInterior, Float:ZInterior, Interijer;
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Niste ulogirani na server");
if(PlayerInfo[playerid][pAdministrator] < 5) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Nemate dozvolu za tu komandu");
if(sscanf(params,"ddddfff",Cijena,tip,Interijer,SefMoney,XInterior,YInterior,ZInterior)) return SendClientMessage(playerid,-1,"Koristenje: {FFF1AF}/napravikucu [Cijena] [TIP] [Interijer] [Novac(sef)] [InteriorX] [InteriorY] [InteriorZ]");
if(Cijena < 100000 || Cijena > 1000000) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Odaberite cijenu: [$100.000-$100.000.00]");
if(tip < 0 || tip > 2) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Odaberite TIP: 0-2");
if(SefMoney < 0 || SefMoney > 150000) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Odaberite novac u sefu: $0 - $150.000");
{
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,A);
GetInterijer = GetPlayerInterior(playerid);
svijet = GetPlayerVirtualWorld(playerid);
for(new houseid = 1; houseid < MAX_KUCA; houseid++)
{
if(HouseInfo[houseid][hCijena] == 0)
{
ID = houseid;
break;
}
}
/* Proredak */
HouseInfo[ID][hUnutrasnjiInterijer] = Interijer;
HouseInfo[ID][hIzlazX] = XInterior;
HouseInfo[ID][hIzlazY] = YInterior;
HouseInfo[ID][hIzlazY] = ZInterior;
HouseInfo[ID][hOwned] = 0;
HouseInfo[ID][hCijena] = Cijena;
HouseInfo[ID][hTip] = tip;
HouseInfo[ID][hUlazX] = X;
HouseInfo[ID][hUlazY] = Y;
HouseInfo[ID][hUlazZ] = Z;
HouseInfo[ID][hUlazA] = A;
HouseInfo[ID][hZakljucan] = 1;
HouseInfo[ID][hInterijer] = GetInterijer;
HouseInfo[ID][hSvijet] = svijet;
KucaMapIcon = CreateDynamicMapIcon(X,Y,Z, 31, -1, -1 ,-1, -1, 100);
KucaPickup = CreateDynamicPickup(1273,1, X,Y,Z,-1,-1,-1, 100);
/* Proredak */
format(string, sizeof(string), "Nitko");
strmid(HouseInfo[ID][hVlasnik], string, 0, strlen(string), 255);
/* Proredak - Spremanje */
new hFile[40];
format(hFile,sizeof(hFile),hPATH,ID);
new INI:File = INI_Open(hFile);
{
INI_SetTag(File,"data");
INI_WriteInt(File,"Owned",HouseInfo[ID][hOwned]);
INI_WriteInt(File,"Cijena",HouseInfo[ID][hCijena]);
INI_WriteString(File,"Vlasnik",HouseInfo[ID][hVlasnik]);
INI_WriteInt(File,"Zakljucano",HouseInfo[ID][hZakljucan]);
INI_WriteInt(File,"House_Novac",HouseInfo[ID][hNovac]);
INI_WriteInt(File,"House_Gun",HouseInfo[ID][hGun]);
INI_WriteInt(File,"Tip",HouseInfo[ID][hTip]);
INI_WriteFloat(File,"UlazX",HouseInfo[ID][hUlazX]);
INI_WriteFloat(File,"UlazY",HouseInfo[ID][hUlazY]);
INI_WriteFloat(File,"UlazZ",HouseInfo[ID][hUlazZ]);
INI_WriteFloat(File,"UlazA",HouseInfo[ID][hUlazA]);
new poruka[256];
{
Kuca3D = format(poruka,sizeof(poruka),""COLOR_SIVA"~{FFFFFF} Kuca na prodaju "COLOR_SIVA"~\n{FFFFFF}TIP Kuce: {FFF1AF}%s\n{FFFFFF}Cijena: "COLOR_ZELENA"$%d\n\n{FFFFFF}Ukoliko zelite kupiti kucu: /kupikucu",KucaType(tip),HouseInfo[ID][hCijena]);
Create3DTextLabel(poruka,-1,HouseInfo[ID][hUlazX], HouseInfo[ID][hUlazY], HouseInfo[ID][hUlazZ], 30.0,0,0);
}
INI_WriteFloat(File,"IzlazX",HouseInfo[ID][hIzlazX]);
INI_WriteFloat(File,"IzlazY",HouseInfo[ID][hIzlazY]);
INI_WriteFloat(File,"IzlazZ",HouseInfo[ID][hIzlazZ]);
INI_WriteFloat(File,"IzlazA",HouseInfo[ID][hIzlazA]);
INI_WriteInt(File,"Interijer",HouseInfo[ID][hInterijer]);
INI_WriteInt(File,"Unutrasnji_Interijer",HouseInfo[ID][hUnutrasnjiInterijer]);
INI_WriteInt(File,"Svijet",HouseInfo[ID][hSvijet]);
INI_WriteInt(File,"Ikona",HouseInfo[ID][hIkona]);
INI_Close(File);
}
}
return 1;
}
PHP код:
public SaveKuca(houseid)
{
new hFile[40];
format(hFile, sizeof(hFile), hPATH, houseid);
new INI:File = INI_Open(hFile);
{
INI_SetTag(File,"data");
INI_WriteInt(File,"Owned",HouseInfo[houseid][hOwned]);
INI_WriteInt(File,"Cijena",HouseInfo[houseid][hCijena]);
INI_WriteString(File,"Vlasnik",HouseInfo[houseid][hVlasnik]);
INI_WriteInt(File,"Zakljucano",HouseInfo[houseid][hZakljucan]);
INI_WriteInt(File,"House_Sef",HouseInfo[houseid][hNovac]);
INI_WriteInt(File,"House_Gun",HouseInfo[houseid][hGun]);
INI_WriteInt(File,"Tip", HouseInfo[houseid][hTip]);
INI_WriteFloat(File,"UlazX",HouseInfo[houseid][hUlazX]);
INI_WriteFloat(File,"UlazY",HouseInfo[houseid][hUlazY]);
INI_WriteFloat(File,"UlazZ",HouseInfo[houseid][hUlazZ]);
INI_WriteFloat(File,"UlazA",HouseInfo[houseid][hUlazA]);
INI_WriteFloat(File,"IzlazX",HouseInfo[houseid][hIzlazX]);
INI_WriteFloat(File,"IzlazY",HouseInfo[houseid][hIzlazY]);
INI_WriteFloat(File,"IzlazZ",HouseInfo[houseid][hIzlazZ]);
INI_WriteFloat(File,"IzlazA",HouseInfo[houseid][hIzlazA]);
INI_WriteInt(File,"Interijer",HouseInfo[houseid][hInterijer]);
INI_WriteInt(File,"UnutarnjiInterijer", HouseInfo[houseid][hUnutrasnjiInterijer]);
INI_WriteInt(File,"Svijet",HouseInfo[houseid][hSvijet]);
INI_WriteInt(File,"Ikona",HouseInfo[houseid][hIkona]);
}
return 1;
}
PHP код:
CMD:kupikucu(playerid, params[])
{
new ID = IsPlayerNearHouse(playerid);
if(ID == -1 || ID == 0) return SendClientMessage(playerid, -1, ""COLOR_CRVENA"Greska:{FFFFFF} Ne nalazite se na mjestu kupovine.");
if(HouseInfo[ID][hOwned] != 0 || HouseInfo[ID][hCijena] == 0) return SendClientMessage(playerid, -1, ""COLOR_CRVENA"Greska:{FFFFFF} Odabrana kuca nije na prodaju.");
if(PlayerInfo[playerid][Kuca] != 0) return SendClientMessage(playerid, -1, ""COLOR_CRVENA"Greska:{FFFFFF} Vec posjedujete jednu kucu.");
if(GetPlayerMoney(playerid) < HouseInfo[ID][hCijena]) return SendClientMessage(playerid, -1, ""COLOR_CRVENA"Greska:{FFFFFF} Nemate dovoljno novca na racunu.");
{
PlayerInfo[playerid][Kuca] = 1;
GivePlayerMoney(playerid, -HouseInfo[ID][hCijena]);
HouseInfo[ID][hZakljucan] = 0;
HouseInfo[ID][hOwned] = 1;
HouseInfo[ID][hVlasnik] = GetName(playerid);
SendClientMessage(playerid,-1,""COLOR_WG"WG:{FFFFFF} Postali ste vlasnik kuce.");
SendClientMessage(playerid,-1,""COLOR_WG"WG:{FFFFFF} Sve prednosti pregledajte komandom: /kuca");
new poruka[128];
for(new idx = 1; idx < sizeof(BusinessInfo); idx++)
{
KucaPickupOwned = CreateDynamicPickup(19522,1, HouseInfo[idx][hUlazX],HouseInfo[idx][hUlazY],HouseInfo[idx][hUlazZ],-1,-1,-1, 100);
KucaMapIconOwned = CreateDynamicMapIcon(HouseInfo[idx][hUlazX],HouseInfo[idx][hUlazY],HouseInfo[idx][hUlazZ],32,-1,-1,-1,-1,100);
DestroyDynamicMapIcon(KucaMapIcon);
/* Proredak */
Kuca3DOwned = format(poruka,sizeof(poruka),"{FFFFFF}TIP Kuce: %s\nVlasnik: %s\nCijena:"COLOR_ZELENA" $%d{FFFFFF}\n\nPritisnite 'f' ili 'enter' za ulazak.\nIzravan nacin -"COLOR_ZELENA" (/enter)",KucaType(idx),HouseInfo[idx][hVlasnik],HouseInfo[idx][hCijena]);
Create3DTextLabel(poruka,-1,HouseInfo[idx][hUlazX],HouseInfo[idx][hUlazY],HouseInfo[idx][hUlazZ],30,0,0);
}
}
return 1;
}
PHP код:
new poruka[40],poruka2[256];
for(new houseid = 1; houseid < MAX_KUCA; houseid++)
{
format(poruka,sizeof(poruka),hPATH,houseid);
INI_ParseFile(poruka, "LoadKuca_data_%d", .bExtra = true, .extra = houseid);
HouseInfo[houseid][hIkona] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hUlazX], HouseInfo[houseid][hUlazY], HouseInfo[houseid][hUlazZ], HouseInfo[houseid][hSvijet]);
if(HouseInfo[houseid][hOwned] == 1)
{
KucaPickupOwned = CreateDynamicPickup(19522,1, HouseInfo[houseid][hUlazX],HouseInfo[houseid][hUlazY],HouseInfo[houseid][hUlazZ],-1,-1,-1, 100);
KucaMapIconOwned = CreateDynamicMapIcon(HouseInfo[houseid][hUlazX],HouseInfo[houseid][hUlazY],HouseInfo[houseid][hUlazZ],32,-1,-1,-1,-1,100);
Kuca3DOwned = format(poruka2,sizeof(poruka2),"{FFFFFF}TIP Kuce: %s\nVlasnik: %s\nCijena:"COLOR_ZELENA" $%d{FFFFFF}\n\nPritisnite 'f' ili 'enter' za ulazak.\nIzravan nacin -"COLOR_ZELENA" (/enter)",KucaType(houseid),HouseInfo[houseid][hVlasnik],HouseInfo[houseid][hCijena]);
Create3DTextLabel(poruka,-1,HouseInfo[houseid][hUlazX],HouseInfo[houseid][hUlazY],HouseInfo[houseid][hUlazZ],30,0,0);
}
else
{
KucaPickup = CreateDynamicPickup(1273,1, HouseInfo[houseid][hUlazX],HouseInfo[houseid][hUlazY],HouseInfo[houseid][hUlazZ],-1,-1,-1, 100);
KucaMapIcon = CreateDynamicMapIcon(HouseInfo[houseid][hUlazX],HouseInfo[houseid][hUlazY],HouseInfo[houseid][hUlazZ], 31, -1, -1 ,-1, -1, 100);
Kuca3D = format(poruka2,sizeof(poruka2),""COLOR_SIVA"~{FFFFFF} Kuca na prodaju "COLOR_SIVA"~\n{FFFFFF}TIP Kuce: {FFF1AF}%s\n{FFFFFF}Cijena: "COLOR_ZELENA"$%d\n\n{FFFFFF}Ukoliko zelite kupiti kucu: /kupikucu",KucaType(houseid),HouseInfo[houseid][hCijena]);
Create3DTextLabel(poruka,-1,HouseInfo[houseid][hUlazX], HouseInfo[houseid][hUlazY], HouseInfo[houseid][hUlazZ], 30.0,0,0);
}
}
PHP код:
new Kuca3D;
new Kuca3DOwned;
new KucaMapIcon;
new KucaMapIconOwned;
new KucaPickup;
new KucaPickupOwned;
++ So at the end problem is: When i buy house, 3D before this which is showing now didn't hide.
Also the problem is saving names I mean i bought house,left the server and in file still says "Nitko" ("Nobody" or "None" on English).
Thanks in advance. !