23.02.2014, 17:42
(
Последний раз редактировалось jueix; 25.02.2014 в 08:13.
)
Ok In my createhouse command its always creating house ID of 0 Here's my code. I want it to create house 0 then 1 then 2 etc. And if a house gets deleted for example house 2 and we have 0 1 and 3 it will create house 2 again. At the moment each time I create a house it creates house 0 all the time.
pawn Код:
stock GetHouses()
{
new file[60];
for(new i = 0; i < MAX_HOUSES;i++)
{
format(file,sizeof(file),"Houses/houseid%i.ini",i);
if(!DOF2_FileExists(file)) return i;
}
return -1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 28:
{
if(!response)
{
SendClientMessage(playerid, 0x42F3F198, "Well this lift has its ups and downs.");
return 1;
}
switch(listitem)
{
case 0:
{
new housewep[256];
new houseid;
houseid = GetHouses()+1;
format(housewep, sizeof(housewep), "Houses/housewepid%d",GetHouses()+1);
new house[256];
format(house, sizeof(house), "Houses/houseid%d",houseid);
if(!DOF2_FileExists(housewep))
{
DOF2_CreateFile(housewep);
DOF2_SetInt(housewep, "wep1", 0);
DOF2_SetInt(housewep, "wep2", 0);
DOF2_SetInt(housewep, "wep3", 0);
DOF2_SetInt(housewep, "wep4", 0);
DOF2_SetInt(housewep, "wep5", 0);
DOF2_SetInt(housewep, "wep6", 0);
DOF2_SetInt(housewep, "wep7", 0);
DOF2_SetInt(housewep, "wep8", 0);
DOF2_SetInt(housewep, "wep9", 0);
DOF2_SetInt(housewep, "wep10", 0);
DOF2_SetInt(housewep, "wep1ammo", 0);
DOF2_SetInt(housewep, "wep2ammo", 0);
DOF2_SetInt(housewep, "wep3ammo", 0);
DOF2_SetInt(housewep, "wep4ammo", 0);
DOF2_SetInt(housewep, "wep5ammo", 0);
DOF2_SetInt(housewep, "wep6ammo", 0);
DOF2_SetInt(housewep, "wep7ammo", 0);
DOF2_SetInt(housewep, "wep8ammo", 0);
DOF2_SetInt(housewep, "wep9ammo", 0);
DOF2_SetInt(housewep, "wep10ammo", 0);
DOF2_WriteFile();
}
if(!DOF2_FileExists(house))
{
DOF2_CreateFile(house);
format(hInfo[houseid][hOwnerName], 24, "For Sale");
DOF2_SetString(house, "OwnerName", "For Sale");
format(hInfo[houseid][hRenter], 24, "For Rent");
DOF2_SetString(house, "RenterName", "For Rent");
hInfo[houseid][hOwned] = 0;
DOF2_SetInt(housewep, "Owned", 0);
hInfo[houseid][hRented] = 0;
DOF2_SetInt(housewep, "Rented", 0);
hInfo[houseid][hLocked] = 1;
DOF2_SetInt(housewep, "Locked", 1);
hInfo[houseid][hWeed] = 0;
DOF2_SetInt(housewep, "Weed", 0);
hInfo[houseid][hCocoaine] = 0;
DOF2_SetInt(housewep, "Cocoaine", 0);
hInfo[houseid][hCocoaine] = 0;
DOF2_SetInt(housewep, "Cocoaine", 0);
hInfo[houseid][hInt] = CHInt[playerid];
DOF2_SetInt(housewep, "Interior", CHInt[playerid]);
hInfo[houseid][hVW] = GetHouses()+1;
DOF2_SetInt(housewep, "VirtualWorld", GetHouses()+1);
hInfo[houseid][hArmour] = 0;
DOF2_SetFloat(housewep, "Armour", 0);
hInfo[houseid][hEnterPointX] = CHEntX[playerid];
DOF2_SetFloat(housewep, "EnterX", CHEntX[playerid]);
hInfo[houseid][hEnterPointY] = CHEntY[playerid];
DOF2_SetFloat(housewep, "EnterY", CHEntY[playerid]);
hInfo[houseid][hEnterPointZ] = CHEntZ[playerid];
DOF2_SetFloat(housewep, "EnterZ", CHEntZ[playerid]);
hInfo[houseid][hIntX] = CHIntX[playerid];
DOF2_SetFloat(housewep, "IntX", CHIntX[playerid]);
hInfo[houseid][hIntY] = CHIntY[playerid];
DOF2_SetFloat(housewep, "IntY", CHIntY[playerid]);
hInfo[houseid][hIntZ] = CHIntZ[playerid];
DOF2_SetFloat(housewep, "IntZ", CHIntZ[playerid]);
DOF2_WriteFile();
}
}
case 1:
{
SendClientMessage(playerid, 0x42F3F198, "/gotolastpos to go back to your last position.");
SetPlayerPos(playerid,CHIntX[playerid],CHIntY[playerid],CHIntZ[playerid]);
SetPlayerInterior(playerid,CHInt[playerid]);
}
}
}
}
}