SA-MP Forums Archive
PutPlayerInVehicle and NPCs? - 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: PutPlayerInVehicle and NPCs? (/showthread.php?tid=355116)



PutPlayerInVehicle and NPCs? - RichardGatinho - 29.06.2012

Hi, I'm trying to make a NPC, but I'm having an issue - specifically, PutPlayerInVehicle does nothing.

- On spawn, nothing happens
- Using a command I made to force the NPC into the vehicle, the NPC appears in the middle of the vehicle and shortly disappears
- There are no traces that the NPC actually entered the vehicle, server, client and NPC side
- Works fine for players

What could it be?


Re: PutPlayerInVehicle and NPCs? - iggy1 - 29.06.2012

You should go through all your loaded scripts and check if player is an NPC, if so return 1 at the top of each function/callback that may remove a player/NPC from the server.

EDIT:

pawn Код:
public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid))return 1;
   
    //rest of code eg, check if registered, kick if no spawn ect ect
   
    return 1;
}



Re: PutPlayerInVehicle and NPCs? - RichardGatinho - 29.06.2012

My OnPlayerConnect is pretty much empty, just "return 1;".


Re: PutPlayerInVehicle and NPCs? - iggy1 - 29.06.2012

Not just OnPlayerConnect, any function/callback that may inadvertently kick an NPC.

You should check all of your loaded scripts - gamemodes and filterscripts.

You haven't really given enough information, does the NPC disconnect?


Re: PutPlayerInVehicle and NPCs? - RichardGatinho - 29.06.2012

It disconnects without a trace after a random number of seconds.


Re: PutPlayerInVehicle and NPCs? - [MM]RoXoR[FS] - 29.06.2012

Show us the code .


Re: PutPlayerInVehicle and NPCs? - Mauzen - 02.07.2012

You connect the NPC with an invalid recording file or npc script I guess.


Re: PutPlayerInVehicle and NPCs? - Roko_foko - 02.07.2012

Read this tutorial:https://sampforum.blast.hk/showthread.php?tid=95034 It's about putting NPC in the vehicle.