29.08.2012, 11:36
ok i created a house system with checkpoints and when i create the houses its saved.. but it doesnt load when the server starts while it says the filterscript loaded
this is the reading system the tut used
this is the reading system the tut used
pawn Код:
stock LoadHouses()//Creating the stock function
{
new file[60],houseowner[24];//creating the "file" var. And also creating the "houseowner" var so we can store it, when we are reading the house owner ini line.
for(new i = 0; i < MAX_HOUSES;i++)//Looping threw every house
{
format(file,sizeof(file),"FHouse/Houses/%i.ini",i);//Opening the house file with the current selected number with "i".
if(INI_Exist(file)) break;//Checking if the ini house file exist, if not to stop there.
INI_Open(file);//Opening the house ini
HInfo[i][Price] = INI_ReadInt("Price");//Reading the price.
HInfo[i][Owned] = INI_ReadInt("Owned");//Reading if it's owned.
HInfo[i][XPos] = INI_ReadInt("XPos");//Reading the X float position.
HInfo[i][YPos] = INI_ReadInt("YPos");//Reading the Y float position.
HInfo[i][ZPos] = INI_ReadInt("ZPos");//Reading the Z float position.
HInfo[i][VirtualWorld] = INI_ReadInt("VirtualWorld");//Reading the virtual world.
INI_ReadString(houseowner,"Owner");//Reading the house owner.
format(HInfo[i][Owner],24,"%s",houseowner);//Formating the "Owner" house id value to the red one.
HouseEnter[i] = CreateDynamicCP(HInfo[i][XPos],HInfo[i][YPos],HInfo[i][ZPos],1.5,HInfo[i][VirtualWorld]);//Creating the checkpoint and storing it in the HouseEnter value.
HouseExit[i] = CreateDynamicCP(443.9237,509.4609,1001.4195,1.5,HInfo[i][VirtualWorld]);//Creating the house exit checkpoint and storing it in the HouseExit value.
new labelstring[100];//Creating the labelstring var.
switch(HInfo[i][Owned])//Using the "switch" method to check if the house is owned
{
case 0:{format(labelstring,sizeof(labelstring),"{FFFF00}Owned: {FFFFFF}No \n{FFFF00}Price: {FFFFFF}%i",HInfo[i][Price]);}//If it isnt...
case 1:{format(labelstring,sizeof(labelstring),"{FFFF00}Owned: {FFFFFF}Yes \n{FFFF00}Price: {FFFFFF}%i \n{FFFF00}Owner: {FFFFFF}%s",HInfo[i][Price],HInfo[i][Owner]);}//If it is...
}
HInfo[i][HouseLabel] = Create3DTextLabel(labelstring,0xFF0000FF,HInfo[i][XPos],HInfo[i][YPos],HInfo[i][ZPos],25.0,HInfo[i][VirtualWorld]);//Creating the label with the formatted string.
HouseCount++;//+ counting the HouseCount var.
INI_Close();//Closing the SII file.
}
return 1;
}