pawn Код:
stock CreateNewHouse(h,Float:x,Float:y,Float:z)
{
new hf[64];
format(hf,sizeof(hf),"Houses/Casa%d.txt",h);
if(!dini_Exists(hf))
{
dini_Create(hf);
dini_IntSet(hf,"id",h);
dini_Set(hf,"owner","Nobody");
dini_IntSet(hf,"rentable",0);
dini_Set(hf,"dupekey","Nobody");
dini_IntSet(hf,"rentprice",0);
dini_IntSet(hf,"level",1);
dini_IntSet(hf,"closed",0);
dini_IntSet(hf,"fullprice",0);
dini_IntSet(hf,"maxrents",20);
dini_IntSet(hf,"freeslots",20);
dini_IntSet(hf,"buyable",0);
dini_IntSet(hf,"housecash",1000);
dini_IntSet(hf,"interiorpack",0);
dini_IntSet(hf,"robbed",0);
dini_FloatSet(hf,"X",x);
dini_FloatSet(hf,"Y",y);
dini_FloatSet(hf,"Z",z);
new virt=h+1;
dini_IntSet(hf,"Hvirtual",virt);
House[h][HouseID]=h;
House[h][House_x]=x;
House[h][House_y]=y;
House[h][House_z]=z;
House[h][_Hvirtual]=virt;
House3D[h] = Create3DTextLabel("[{FFFFFF}Owner: Nobody{008000}]", COLOR_GREEN, House[h][House_x],House[h][House_y],House[h][House_z]+0.4, 8, 0, 0);
return 1;//FFFFFF 008000
}
return 0;
}
I would also like to see a response to this cause i want to learn how to use y_ini too. Then bookmark this page and use it to convert my reglog fs into y_ini.
Код:
stock CreateNewHouse(h,Float:x,Float:y,Float:z)
{
new hf[64];
format(hf,sizeof(hf),"Houses/Casa%d.txt",h);
if (fexist(hf)) {//if the file exists open it
new INI:file = INI_Open(hf);
// [...]
// your code here, use INI_WriteInt, INI_WriteString, INI_WriteFloat, INI_WriteHex, INI_WriteBool and etc.
// u write everything? ok, close it.
INI_Close (file);
}
// etc. etc. etc.
If you read the wiki page you can use this check too (to see if the file has been open correctly)