Kreiranje Actora sa Animacijama i Labelima

Započeo Hulk.png, Avgust 22, 2018, 23:49:47 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Dobar dan jos jednom svima  :P :P :P 8)
Evo jos jedan Tutorial od mene: Kreiranje Actora InGame sa animacijama i labelima

Pa da krenemo prvo sta moramo da definisemo su include

[pawn]#include <a_samp>
#include <a_actor>
Sad include za komande onaj koji vi najvise volite ja koristim Pawn.CMD[/pawn]

Drugi korak je definisanje enuma za cuvanje aktora, file u koji ce se spremati i dialoge...

[pawn]#define MAX_ACTOR                   50 // Max actora koliko mozete kreirati ingame
#define ACTOR_FILE                  "Aktori/Actor_%d.ini" // Folder u koji ce se spremati Actori

enum ActorsData
{
   ActorIme[30],
   ActorSkinID,
   ActorAnimID,
   Float:APos_X,
   Float:APos_Y,
   Float:APos_Z,
   Float:APos_Rot,
   ActorID
};
new ActorInfo[MAX_ACTOR][ActorsData];
new Text3D:Actor3DText[MAX_ACTOR]; // Define koji ce nam trebati za Label Actora

#define D_NAPRAVIACTORA  1 // Vi ovaj broj stavite koji vama nije definisan dialog
#define D_ACTORANIM         2
#define D_ACTORIMELABEL  3[/pawn]

Ovo dodajte pod OnGameModeInit to ce vam sluziti za ucitavanje Actora, Labela i Animacija

[pawn]for(new id = 0; id < MAX_ACTOR; id++)
   {
        new actorFile[50];
        format(actorFile, sizeof(actorFile), ACTOR_FILE, id);
        if(fexist(actorFile))
      {
            INI_ParseFile(actorFile, "UcitajActore", .bExtra = true, .extra = id);
              ActorInfo[id][ActorID] = CreateActor(ActorInfo[id][ActorSkinID], ActorInfo[id][APos_X], ActorInfo[id][APos_Y], ActorInfo[id][APos_Z], ActorInfo[id][APos_Rot]);
              if(ActorInfo[id][ActorAnimID] == 0) { ClearActorAnimations(ActorInfo[id][ActorID]);} // Animacija koja ne radi nista odnosno nema je
              else if(ActorInfo[id][ActorAnimID] == 1) { ApplyActorAnimation(ActorInfo[id][ActorID], "COP_AMBIENT", "Coplook_loop", 4.0, 0, 1, 1, 1, -1); } // Ostale animacije koje ce actori izvoditi kada ih kreirate
              else if(ActorInfo[id][ActorAnimID] == 2) { ApplyActorAnimation(ActorInfo[id][ActorID], "RAPPING", "RAP_A_Loop", 4.0, 1, 0, 0, 0, 0); } // Vi ih mozete dodati jos
              else if(ActorInfo[id][ActorAnimID] == 3) { ApplyActorAnimation(ActorInfo[id][ActorID], "PED", "IDLE_CHAT", 4.1, 1, 0, 0, 0, 0); }
              SetActorInvulnerable(id, true);
         Actors3DText();
      }
   }[/pawn]

Sljedece pravimo dialoge kojima ce mo kreirati Actora, izvinite nisam mogao sve objasniti zato ga ni nisam napravio prije, a trazili ste ZURI8....  :P


[pawn]if(dialogid == D_NAPRAVIACTORA)
   {
      if(!response) return 1;
      if(response)
      {
          if(strval(inputtext) < 0 && strval(inputtext) > 311) return SPD(playerid, D_NAPRAVIACTORA, DSI, "Kreiraj Actora", "Upisite ID skina za Actor-a:", "Napravi", "Zatvori");
         for(new id = 0; id < MAX_ACTOR; id++)
         {
             new actorfilee[50];
            format(actorfilee, sizeof(actorfilee), ACTOR_FILE, id);
            if(!fexist(actorfilee))
            {
                new Float:x, Float:y, Float:z, Float:rot;
               ActorInfo[id][ActorSkinID] = strval(inputtext);
               GetPlayerPos(playerid, x, y, z);
               GetPlayerFacingAngle(playerid, rot);
                  ActorInfo[id][APos_X] = x; ActorInfo[id][APos_Y] = y; ActorInfo[id][APos_Z] = z; ActorInfo[id][APos_Rot] = rot;
               SPD(playerid, D_ACTORANIM, DSI, "Kreiraj Actora", "Upisite ID animacije za Actor-a:\n\nNazivi animacija:\n0. Bez animacije\n1. Stav\n2. Rep\n3. Chat", "Napravi", "Zatvori");
               break;
            }
         }
      }
   }
   if(dialogid == D_ACTORANIM)
   {
       if(!response) return 1;
       if(response)
       {
         if(strval(inputtext) < 0 || strval(inputtext) > 3) return SPD(playerid, D_ACTORANIM, DSI, "Kreiraj Actora", "Upisite ID animacije za Actor-a:\n\nNazivi animacija:\n0. Bez animacije\n1. Stav\n2. Rep\n3. Chat", "Napravi", "Zatvori");
           for(new id = 0; id < MAX_ACTOR; id++)
         {
             new actorfille[50];
            format(actorfille, sizeof(actorfille), ACTOR_FILE, id);
            if(!fexist(actorfille))
            {
                  ActorInfo[id][ActorAnimID] = strval(inputtext);
                if(ActorInfo[id][ActorAnimID] == 0) { ClearActorAnimations(ActorInfo[id][ActorID]); }
                    else if(ActorInfo[id][ActorAnimID] == 1) { ApplyActorAnimation(ActorInfo[id][ActorID], "COP_AMBIENT", "Coplook_loop", 4.0, 0, 1, 1, 1, -1); }
                    else if(ActorInfo[id][ActorAnimID] == 2) { ApplyActorAnimation(ActorInfo[id][ActorID], "RAPPING", "RAP_A_Loop", 4.0, 1, 0, 0, 0, 0); }
                    else if(ActorInfo[id][ActorAnimID] == 3) { ApplyActorAnimation(ActorInfo[id][ActorID], "PED", "IDLE_CHAT", 4.1, 1, 0, 0, 0, 0); }
                    SPD(playerid, D_ACTORIMELABEL, DSI, "Kreiraj Actora", "Upisite naziv Actora koji ce se pojaviti na Labelu", "Napravi", "Zatvori");
                 break;
            }
         }
       }
   }
   if(dialogid == D_ACTORIMELABEL)
   {
       if(!response) return 1;
       if(response)
       {
           new actorimelabel[30];
         if(sscanf(inputtext, "s[30]", actorimelabel)) return SPD(playerid, D_ACTORIMELABEL, DSI, "Kreiraj Actora", "Upisite naziv Actora koji ce se pojaviti na Labelu", "Napravi", "Zatvori");
           for(new id = 0; id < MAX_ACTOR; id++)
         {
             new actorfiile[50];
            format(actorfiile, sizeof(actorfiile), ACTOR_FILE, id);
            if(!fexist(actorfiile))
            {
                  strmid(ActorInfo[id][ActorIme], actorimelabel, 0, strlen(actorimelabel), 50);
                  SendClientMessage(playerid, -1, "ZavrÅ¡ili ste kreiranje Actor-a.");
               ActorInfo[id][ActorID] = CreateActor(ActorInfo[id][ActorSkinID], ActorInfo[id][APos_X], ActorInfo[id][APos_Y], ActorInfo[id][APos_Z], ActorInfo[id][APos_Rot]);
                    SacuvajActore(id);
                 SetActorInvulnerable(id, true);
                 Actors3DText();
                 break;
            }
         }
       }
   }[/pawn]

S ovom funkciom ce mo azurirati nas label i animacije....

[pawn]forward Actors3DText();
public Actors3DText()
{
   for(new id = 0; id < MAX_ACTOR; id++)
   {
      new actorfile[50];
      format(actorfile, sizeof(actorfile), ACTOR_FILE, id);
      if(fexist(actorfile))
      {
          if(ActorInfo[id][ActorAnimID] == 0) { ClearActorAnimations(ActorInfo[id][ActorID]); }
              else if(ActorInfo[id][ActorAnimID] == 1) { ApplyActorAnimation(ActorInfo[id][ActorID], "COP_AMBIENT", "Coplook_loop", 4.0, 0, 1, 1, 1, -1); }
              else if(ActorInfo[id][ActorAnimID] == 2) { ApplyActorAnimation(ActorInfo[id][ActorID], "RAPPING", "RAP_A_Loop", 4.0, 1, 0, 0, 0, 0); }
              else if(ActorInfo[id][ActorAnimID] == 3) { ApplyActorAnimation(ActorInfo[id][ActorID], "PED", "IDLE_CHAT", 4.1, 1, 0, 0, 0, 0); }
         new string[40];
            format(string, sizeof(string), "[ Actor - (%d) ]\n[ %s ]", id, ActorInfo[id][ActorIme]);
         Actor3DText[id] = Create3DTextLabel(string, -1, ActorInfo[id][APos_X], ActorInfo[id][APos_Y], ActorInfo[id][APos_Z]+1, 10, 0, 1);
      }
   }
   return 1;
}[/pawn]

Spremanje i Ucitavanje Actora

[pawn]forward UcitajActore(actorid, name[], value[]);
public UcitajActore(actorid, name[], value[])
{
    INI_String("ActorIme", ActorInfo[actorid][ActorIme], 30);
   INI_Int("ActorSkinID", ActorInfo[actorid][ActorSkinID]);
   INI_Int("ActorAnimID", ActorInfo[actorid][ActorAnimID]);
   INI_Float("APos_X", ActorInfo[actorid][APos_X]);
   INI_Float("APos_Y", ActorInfo[actorid][APos_Y]);
   INI_Float("APos_Z", ActorInfo[actorid][APos_Z]);
   INI_Float("APos_Rot", ActorInfo[actorid][APos_Rot]);
   INI_Int("ActorID", ActorInfo[actorid][ActorID]);
   return 1;
}

forward SacuvajActore(actorid);
public SacuvajActore(actorid)
{
    new dFile[50];
   format(dFile, sizeof(dFile), ACTOR_FILE, actorid);
   new INI:File = INI_Open(dFile);
   INI_WriteString(File, "ActorIme", ActorInfo[actorid][ActorIme]);
   INI_WriteInt(File, "ActorSkinID", ActorInfo[actorid][ActorSkinID]);
   INI_WriteInt(File, "ActorAnimID", ActorInfo[actorid][ActorAnimID]);
   INI_WriteFloat(File, "APos_X", ActorInfo[actorid][APos_X]);
   INI_WriteFloat(File, "APos_Y", ActorInfo[actorid][APos_Y]);
   INI_WriteFloat(File, "APos_Z", ActorInfo[actorid][APos_Z]);
   INI_WriteFloat(File, "APos_Rot", ActorInfo[actorid][APos_Rot]);
   INI_WriteInt(File, "ActorID", ActorInfo[actorid][ActorID]);
   INI_Close(File);
   return 1;
}[/pawn]

I komanda s kojom zapocinjemo kreiranje Actora

[pawn]CMD:kreirajactora(playerid, params[])
{
    SPD(playerid, D_NAPRAVIACTORA, DSI, "Kreiraj Actora", "Upisite ID skina za Actor-a:", "Napravi", "Zatvori");
    return 1;
}[/pawn]

Ljudi izvinite sto nisam sve objasnio, eto nadam se da ce vam pomoci...
Ne zamjerite na greskama..

Profesija: Scripter
Expension Community USKORO

Ovako ima na Ultimate Project modu moze se izvaditi, fino fino samo si trebo to detaljnije i bolje objasniti za početnike :)
2k18 - Underworld Developer
2k22 - RedRose Developer / Mapper

na ultimate ne rade animacije kako treba i nema labela nisam htio ni objavljivat al trazili su pa nisam objasnio sve zato

Profesija: Scripter
Expension Community USKORO

Ja sam testirao i rade anmijacije, na njemu pise Diler Marko i rob sam te i te organizacije :)
2k18 - Underworld Developer
2k22 - RedRose Developer / Mapper

Pa to nije to ti si dilere testiro

Profesija: Scripter
Expension Community USKORO

Citat: Hulkic 皇帝 poslato Avgust 23, 2018, 00:20:52 PRE PODNE
Pa to nije to ti si dilere testiro
Isti je princip ja mislim kao i sa dilerima, samo sto na njiam ne pise ja sam marko diler tog i tog :D
2k18 - Underworld Developer
2k22 - RedRose Developer / Mapper

ja sam testo  animacije nisu radile na actorima ja sam drugacije onda napravio

Profesija: Scripter
Expension Community USKORO

lepo
Vandals Project OGC
[size=11.25pt]Vandals Project OGC[/size][/font]
[/color]

Hvala

Profesija: Scripter
Expension Community USKORO

Kolko tesko uraditi  :D :D
Pohvale hulkicuu samo cekam komentare sa 100 errora
[pawn]
= Ex Owner & Developer у Acuzio Gaming Online Community
= Ex Developer у Perfect Gaming Community
= Ex Developer у Smart Project Community
= Ex Developer у Athlone Community[/pawn]

Kad sam vadio iz svog moda zaboraviosam sve stavit da ne bude skraceno ebiga sad

Profesija: Scripter
Expension Community USKORO


hvala mogo sam i bolje al zuri8

Profesija: Scripter
Expension Community USKORO


635 : for(new id = 0; id < MAX_ACTOR; id++)
   {
        new actorFile[50];
638: format(actorFile, sizeof(actorFile), ACTOR_FILE, id);
639: if(fexist(actorFile))
      {
641:            INI_ParseFile(actorFile, "UcitajActore", .bExtra = true, .extra = id);
              ActorInfo[id][ActorID] = CreateActor(ActorInfo[id][ActorSkinID], ActorInfo[id][APos_X], ActorInfo[id][APos_Y], ActorInfo[id][APos_Z], ActorInfo[id][APos_Rot]);
643:              if(ActorInfo[id][ActorAnimID] == 0) { ClearActorAnimations(ActorInfo[id][ActorID]);}
              else if(ActorInfo[id][ActorAnimID] == 1) { ApplyActorAnimation(ActorInfo[id][ActorID], "COP_AMBIENT", "Coplook_loop", 4.0, 0, 1, 1, 1, -1); } // Ostale animacije koje ce actori izvoditi kada ih kreirate
              else if(ActorInfo[id][ActorAnimID] == 2) { ApplyActorAnimation(ActorInfo[id][ActorID], "RAPPING", "RAP_A_Loop", 4.0, 1, 0, 0, 0, 0); } // Vi ih mozete dodati jos
              else if(ActorInfo[id][ActorAnimID] == 3) { ApplyActorAnimation(ActorInfo[id][ActorID], "PED", "IDLE_CHAT", 4.1, 1, 0, 0, 0, 0); }
              SetActorInvulnerable(id, true);
         Actors3DText();
      }
   }
Tu je error pise mi kad save ovaj error
C:\Users\Amci\Desktop\Castro by Amci\gamemodes\Castro.pwn(635) : error 010: invalid function or declaration
C:\Users\Amci\Desktop\Castro by Amci\gamemodes\Castro.pwn(638) : error 021: symbol already defined: "format"
C:\Users\Amci\Desktop\Castro by Amci\gamemodes\Castro.pwn(639) : error 010: invalid function or declaration
C:\Users\Amci\Desktop\Castro by Amci\gamemodes\Castro.pwn(641) : error 021: symbol already defined: "INI_ParseFile"
C:\Users\Amci\Desktop\Castro by Amci\gamemodes\Castro.pwn(641) : error 017: undefined symbol "bExtra"
C:\Users\Amci\Desktop\Castro by Amci\gamemodes\Castro.pwn(641) : error 010: invalid function or declaration
C:\Users\Amci\Desktop\Castro by Amci\gamemodes\Castro.pwn(641 -- 643) : fatal error 107: too many error messages on one line

www.Game-State.com" style="border-style: none;