SA-MP Forums Archive
[Tutorial] Creating a new NPC - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Creating a new NPC (/showthread.php?tid=95034)

Pages: 1 2 3 4 5 6 7 8


Re: Creating a new NPC - samuel_hamza - 14.07.2010

Well, I did what did you say exactly, but nothing really happen, I just get a message in server log which is
Code:
[14:45:49] Incoming connection: 127.0.0.1:63231
[14:46:30] Incoming connection: 127.0.0.1:63232



Re: Creating a new NPC - w84m3 - 07.01.2011

When I do "/stoprecord" after "/ofrecord blah" my recordings folder is still empty... there is no such a file like blah.rec... What should I do?


Re: Creating a new NPC - Scenario - 07.01.2011

Quote:
Originally Posted by w84m3
View Post
When I do "/stoprecord" after "/ofrecord blah" my recordings folder is still empty... there is no such a file like blah.rec... What should I do?
Are you on Windows 7?


Re: Creating a new NPC - Infamous - 07.01.2011

It saves into your script files folder not your recording folder.


Re: Creating a new NPC - Dainyzxz - 07.01.2011

Quote:
Originally Posted by w84m3
View Post
When I do "/stoprecord" after "/ofrecord blah" my recordings folder is still empty... there is no such a file like blah.rec... What should I do?
your record have saved in scriptfiles folder, not npc_records


Re: Creating a new NPC - n00bSklly - 14.03.2011

C:\Documents and Settings\arvuti24\Desktop\samp03csvr_win32\pawno\m ini.pwn(13) : error 021: symbol already defined: "OnRecordingPlaybackEnd"
C:\Documents and Settings\arvuti24\Desktop\samp03csvr_win32\pawno\m ini.pwn(16) : error 021: symbol already defined: "OnNPCSpawn"


---WHAT SHOULD I DO---


Respuesta: Creating a new NPC - Host-samp - 01.04.2011

Nice


Re: Creating a new NPC - OBSERVADOR - 03.04.2011

Quote:

C:\Users\HELLBOY\Desktop\Server\npcmodes\Optimuss_ Prime.pwn(14) : warning 235: public function lacks forward declaration (symbol "OnFilterScriptInit")
C:\Users\HELLBOY\Desktop\Server\npcmodes\Optimuss_ Prime.pwn(17) : error 017: undefined symbol "ConnectNPC"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

I got some problem With this.
Well this is first time I'am Scripting I don't know what to do.

I did this
Quote:

#define RECORDING "Ballas"
#define RECORDING_TYPE 2

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCExitVehicle() StopRecordingPlayback();
#else
public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
public OnGameModeInit()
{
print("my gamemode");
ConnectNPC("MyFirstNPC","Ballas");
return 1;
}

If i did anything wrong Please let me know

Replay me Fast Please
Thanks
___________
OBSERVADOR
___________
No replys?


Respuesta: Creating a new NPC - Lunnatiicz - 03.04.2011

How do for what a npc use a vehicle RC?

How create the vehicle?

CreateObject?
CreateVehicle?


Re: Creating a new NPC - aceisnice - 12.04.2011

******* vid?


Respuesta: Creating a new NPC - Alex_Obando - 18.04.2011

I make all of this steps of the vehicle thing, but...when I load it it says that the npc joined and all that stuff, but the npc is NOT There.!

It doesnt appear.


Re: Creating a new NPC - Luis- - 07.05.2011

How can I make it so when a player enters the NPC's car a Dialog shows asking him where he would like to go, then when the players clicks on a location the NPC starts to drive there?


Re: Creating a new NPC - Miguel - 11.05.2011

Quote:
Originally Posted by -Luis
Посмотреть сообщение
How can I make it so when a player enters the NPC's car a Dialog shows asking him where he would like to go, then when the players clicks on a location the NPC starts to drive there?
That's really hard making with the current NPC functions.


Re: Creating a new NPC - jonnyboy - 11.05.2011

I got errors from compiling "everything is right"

Код:
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(15) : warning 235: public function lacks forward declaration (symbol "OnRecordingPlaybackEnd")
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(15) : error 017: undefined symbol "StartRecordingPlayback"
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(18) : warning 235: public function lacks forward declaration (symbol "OnNPCEnterVehicle")
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(18) : error 017: undefined symbol "StartRecordingPlayback"
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(19) : warning 235: public function lacks forward declaration (symbol "OnNPCExitVehicle")
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(19) : error 017: undefined symbol "StopRecordingPlayback"
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(522) : error 017: undefined symbol "AnotherVehicleID"
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(527) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
pawn Код:
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING); // line 15

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING); // line 18
  public OnNPCExitVehicle() StopRecordingPlayback(); // line 19
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
pawn Код:
if(IsPlayerNPC(playerid)) return 1; //Checks if the player that just spawned is an NPC.
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
    if(!strcmp(npcname, "Bot01", true)) //Checking if the NPC's name is MyFirstNPC
    {
      PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
      return 1;
    }
    if(!strcmp(npcname, "Bot02", true))
    {
      PutPlayerInVehicle(playerid, AnotherVehicleID, 0); // 522
      return 1;
    }
    return 1;
  }
    GameTextForPlayer(playerid, "~b~/cmds * ~r~/rules * ~g~/jobs", 5000, 1); // line 527
help??


Re: Creating a new NPC - sansko - 11.05.2011

use include "a-npc" or something


Re: Creating a new NPC - jonnyboy - 12.05.2011

same problem >_<

i wish someone could help me lol


Re: Creating a new NPC - mu057677 - 12.05.2011

I have my script:

pawn Код:
new MyFirstNPCVehicle; //Global variable!
public OnFilterScriptInit()
{
    print("\n-----------------------------------------");
    print("      Bus Driver NPC Script by Tuвn Anh");
    print("------------------------------------------\n");
    //SetGameModeText("NPC Mode");
    ConnectNPC("BusWilliams","williams");
    MyFirstNPCVehicle = CreateVehicle(437, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerSpawn(playerid)
{    
    if(IsPlayerNPC(playerid))
    {
        new string[128];
        new playername[MAX_PLAYER_NAME];
        SetPlayerSkin(playerid,165);
        GetPlayerName(playerid,playername,64);
        SetPlayerColor(playerid,0xFF8000FF);
        format(string, sizeof(string),"Hi all, I am %s(%d) Bus Driver. My ID car: %d", playername, playerid, MyFirstNPCVehicle);
        SendPlayerMessageToAll(playerid, string);
        Delete3DTextLabel(DutyLabel[playerid]);
        DutyLabel[playerid] = Create3DTextLabel("Bus Driver\nWilliams",0xFF000099,0,0,2,50,-1,1);
        Attach3DTextLabelToPlayer(DutyLabel[playerid], playerid, 0,0,0);
        if(!strcmp(playername, "BusWilliams", true)) {
            SetSpawnInfo(playerid, 0, 165, 1529.6,-1691.2,13.3);
            PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 1);
            //return 1;
        }
        return 1;
    }
    //Other stuff for normal players goes here!
    return 1;
}
And NPCModes:

pawn Код:
#define RECORDING "williamsbusdriver" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot.

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
All most as are normal but command: PutPlayerInVehicle not work? Why?


Re: Creating a new NPC - mu057677 - 12.05.2011

@jonnyboy:
I see:
Код:
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(15) : warning 235: public function lacks forward declaration (symbol "OnRecordingPlaybackEnd")
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(15) : error 017: undefined symbol "StartRecordingPlayback"
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(18) : warning 235: public function lacks forward declaration (symbol "OnNPCEnterVehicle")
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(18) : error 017: undefined symbol "StartRecordingPlayback"
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(19) : warning 235: public function lacks forward declaration (symbol "OnNPCExitVehicle")
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(19) : error 017: undefined symbol "StopRecordingPlayback"
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(522) : error 017: undefined symbol "AnotherVehicleID"
D:\Rockstar Games\SAMP SERVER\gamemodes\gm.pwn(527) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
But

pawn Код:
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING); // line 15

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING); // line 18
  public OnNPCExitVehicle() StopRecordingPlayback(); // line 19
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif

=> This error from file gm.pwn and it in folder gamemodes, but from file source I can know true position is npcmodes, and line 522, 527 with error 017: undefined symbol "AnotherVehicleID" => It must not the same time at a file.

Ex: My npcmode with name is "williams.amx":

pawn Код:
#define RECORDING "williamsbusdriver" //This is the filename of your recording without the extension, this file is npcmodes/recording/williamsbusriver.rec.
#define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot.

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
And In my script I was call it:

pawn Код:
public OnFilterScriptInit()
{
    print("\n-----------------------------------------");
    print("      Bus Driver NPC Script by Tuвn Anh");
    print("------------------------------------------\n");
    //SetGameModeText("NPC Mode");
    ConnectNPC("BusWilliams","williams"); //set NPC name is BusWilliams, with npcmode williams.amx
    MyFirstNPCVehicle = CreateVehicle(437, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
    return 1;
}
I have called "#include <a_npc>" in my script !


Sorry for my bad english !


Re: Creating a new NPC - jonnyboy - 12.05.2011

so i need to make a filterscript to use them?


Re: Creating a new NPC - mu057677 - 13.05.2011

@jonnyboy: Depending on whether you want to use script or game mode!
I use script to add to my server!
You should try read topic #1 again!

Someone can fix my problem [Link]?