13.06.2014, 13:39
It does not reading from the file. Everything I tried to get from a file was 0.0 -.-
Once I tried to load from HouseInteriors.INI, server crashed. Then I tried from .cfg file and server did not crashed but not loaded line properly. All I got from a file was 0.0. This is how my HouseInteriors.cfg file looks like:
pawn Код:
CMD:createhouse(playerid, params[])
{
new hinterior, hcost, HID;
if(sscanf(params, "ddd", HID, hinterior, hcost)) return scm(playerid, colorusage, "USAGE: /createhouse [HouseID] [Interior] [Price]");
else if(pInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, colorgrey, "<!> You're not authorized to use that command.");
else if(hinterior < 0 || hinterior > 150) return scm(playerid, colorgrey, "<!> Invalid interior ID!");
else
{
if(fexist(HousePath(HID))) return scm(playerid, colorgrey, "<!> House with that ID already exist!");
new Float:X, Float:Y, Float:Z, pInter, pVirW;
GetPlayerPos(playerid, X, Y, Z);
pInter = GetPlayerInterior(playerid);
pVirW = GetPlayerVirtualWorld(playerid);
CreateHouse(HID, hinterior, X, Y, Z, pInter, pVirW, hcost);
}
return 1;
}
pawn Код:
stock CreateHouse(HouseID, Unique, Float:X, Float:Y, Float:Z, OutsideInter, OutsideVirW, HousePrice)
{
new File:HouseFile = fopen("HouseInteriors.cfg", io_read);
new string[128], uniqueint, hinterior, Float:Pos[3], name[128];
while(fread(HouseFile, string))
{
if(strval(string) == Unique)
{
sscanf(string,"iia<f>[3]p<;>s[64]",uniqueint, hinterior, Pos[0], Pos[1], Pos[2], name);
break;
}
}
fclose(HouseFile);
new INI:House = INI_Open(HousePath(HouseID));
INI_WriteFloat(House, "EnterX", X);
INI_WriteFloat(House, "EnterY", Y);
INI_WriteFloat(House, "EnterZ", Z);
INI_WriteFloat(House, "ExitX", Pos[0]);
INI_WriteFloat(House, "ExitY", Pos[1]);
INI_WriteFloat(House, "ExitZ", Pos[2]);
INI_WriteInt(House, "InsideInt", hinterior);
INI_WriteInt(House, "InsideVW", HouseID+2);
INI_WriteInt(House, "OutsideInt", OutsideInter);
INI_WriteInt(House, "OutsideVW", OutsideVirW);
INI_WriteInt(House, "Owned", 0);
INI_WriteInt(House, "Price", HousePrice);
INI_Close(House);
printf("HouseID %d | UniqInteriorID: %d | Interior: %d | X: %f | Y: %f | Z: %f | OutsideInt: %d | OutsideVW: %d | Price: %d", HouseID, uniqueint, hinterior, Pos[0], Pos[1], Pos[2], OutsideInter, OutsideVirW, HousePrice);
LoadHouse(HouseID, HousePath(HouseID));
return 1;
}
Quote:
0 11 2003.1178 1015.1948 33.008 351.5789 Four Dragons' Managerial Suite ; 1 5 770.8033 -0.7033 1000.7267 22.8599 Ganton Gym ; 2 3 974.0177 -9.5937 1001.1484 22.6045 Brothel ; 3 3 961.9308 -51.9071 1001.1172 95.5381 Brothel2 ; 4 3 830.6016 5.9404 1004.1797 125.8149 Inside Track Betting ; 5 3 1037.8276 0.397 1001.2845 353.9335 Blastin' Fools Records ; 6 3 1212.1489 -28.5388 1000.9531 170.5692 The Big Spread Ranch ; 7 18 1290.4106 1.9512 1001.0201 179.9419 Warehouse 1 ; 8 1 1412.1472 -2.2836 1000.9241 114.661 Warehouse 2 ; 9 3 1527.0468 -12.0236 1002.0971 350.0013 B Dup's Apartment ; 10 2 1523.5098 -47.8211 1002.2699 262.7038 B Dup's Crack Palace ; 11 3 612.2191 -123.9028 997.9922 266.5704 Wheel Arch Angels ; 12 3 512.9291 -11.6929 1001.5653 198.7669 OG Loc's House ; 13 3 418.4666 -80.4595 1001.8047 343.2358 Barber Shop ; 14 3 386.5259 173.6381 1008.3828 63.7399 Planning Department ; ETC... |