Loading Problem
#6

Wait, /createactor doesn't make files on the "Actors" folder anymore..

Code:
CMD:createactor(playerid, params[])
{
	new skin;
	if(AdminLevel[playerid] < 5) SCM(playerid, COLOR_WHITE, ""WORD_NADMIN"");
	else if(IsPlayerInAnyVehicle(playerid)) SCM(playerid, COLOR_WHITE, ""WORD_ERROR"You cannot create actors while inside a vehicle.");
	else if(sscanf(params, "i", skin)) SCM(playerid, COLOR_WHITE, ""WORD_USAGE"/createactor [SKIN_ID]");
	else if(!(0 <= skin < 312) || skin == 74) SCM(playerid, COLOR_WHITE, ""WORD_ERROR"Invalid skin ID.");
	else{
		new Float:X, Float:Y, Float:Z, Float:fa, world = GetPlayerVirtualWorld(playerid), Actor;
		GetPlayerPos(playerid, X, Y, Z);
		GetPlayerFacingAngle(playerid, fa);
		Actor = CreateActor(skin, X, Y, Z, fa);
		if(AddActor(Actor, skin, X, Y, Z, fa, world))
		{
			SetActorVirtualWorld(Actor, world);
			ClearActorAnimations(Actor);
			SetActorInvulnerable(Actor, true);
			new string[128];
			format(string, sizeof(string), ""WORD_SERVER"You have created a new actor with skin: %d", skin);
			SCM(playerid, COLOR_WHITE, string);
		}
	}
	return 1;

AddActor(actorid, skinid, Float:X, Float:Y, Float:Z, Float:A, VirtualWorld)
{
	if(actorid == INVALID_ACTOR_ID) return 0;

	new INI:File = INI_Open(ActorPath(actorid));
	if(File != INI_NO_FILE)
	{
		INI_SetTag(File,"data");
		INI_WriteInt(File,"Skin",skinid);
		INI_WriteFloat(File,"PosX",X);
		INI_WriteFloat(File,"PosY",Y);
		INI_WriteFloat(File,"PosZ",Z);
		INI_WriteFloat(File,"Angle",A);
		INI_WriteInt(File,"VirtualWorld",VirtualWorld);
		INI_Close(File);
		return 1;
	}
	return 0;
}

ActorPath(actorid)
{
	new string[32];
	format(string,sizeof(string),ACTOR_DATA,actorid);
	return string;
}
}
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: 1 Guest(s)