Put NPC in vehicle ? - 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: Put NPC in vehicle ? (
/showthread.php?tid=593514)
Put NPC in vehicle ? -
Guss - 06.11.2015
Hi guys, I trying to put a NPC in a train. Don't can create a train with CreateVehicle, I need AddStaticVehicleEx. Then...
global variable
OnGameModeInit
PHP код:
ConnectNPC("train", "train");
trainveh = AddStaticVehicleEx(538, 0.0, 0.0, 0.0, 0.0, 0, 0, 1);
OnPlayerSpawn
PHP код:
if(IsPlayerNPC(playerid))
{
new npcname[24];
GetPlayerName(playerid, npcname, 24);
if(!strcmp(npcname, "train", true))
{
SetPlayerSkin(playerid, 255);
PutPlayerInVehicle(playerid, trainveh, 0);
}
return 1;
}
NPC is connect and I can see it but he don't spawn in the vehicle. What I can do?
Respuesta: Put NPC in vehicle ? -
Guss - 06.11.2015
up^^
Re: Put NPC in vehicle ? -
DeathCore - 07.11.2015
Try like this:
Код:
if(IsPlayerNPC(playerid))
{
new npcname[24];
GetPlayerName(playerid, npcname, 24);
if(!strcmp(npcname, "train", true))
{
SetPlayerSkin(playerid, 255);
PutPlayerInVehicle(playerid, trainveh, 0);
return 1;
}
}
if still not spawning then the record file is probably missing.
Re: Put NPC in vehicle ? -
J0sh... - 07.11.2015
Quote:
Originally Posted by DeathCore
Try like this:
Код:
if(IsPlayerNPC(playerid))
{
new npcname[24];
GetPlayerName(playerid, npcname, 24);
if(!strcmp(npcname, "train", true))
{
SetPlayerSkin(playerid, 255);
PutPlayerInVehicle(playerid, trainveh, 0);
return 1;
}
}
if still not spawning then the record file is probably missing.
|
All I see what you did was move 'return 1;'
Re: Put NPC in vehicle ? -
jlalt - 07.11.2015
Staticvehicles ain't being id 0? Maybe cause of that putplayerinvehie bugged?
Respuesta: Put NPC in vehicle ? -
Guss - 07.11.2015
the record file missing... how to record a train? I trying:
AddStaticVehicle(538,1466.7051,2634.2603,10.5424,2 69.5424,1,1);
After I go to the position of train and start record... is correct? Or how?