SA-MP Forums Archive
Housing system help..? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Housing system help..? (/showthread.php?tid=306690)



Housing system help..? - Scarred - 27.12.2011

I'm new to using Dini, so I'm wondering, what's wrong with this? I've looked everything up I possibly can, and can't figure out why it's not working.

pawn Код:
stock SaveHouse(houseid)
{
    new fstring[10];
    format(fstring, 10, "Houses/%d", houseid);
    if(!dini_Exists(fstring)) return 0;
   
    dini_FloatSet(fstring, "EnterX", HouseInfo[houseid][hEnterX]);
    dini_FloatSet(fstring, "EnterY", HouseInfo[houseid][hEnterY]);
    dini_FloatSet(fstring, "EnterZ", HouseInfo[houseid][hEnterZ]);
    dini_FloatSet(fstring, "ExitX", HouseInfo[houseid][hExitX]);
    dini_FloatSet(fstring, "ExitY", HouseInfo[houseid][hExitY]);
    dini_FloatSet(fstring, "ExitZ", HouseInfo[houseid][hExitZ]);
    dini_IntSet(fstring, "InsideInt", HouseInfo[houseid][hInsideInt]);
    dini_IntSet(fstring, "InsideVir", HouseInfo[houseid][hInsideVir]);
    dini_IntSet(fstring, "OutsideInt", HouseInfo[houseid][hOutsideInt]);
    dini_IntSet(fstring, "OutsideVir", HouseInfo[houseid][hOutsideVir]);
    dini_BoolSet(fstring, "Owned", HouseInfo[houseid][hOwned]);
    dini_Get(fstring, "Owner", HouseInfo[houseid][hOwner]);
    dini_IntSet(fstring, "Price", HouseInfo[houseid][hPrice]);
    dini_IntSet(fstring, "HV_Model", HouseInfo[houseid][hVecModel]);
    dini_FloatSet(fstring, "HV_PosX", HouseInfo[houseid][hVecX]);
    dini_FloatSet(fstring, "HV_PosZ", HouseInfo[houseid][hVecY]);
    dini_Float(fstring, "HV_PosZ", HouseInfo[houseid][hVecZ]);
    dini_Float(fstring, "HV_PosA", HouseInfo[houseid][hVecA]);
    return 1;
}
Enum:

pawn Код:
enum hInfo
{
    Float:hEnterX,
    Float:hEnterY,
    Float:hEnterZ,
    Float:hExitX,
    Float:hExitY,
    Float:hExitZ,
    hOutsideInt,
    hOutsideVir,
    hInsideInt,
    hInsideVir,
    InsideInt,
    InsideVir,
    OutsideInt,
    OutsideVir,
    bool:hOwned,
    hOwner[MAX_PLAYER_NAME],
    hPrice,
    hPickup,
    hVecModel,
    Float:hVecX,
    Float:hVecY,
    Float:hVecZ,
    Float:hVecA
};
new HouseInfo[MAX_HOUSES][hInfo];
Errors:

(1692) : warning 202: number of arguments does not match definition ( dini_Get(fstring, "Owner", HouseInfo[houseid][hOwner]); )
(1697) : warning 202: number of arguments does not match definition ( dini_Float(fstring, "HV_PosZ", HouseInfo[houseid][hVecZ]); )
(169 : warning 202: number of arguments does not match definition ( dini_Float(fstring, "HV_PosA", HouseInfo[houseid][hVecA]); )


Re: Housing system help..? - coole210 - 27.12.2011

First of all

Код:
format(fstring, 10, "Houses/%d", houseid);
%d is not a file, use "%d.ini"

and dini_Get, dini_Float and dini_Int use these parameters:

dini_Get(file,name);

So do it like this:

Код:
strmid(HouseInfo[houseid][hOwner],dini_Get(fstring,"Owner"),0,255,255);
HouseInfo[houseid][hVecZ] = dini_Float(fstring,"HV_PosZ");
HouseInfo[houseid][hVecA] = dini_Float(fstring,"HV_PosA");
rep me if it helped