Need help on making cmd createhouse -
Somalez - 17.11.2014
A'ight, I started to write stock for createhouse CMD, but It just doesn't work.
Код:
stock CreateCase()
{
new nomefile[256];
new r;
for(r=0;r<sizeof(House);r++){
new ownername[MAX_PLAYER_NAME];
ownername="NoBodY";
format(nomefile,sizeof(nomefile),"Casa%d.txt",House[r][HouseID]);
if (!dini_Exists(nomefile))
{
dini_Create(nomefile);
dini_IntSet(nomefile,"id",House[r][HouseID]);
dini_Set(nomefile,"owner",ownername);
dini_IntSet(nomefile,"rentable",1);
dini_IntSet(nomefile,"rentprice",150);
dini_IntSet(nomefile,"level",1);
dini_IntSet(nomefile,"closed",0);
dini_IntSet(nomefile,"fullprice",minrand(90000, 1800000));
dini_IntSet(nomefile,"buyable",1);
dini_IntSet(nomefile,"housecash",1000);
dini_IntSet(nomefile,"till", 0);
dini_IntSet(nomefile,"sguns", 0);
dini_IntSet(nomefile,"sdrugs", 0);
dini_IntSet(nomefile,"interiorpack",0);
dini_FloatSet(nomefile, "x", House[r][House_x]);
dini_FloatSet(nomefile, "y", House[r][House_y]);
dini_FloatSet(nomefile, "z", House[r][House_z]);
printf("%s created\n",nomefile);
}
if(dini_Exists(nomefile) && !dini_Isset(nomefile,"interiorpack")) dini_IntSet(nomefile,"interiorpack",0);
if(dini_Exists(nomefile) && !dini_Isset(nomefile,"till")) dini_IntSet(nomefile,"till",0);
if(dini_Exists(nomefile) && !dini_Isset(nomefile,"sguns")) dini_IntSet(nomefile,"sguns",0);
if(dini_Exists(nomefile) && !dini_Isset(nomefile,"sdrugs")) dini_IntSet(nomefile,"sdrugs",0);
if(dini_Exists(nomefile) && !dini_Isset(nomefile,"x")) dini_FloatSet(nomefile, "x", House[r][House_x]);
if(dini_Exists(nomefile) && !dini_Isset(nomefile,"y")) dini_FloatSet(nomefile, "y", House[r][House_y]);
if(dini_Exists(nomefile) && !dini_Isset(nomefile,"z")) dini_FloatSet(nomefile, "z", House[r][House_z]);
if(dini_Exists(nomefile))
{
if(!dini_Isset(nomefile, "garageX")) dini_FloatSet(nomefile, "garageX", 0.0);
if(!dini_Isset(nomefile, "garageY")) dini_FloatSet(nomefile, "garageY", 0.0);
if(!dini_Isset(nomefile, "garageZ")) dini_FloatSet(nomefile, "garageZ", 0.0);
if(!dini_Isset(nomefile, "garage")) dini_IntSet(nomefile, "garage", 0);
myStrcpy(House[r][tmpowner], dini_Get(nomefile, "owner"));
House[r][House_x] = dini_Float(nomefile, "x");
House[r][House_y] = dini_Float(nomefile, "y");
House[r][House_z] = dini_Float(nomefile, "z");
House[r][Garage] = dini_Int(nomefile, "garage");
House[r][Garage_x] = dini_Float(nomefile, "garageX");
House[r][Garage_y] = dini_Float(nomefile, "garageY");
House[r][Garage_z] = dini_Float(nomefile, "garageZ");
}
}
Код:
if(dialogid == 56)
{
if(!response) return SendClientMessage(playerid, COLOR_RED, "Cancelled.");
{
new Float:pos[3],hid=GetUnusedHouse();
GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
CreateNewCase(hid,pos[0],pos[1],pos[2]);
format(iStr,sizeof(iStr)," You successfully created the house [ID: %s]",hid);
SendClientMessage(playerid, COLOR_GREEN, iStr);
return 1;
}
}
Код:
stock GetUnusedHouse()
{
new hf[64];
for(new nh; nh < sizeof(House); nh++)
{
format(hf,sizeof(hf),"Casa%d.txt",nh);
if(dini_Exists(hf)) continue;
return nh;
}
return -1;
}
stock CreateNewCase(h,Float:x,Float:y,Float:z)
{
new hf[ 64 ], nomefile[ 256 ];
format(hf,sizeof(hf),"Houses/Casa%d.txt",h);
new ownername[MAX_PLAYER_NAME];
ownername="NoBodY";
if(!dini_Exists(hf))
{
dini_Create(nomefile);
dini_IntSet(hf,"id",h);//dini_IntSet(nomefile,"id",House[r][HouseID]);
dini_Set(nomefile,"owner",ownername);
dini_IntSet(nomefile,"rentable",1);
dini_IntSet(nomefile,"rentprice",150);
dini_IntSet(nomefile,"level",1);
dini_IntSet(nomefile,"closed",0);
dini_IntSet(nomefile,"fullprice",minrand(90000, 1800000));
dini_IntSet(nomefile,"buyable",1);
dini_IntSet(nomefile,"housecash",1000);
dini_IntSet(nomefile,"till", 0);
dini_IntSet(nomefile,"sguns", 0);
dini_IntSet(nomefile,"sdrugs", 0);
dini_IntSet(nomefile,"interiorpack",0);
House[h][House_x]=x;
House[h][House_y]=y;
House[h][House_z]=z;
/*dini_FloatSet(nomefile, "x", House[r][House_x]);
dini_FloatSet(nomefile, "y", House[r][House_y]);
dini_FloatSet(nomefile, "z", House[r][House_z]);*/
printf("%s created\n",nomefile);
return 1;
}
return 1;
}
Re: Need help on making cmd createhouse -
Somalez - 17.11.2014
I'm still open for suggestions
Re: Need help on making cmd createhouse -
Somalez - 18.11.2014
Really? There's noone to help me?