Making this load OnGamemodeinit
#1

Alright, basically I have this code, In-Game I can create furniture and it saves in the .ini file but the issue is loading it.
This is the Loading thing, how do I make it exactly to load? I have no clue I been messing around with it for over 3hours on trying to create stocks etc..
But the issue I am having is how do I implement it so when the server starts it loads the furniture objects, if anyone could create the code for me I would really appreciate it.. It would help me analyse the script and understand on how its working.

Код:
forward LoadFurn(id);
public LoadFurn(id)
{
	new arrCoords[8][64], strFromFile2[255], string[255];
	format(string, sizeof(string), "housedata/%d.ini", id);
	if(!DOF2_FileExists(string)) return true;
	new File: file = fopen(string, io_read);
	if (file)
	{
		new idx;
		while (idx < MAX_HOUSE_OBJ)
		{
			fread(file, strFromFile2);
			split(strFromFile2, arrCoords, ',');
			if(strval(arrCoords[0]) >= 1)
			{
				HouseInfo[id][hoID][idx] = strval(arrCoords[0]);
				HouseInfo[id][hoX][idx] = floatstr(arrCoords[1]);
		    	HouseInfo[id][hoY][idx] = floatstr(arrCoords[2]);
				HouseInfo[id][hoZ][idx] = floatstr(arrCoords[3]);
		    	HouseInfo[id][horX][idx] = floatstr(arrCoords[4]);
		    	HouseInfo[id][horY][idx] = floatstr(arrCoords[5]);
				HouseInfo[id][horZ][idx] = floatstr(arrCoords[6]);
		    	HouseInfo[id][hoInt][idx] = strval(arrCoords[7]);
		    	//==========//
		    	HouseInfo[id][hObject][idx] = CreateDynamicObject(HouseInfo[id][hoID][idx], HouseInfo[id][hoX][idx], HouseInfo[id][hoY][idx], HouseInfo[id][hoZ][idx], HouseInfo[id][horX][idx], HouseInfo[id][horY][idx], HouseInfo[id][horZ][idx], id);
		    }
			idx++;
		}
	}
	fclose(file);
	return 1;
}
Reply


Messages In This Thread
Making this load OnGamemodeinit - by Goosie - 11.02.2015, 02:41
Re: Making this load OnGamemodeinit - by Eth - 11.02.2015, 03:59
Re: Making this load OnGamemodeinit - by Goosie - 11.02.2015, 05:17

Forum Jump:


Users browsing this thread: 1 Guest(s)