#include <a_samp>
#include <a_actor>
#include <dini>
#define MAX_ACTOR 50
enum Actorenum
{
aID,
Float:aX,
Float:aY,
Float:aZ,
Float:aRot,
aSkin,
aActor,
aIDLefoglalva
}
new ActorInfo[MAX_ACTOR][Actorenum];
stock ActorBetoltes()
{
new filenev[64];
for( new i=0; i < MAX_ACTOR; i++ )
{
format(filenev,sizeof(filenev),\"NPC_K/%d.ini\",i);
if(dini_Exists(filenev) )
{
ActorInfo[aID] = i;
ActorInfo[aX] = dini_Float(filenev, \"X\" );
ActorInfo[aY] = dini_Float(filenev, \"Y\" );
ActorInfo[aZ] = dini_Float(filenev, \"Z\" );
ActorInfo[aRot] = dini_Int(filenev,\"Rot\");
ActorInfo[aSkin] = dini_Int(filenev,\"Skin\");
ActorInfo[aActor] = CreateActor(ActorInfo[aSkin], ActorInfo[aX], ActorInfo[aY], ActorInfo[aZ], ActorInfo[aRot]);
ActorInfo[aIDLefoglalva] = 1;
}
}
printf(\"Actorok betöltve!\");
}
stock ActorTorles(playerid,ID)
{
if(ActorInfo[iD][aIDLefoglalva] == 0)
{
SendClientMessage(playerid,-1,\"Nincs ilyen actor!\");
return 1;
}
new filenev[64];
format(filenev,sizeof(filenev),\"NPC_K/%d.ini\",ID);
dini_Remove(filenev);
ActorInfo[iD][aID] = -1;
ActorInfo[iD][aX] = 0;
ActorInfo[iD][aY] = 0;
ActorInfo[iD][aZ] = 0;
ActorInfo[iD][aRot] = 0;
ActorInfo[iD][aSkin] = 0;
DestroyActor(ActorInfo[iD][aActor]);
ActorInfo[iD][aIDLefoglalva] = 0;
SendClientMessage(playerid,-1,\"Sikeresen törölted az Actort!\");
return 1;
}
stock ActorLetrehozas(playerid,Skin)
{
new id = -1;
for(new i=0;i<MAX_ACTOR;i++)
{
if(ActorInfo[aIDLefoglalva] == 0)
{
id = i;
break;
}
}
if(id == -1)
{
SendClientMessage(playerid,-1,\"Nem tudsz többet lerakni!\");
return 1;
}
new Float:X,Float:Y,Float:Z,Float:R,filenev[64];
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,R);
format(filenev,sizeof(filenev),\"NPC_K/%d.ini\",id);
if(!dini_Exists(filenev))
{
dini_Create(filenev);
dini_FloatSet(filenev, \"X\", X);
dini_FloatSet(filenev, \"Y\", Y);
dini_FloatSet(filenev, \"Z\", Z);
dini_FloatSet(filenev, \"Rot\", R);
dini_IntSet(filenev, \"Skin\", Skin);
ActorInfo[id][aID] = id;
ActorInfo[id][aX] = X;
ActorInfo[id][aY] = Y;
ActorInfo[id][aZ] = Z;
ActorInfo[id][aRot] = R;
ActorInfo[id][aSkin] = Skin;
ActorInfo[id][aActor] = CreateActor(ActorInfo[id][aSkin], ActorInfo[id][aX], ActorInfo[id][aY], ActorInfo[id][aZ], ActorInfo[id][aRot]);
ActorInfo[id][aIDLefoglalva] = 1;
SendClientMessage(playerid,-1,\"Actort Sikeresen létrehoztad!\");
SetPlayerPos(playerid,X,Y+2,Z);
}
return 1;
}
public OnFilterScriptInit()
{
ActorBetoltes();
return 1;
}
public OnFilterScriptExit(){return 1;}
Tessék.
Annyi feladatod van hogy írni két parancsot
1 ikkel törlöd
a másikkal lerakod
ActorLetrehozas(playerid,SKINID);
ActorTorles(playerid,ACTORID);
ezt a két függvényt kell használd csak ezzel kapcsolatban szerintem
MŰKÖDIK!!!!
Csak csinálj egy NPC_K nevű mappát a scriptfilesbe.