SA-MP Forums Archive
NPCs ( Criminal NPCs ) leave as i join - 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)
+--- Thread: NPCs ( Criminal NPCs ) leave as i join (/showthread.php?tid=423668)



NPCs ( Criminal NPCs ) leave as i join - Adamb - 18.03.2013

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)


Re: NPCs ( Criminal NPCs ) leave as i join - Konstantinos - 18.03.2013

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


Re: NPCs ( Criminal NPCs ) leave as i join - FiReMaNStone - 18.03.2013

Adamb i will fix for you


Respuesta: NPCs ( Criminal NPCs ) leave as i join - Adamb - 18.03.2013

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];


Re: NPCs ( Criminal NPCs ) leave as i join - FiReMaNStone - 18.03.2013

are you in fb


Re: NPCs ( Criminal NPCs ) leave as i join - FiReMaNStone - 18.03.2013

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


Respuesta: NPCs ( Criminal NPCs ) leave as i join - Adamb - 18.03.2013

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


Re: NPCs ( Criminal NPCs ) leave as i join - FiReMaNStone - 18.03.2013

i have a gamemode
of NPC


Respuesta: NPCs ( Criminal NPCs ) leave as i join - Adamb - 18.03.2013

pm me please