SA-MP Forums Archive
[problem]PutPlayerInVehicle - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [problem]PutPlayerInVehicle (/showthread.php?tid=112311)



[problem]PutPlayerInVehicle - Angelus~ - 06.12.2009

When i use the function PutPlayerInVehicle for a NPC, the NPC doesn't go in and then disconnects from the server a couple seconds later whats going on? (My other NPC's that aren't vehicle NPC's don't disconnect either way)

Код:
#include <a_samp>

new vehicle;

public OnFilterScriptInit()
{
	ConnectNPC("1st","1st");
 	vehicle =	AddStaticVehicle(492,1071.8664,-1854.9331,13.1725, -90, 0, 0); // bus1
	return 1;
}

public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid))
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "1st", true))
    {
      PutPlayerInVehicle(playerid, vehicle, 0);
    }
    return 1;
  }
  return 1;
}
ive noticed that if i remove PutPlayerInVehicle from the filterscript, the NPC doesn't disconnect


Re: [problem]PutPlayerInVehicle - patchkinson - 06.12.2009

thats at least weird but try removing all the space between vehicle=Add...
btw you #define filterscript??
and add new vehicle; under IfDefinedFilterscript..., right under it


Re: [problem]PutPlayerInVehicle - radhakr - 06.12.2009

AddStaticVehicle doesn't return a value, use CreateVehicle instead.


Re: [problem]PutPlayerInVehicle - patchkinson - 06.12.2009

Quote:
Originally Posted by radhakr
AddStaticVehicle doesn't return a value, use CreateVehicle instead.
Oh yea, do that, radhakr's right


Re: [problem]PutPlayerInVehicle - Angelus~ - 06.12.2009

Quote:
Originally Posted by patchkinson
Quote:
Originally Posted by radhakr
AddStaticVehicle doesn't return a value, use CreateVehicle instead.
Oh yea, do that, radhakr's right
Oh thanks, but it doesn't work, the NPC still disconnects after 5 seconds ...


Re: [problem]PutPlayerInVehicle - DJDhan - 07.12.2009

Dude look at my script in Creating a npc