NPCs ( Criminal NPCs ) leave as i join
#1

Hello, i've tried a few things to get these NPCs working. I tried adding this: if(IsPlayerNPC(playerid)) return 1; it didn't work. Heres the script;

//NPC created by JustinB
//Do NOT remove the line Above this one

#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

new Super; //Global variable!
public OnFilterScriptInit()
{
print("Viper Filterscript");
ConnectNPC("Thief","HS");
Super = CreateVehicle(411, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

#endif

public OnGameModeInit()
{
return 1;
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) //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, "Thief", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, Super, 0); //Putting the NPC into the vehicle we created for it.
}
return 1;
}
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}


What happens;
[22:10:26] Starter / Blank gamemode by L3th4l loaded!
[22:10:26] Number of vehicle models: 2
[22:10:26] Incoming connection: 127.0.0.1:51340
[22:10:26] Incoming connection: 127.0.0.1:51341
[22:10:26] [npc:join] Kriminal has joined the server (0:127.0.0.1)
[22:10:26] [npc:join] Thief has joined the server (1:127.0.0.1)
[22:10:41] [npcart] Kriminal has left the server (0:0)
[22:10:41] [npcart] Thief has left the server (1:0)
Reply
#2

Where did you use this line?
pawn Код:
if(IsPlayerNPC(playerid)) return 1;
It should be in OnPlayerRequestClass or OnPlayerConnect.
Reply
#3

Adamb i will fix for you
Reply
#4

Used here;
//================================================== ============================
public OnPlayerRequestClass(playerid, classid)
{
if(IsPlayerNPC(playerid)) return 1;
{

SetPlayerPos(playerid, -2661.3604, 1932.9404, 225.757;
etc. etc.
and here;
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid)) return 1;
{

AddMapIconFromFile(ICON_FILE_NAME);

new CString[50];
Reply
#5

are you in fb
Reply
#6

if(IsPlayerNPC(playerid)) return 1;[/QUOTE]
copy and paste it in the down of the Public onplayerConnect
Reply
#7

Anyone else? Please help me!! Or if you can give me a gamemode that allows NPCs that will do too!
Reply
#8

i have a gamemode
of NPC
Reply
#9

pm me please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)