[HELP] Chaning house ID
#1

Hello guys, so when I finished making a house system, I noticed that after creating a house id, the ID stays the same even when I create another house, so the results are, only one house can be saved, which is the last created house, and all other ones get deleted,
here are some part of the script,

the saving stock
PHP код:
#define MAX_HOUSES 100
new HCount;
PHousePath(houseid){
    new 
str[45];
    
format(strsizeof(str), PHOUSE_PATHhouseid);
    return 
str;

the /createhouse command (I think the problem is here)
PHP код:

CMD
:createhouse(playeridparams[]){
    if(
IsPlayerAdmin(playerid)){
        new 
Float:p[3], pricehouseidhinteriorstr[250];
        
//new HouseCount = houseid;
        
if(sscanf(params"ii"pricehinterior)) return SendClientMessage(playeridBLREN"[USAGE]: {FFFFFF}/createhouse <price> <interior>") && SendClientMessage(playeridBLREN"[FUNCTION]: {FFFFFF}Create a house with setting up its price") && SendClientMessage(playeridBLREN"[HINT]: {FFFFFF}Use /houseint to preview available house interiors");
        if(
hinterior || hinterior 6) return SendClientMessage(playeridRED"[ERROR]: {FFFFFF}invalide interior id, use {FFFF00}/houseint {FFFFFF}to see available interiors");
        switch(
hinterior){
            case 
0:{//Ryder's house
                
HouseInfo[houseid][hExitX] = 2454.717041;
                 
HouseInfo[houseid][hExitY] = -1700.871582;
                 
HouseInfo[houseid][hExitZ] = 1013.515197;
                 
HouseInfo[houseid][hInsideVir] = 3;
            
            }
            case 
1:{//Sweet's house
                
HouseInfo[houseid][hExitX] =  2527.654052;
                 
HouseInfo[houseid][hExitY] = -1679.388305;
                 
HouseInfo[houseid][hExitZ] = 1015.498596;
                 
HouseInfo[houseid][hInsideVir] = 1;
            }
            case 
2:{//CJ's house
                
HouseInfo[houseid][hExitX] = 2496.049804;
                 
HouseInfo[houseid][hExitY] = -1695.238159;
                 
HouseInfo[houseid][hExitZ] = 1014.742187;
                 
HouseInfo[houseid][hInsideVir] = 3;
            }
            case 
3:{//Modern house
                
HouseInfo[houseid][hExitX] = 2324.419921;
                 
HouseInfo[houseid][hExitY] = -1145.568359;
                 
HouseInfo[houseid][hExitZ] = 1050.710083;
                 
HouseInfo[houseid][hInsideVir] = 12;
                
            } 
            case 
4:{//Og loc's house
                
HouseInfo[houseid][hExitX] = 513.882507;
                 
HouseInfo[houseid][hExitY] = -11.269994;
                 
HouseInfo[houseid][hExitZ] = 1001.565307;
                 
HouseInfo[houseid][hInsideVir] = 3;
            
            }
            case 
5:{//Mad dogg
                
HouseInfo[houseid][hExitX] = 1267.663208;
                 
HouseInfo[houseid][hExitY] = -781.323242;
                 
HouseInfo[houseid][hExitZ] = 1091.906250;
                 
HouseInfo[houseid][hInsideVir] = 5;
            }
        }
        [
COLOR="darkorange"]HCount houseid;[/COLOR]
        
GetPlayerPos(playeridp[0], p[1], p[2]);
        
CreatePickup(12731p[0], p[1], p[2], 0);
        
HouseInfo[houseid][hPrice] = price;
        
format(strsizeof(str), "{FFFFFF}{FF00FF}/buyhouse\n{FFFFFF}Owner: {FFFF00}None\n{FFFFFF}Price: {FFFF00}%i\n{FFFFFF}Press {008080}N {FFFFFF}to enter"HouseInfo[houseid][hPrice]);
        
Create3DTextLabel(str0xFFFFFFp[0], p[1], p[2], 10.000);
        
HouseInfo[houseid][hEnterX] = p[0];
        
HouseInfo[houseid][hEnterY] = p[1];
        
HouseInfo[houseid][hEnterZ] = p[2];
        
HouseInfo[houseid][hOutsideVir] = GetPlayerInterior(playerid);
        new 
INI:File INI_Open(PHousePath(houseid));
        
INI_SetTag(File"HousePos");
        
INI_WriteFloat(File"hEnterX"HouseInfo[houseid][hEnterX]);
        
INI_WriteFloat(File"hEnterY"HouseInfo[houseid][hEnterY]);
        
INI_WriteFloat(File"hEnterZ"HouseInfo[houseid][hEnterZ]);
        
INI_WriteFloat(File"hExitX"HouseInfo[houseid][hExitX]);
        
INI_WriteFloat(File"hExitY"HouseInfo[houseid][hExitY]);
        
INI_WriteFloat(File"hExitZ"HouseInfo[houseid][hExitZ]);
        
INI_WriteInt(File"hInsideInt"0);
        
INI_SetTag(File"HouseInfo");
        
INI_WriteInt(File"hOwned"0);
        
INI_WriteString(File"hOwner""N/A");
        
INI_WriteString(File"hTitle""N/A");
        
INI_WriteInt(File"hPrice"HouseInfo[houseid][hPrice]);
        
INI_WriteInt(File"hInsideVir"HouseInfo[houseid][hInsideVir]);
        
INI_WriteInt(File"hOutsideVir"HouseInfo[houseid][hOutsideVir]);
        
INI_Close(File);
        [
COLOR="DarkOrange"]HCount++;[/COLOR]
        return 
1;
    }
    else{
        
ErrorMessage(playerid6);
    }
    return 
1;

if I'm not mistaken, the orange highlighted part are not functioning as they should,
do you guys have any ideas how to solve this?
Reply


Messages In This Thread
[HELP] Chaning house ID - by Eoussama - 18.10.2016, 11:54
Re: [HELP] Chaning house ID - by RoboN1X - 18.10.2016, 12:37
Re: [HELP] Chaning house ID - by Eoussama - 18.10.2016, 12:45
Re: [HELP] Chaning house ID - by RoboN1X - 18.10.2016, 12:47
Re: [HELP] Chaning house ID - by Eoussama - 18.10.2016, 12:57

Forum Jump:


Users browsing this thread: 1 Guest(s)