INI files help
#1

Hello, This command (below) is to create actors (Added in 0.3.7), Can someone make this command below to save the Actor I create using y_ini? And OnGameModeInit, It loads all the created actors, And I want a command to destroy an actor.
The command:
Код:
CMD:createactor(playerid, params[])
{
	new Float:X, Float:Y, Float:Z, Float:fa, skin, string[128], world = GetPlayerVirtualWorld(playerid), Actor;
	if(AdminLevel[playerid] < 5) return SCM(playerid, COLOR_WHITE, ""WORD_NADMIN"");
	if(IsPlayerInAnyVehicle(playerid)) return SCM(playerid, COLOR_WHITE, ""WORD_ERROR"You cannot create actors while inside a vehicle.");
	if(sscanf(params, "i", skin)) return SCM(playerid, COLOR_WHITE, ""WORD_USAGE"/createactor [SKIN_ID]");
	if(skin < 0) return SCM(playerid, COLOR_WHITE, ""WORD_ERROR"Invalid skin ID.");
	if(skin > 311) return SCM(playerid, COLOR_WHITE, ""WORD_ERROR"Invalid skin ID.");
	GetPlayerPos(playerid, X, Y, Z);
	GetPlayerFacingAngle(playerid, fa);
	Actor = CreateActor(skin, X, Y, Z, fa);
	SetActorVirtualWorld(Actor, world);
	ClearActorAnimations(Actor);
	format(string, sizeof(string), ""WORD_SERVER"You have created a new actor with skin: %d", skin);
	SCM(playerid, COLOR_WHITE, string);
	return 1;
}
Thanks for reading,
+REP for the person who helps!
Reply
#2

Please someone at least someone give me good link for a tutorial helps how to create Y_INI system with ID's, I mean /createactor gets the last ID and makes bigger than it..
Reply
#3

I wouldn't use y_ini for this, I would just write in to the file one line for one actor.

Format would be: actorid, x, y, z, angle

Then you can just read it with fread and parse it with sscanf.

Also, why are you using ClearActorAnimations right after creating an actor? That's pointless.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)