NPC won't connect
#1

I'm trying to make it so that an NPC connects to my server and do it's thing. The problem is that it won't connect.

pawn Код:
//NPC Script

#define RECORDING "Trader-Slab" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 2 //1 for in vehicle and 2 for on foot.

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

#if RECORDING_TYPE == 2
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
pawn Код:
//The Filterscript that spawns the NPC

// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" NPC Script");
    print("--------------------------------------\n");
    ConnectNPC("TraderSlab","trader-slab");
    print("NPC 1 Loaded");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new npc_name[24];
        GetPlayerName(playerid, npc_name, sizeof(npc_name));
        if(!strcmp(npc_name,"TraderSlab",false))
        {
            SetPlayerSkin(playerid, 34);
        }
        return 1;
    }
    return 1;
}
Код:
//The server.cfg

echo Executing Server Config...
lanmode 0
rcon_password 
maxplayers 10
port 7777
hostname Test Server
gamemode0 fallout 1
filterscripts NPCFS
announce 0
query 1
weburl NULL
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 10
logtimeformat [%H:%M:%S]
plugins sscanf Whirlpool streamer
Anyone got any idea why it won't connect?
Reply
#2

https://sampwiki.blast.hk/wiki/NPC:ConnectNPC


for more info check this

https://sampforum.blast.hk/showthread.php?tid=102878
Reply
#3

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
I've read them and still can't seem to get it to work. Everything is in the right place, everything should work in the script, but it doesn't. I don't understand what's wrong with it.
Reply
#4

pawn Код:
#define RECORDING "Trader-Slab"

ConnectNPC("TraderSlab","trader-slab");
Notice how one is 'Trader-Slab' and the other is 'trader-slab'? This is used for the name of your recording/npc script file, so case sensitivity DOES matter.
Reply
#5

Quote:
Originally Posted by Threshold
Посмотреть сообщение
pawn Код:
#define RECORDING "Trader-Slab"

ConnectNPC("TraderSlab","trader-slab");
Notice how one is 'Trader-Slab' and the other is 'trader-slab'? This is used for the name of your recording/npc script file, so case sensitivity DOES matter.
The recording itself was named "Trader-Slab" while the .pwn script was called "trader-slab", so it shouldn't matter.
Reply
#6

Can anyone help me out here? I can't get this to work no matter what I do.
Reply
#7

And you have definitely uploaded both the NPC script AND the recording in the 'npcmodes' folder?
Reply
#8

Quote:
Originally Posted by Threshold
Посмотреть сообщение
And you have definitely uploaded both the NPC script AND the recording in the 'npcmodes' folder?
The NPC script is in the npcmodes folder and the .rec file is in the npcmodes/recordings folder.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)