Loading Problem
#4

Alright be patient i will post the codes after 10minute's or less

EDIT

Create directory in your scriptfiles "Actors"

Code:
#define ACTOR_DATA         "Actors/%d.ini"
#define MAX_ACTORSS       (100)
Code:
enum aInfo
{
	aSkin,
	Float:aPosX,
	Float:aPosY,
	Float:aPosZ,
	Float:aPosA,
	aVW
}
new ActorInfo[MAX_ACTORSS][aInfo];

forward LoadActors();
public LoadActors()
{
	new Actor[64];
	for(new idx = 0; idx < sizeof(ActorInfo); idx++)
	{
		format(Actor, 64, ACTOR_DATA, idx);
		INI_ParseFile(Actor, "LoadActor_data", .bExtra = true, .extra = idx );
		if(ActorInfo[idx][aPosX] > 0.0)
		{
			CreateActorInformation(idx);
		}
	}
	print("*Actors loaded correctly.");
	return 1;
}

forward SaveActors(idx);
public SaveAcors(idx)
{
	new Actorfile[64];
	format(Actorfile, 64, ACTOR_DATA, idx);
	new INI:File = INI_Open(Actorfile);
	INI_SetTag(File,"Actor_Information");
	INI_WriteInt(File,"Skin", ActorInfo[idx][aSkin]);
	INI_WriteFloat(File,"PosX", ActorInfo[idx][aPosX]);
	INI_WriteFloat(File,"PosY", ActorInfo[idx][aPosY]);
	INI_WriteFloat(File,"PosZ", ActorInfo[idx][aPosZ]);
	INI_WriteFloat(File,"Angel", ActorInfo[idx][aPosA]);
	INI_WriteInt(File,"VirtualWorld", ActorInfo[idx][aVW]);
	INI_Close(File);
	return 1;
}

forward LoadActor_data(idx, name[], value[]);
public LoadActor_data(idx, name[], value[])
{
	INI_Int("Skin", ActorInfo[idx][aSkin]);
	INI_Float("PosX", ActorInfo[idx][aPosX]);
	INI_Float("PosY", ActorInfo[idx][aPosY]);
	INI_Float("PosZ", ActorInfo[idx][aPosZ]);
	INI_Float("Angel", ActorInfo[idx][aPosA]);
	INI_Int("VirtualWorld", ActorInfo[idx][aVW]);
	return 1;
}

forward CreateActorInformation(idx);
public CreateActorInformation(idx)
{
	CreateActor(ActorInfo[idx][aSkin], ActorInfo[idx][aPosX], ActorInfo[idx][aPosY], ActorInfo[idx][aPosZ], ActorInfo[idx][aPosA]);
	SetActorVirtualWorld(idx, ActorInfo[idx][aVW]);
	return 1;
}
Reply


Messages In This Thread
Loading Problem - by aCloudy - 07.05.2015, 07:13
Re: Loading Problem - by Antoniohl - 07.05.2015, 07:25
Re: Loading Problem - by aCloudy - 07.05.2015, 07:39
Re: Loading Problem - by Antoniohl - 07.05.2015, 07:44
Re: Loading Problem - by aCloudy - 07.05.2015, 08:12
Re: Loading Problem - by aCloudy - 07.05.2015, 08:20
Re: Loading Problem - by Antoniohl - 07.05.2015, 08:20
Re: Loading Problem - by aCloudy - 07.05.2015, 08:24
Re: Loading Problem - by Antoniohl - 07.05.2015, 08:29
Re: Loading Problem - by aCloudy - 07.05.2015, 09:27

Forum Jump:


Users browsing this thread: 2 Guest(s)