INI files help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: INI files help (
/showthread.php?tid=573237)
INI files help -
aCloudy - 05.05.2015
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!
Re: INI files help -
aCloudy - 06.05.2015
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..
Re: INI files help -
MP2 - 06.05.2015
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.