#1

Hello i recently noticed that id 0 in samp gets glitched and i wanted to make a invisable npc that i only connect and it blocks players from logging as id 0 so my problem is that the NPC isnt connecting

here is my code:
pawn Код:
#include "a_npc"
pawn Код:
#define RECORDING "mynpc"
pawn Код:
ConnectNPC("PG BOT","mynpc");
thats the codes that i am using cause i dont want a actual npc in the gamemode i just want one that will connect any idea?
Reply
#2

Any help guys?
Reply
#3

guys i need help i barely found tutorials on npc's and i dont know why the npc isnt connecting
Reply
#4

do you got your nps files in the /npcmodes/ directory?
Reply
#5

Yes i have
Reply
#6

Help please
Reply
#7

Guys can you help me ?
Reply
#8

Hello, so what you got to do so that the NPC doesn't spawn and acts like an invalid player is the following (you can also use a player variable if you don't want to use gvar):

Download gvar: https://sampforum.blast.hk/showthread.php?tid=151076

Your Server > gamemodes > yourgamemode.pwn:
pawn Код:
#include <gvar>

public OnGameModeInIt()
{
    ConnectNPC("DarkyBot","mynpc");
    // The rest of your code on this native...
}

public OnPlayerRequestClass(playerid, classid)
{
    // If you want the npc to spawn put: "if(IsPlayerNPC(playerid)) return 1;"
    if(GetPVarInt(playerid, "NoNPCSpawn") == 0)
    {
        return 0;
    }
    // The rest of your code on this native...
    return 1;
}

public OnPlayerConnect(playerid)
{
    SetPVarInt(playerid, "NoNPCSpawn", 0);
    // The rest of your code on this native...
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_LOGIN:
        {
            if (!response) return Kick (playerid);
            if( response )
            {
                if(Login Success)
                {
                    SetPVarInt(playerid, "NoNPCSpawn", 1);
                    // Login code...
                }
                else // Login failed
                {
                    // Register code...
                }
                return 1;
            }
        }
    }
    // The rest of your code on this native...
    return 1;
}
Your Server > npcmodes > mynpc.pwn:
pawn Код:
#define RECORDING "mynpcrecord"
#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 == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
Your Server > npcmodes > recordings:
Place/rename a file named/to "mynpcrecord.rec". This file won't be used.

NOTE: This also fixes the bug when the player is forced to the class selection on login fail and gets kicked on some gamemodes.
Hope it helps!
Reply
#9

Wow thanks mate it worked i am really thankful for your help +1
Reply
#10

You can't have spaces in bot names by the way.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)