NPC Attach trailer to vehicle? -
WillyP - 16.06.2012
Hey, I have a NPC truck driver, and no matter what I do, the trailer won't attach? I've tried allsorts.. Searched for previous topics, and the answers haven't given me the outcome I was hoping for.
pawn Code:
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new NPC[MAX_PLAYER_NAME];
GetPlayerName(playerid,NPC,sizeof(NPC));
if(!strcmp(NPC,"TruckDriver",true))
{
PutPlayerInVehicle(playerid,Tanker,0);
AttachTrailerToVehicle(Trailer,GetPlayerVehicleID(playerid));
}
return 1;
}
//other code
return 1;
}
pawn Code:
new Tanker;
new Trailer;
Tanker = AddStaticVehicle(514,-1138.3733,-2271.3184,36.0016,340.9931,25,1);
Trailer = AddStaticVehicle(584,-1138.3733,-2271.3184,40.0016,340.9931,25,1);
pawn Code:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(IsPlayerNPC(playerid))
{
new NPC[MAX_PLAYER_NAME];
GetPlayerName(playerid,NPC,sizeof(NPC));
if(!strcmp(NPC,"TruckDriver",true))
{
if(newstate==PLAYER_STATE_DRIVER) AttachTrailerToVehicle(Trailer,Tanker);
}
}
return 1;
}
I've tried pretty much everything.. Here's some of the things I have tried. There must be something I'm missing?
Re: NPC Attach trailer to vehicle? -
Jonny5 - 16.06.2012
where is he spawned?
both truck and trailer needs to be streamed in
make sure you spawn him near the truck before you attach.
Re: NPC Attach trailer to vehicle? -
WillyP - 16.06.2012
I have.. And yeah I have tried that too
Re: NPC Attach trailer to vehicle? -
Jonny5 - 16.06.2012
thing is on my server if i save the truck and trailer pos when they are attached
and make that their spawn pos, when i enter one they are already attached.
Not sure if this is something with the NPC or not.
try attaching before you place the npc inside.
good luck.
Re: NPC Attach trailer to vehicle? -
WillyP - 16.06.2012
Quote:
Originally Posted by Jonny5
thing is on my server if i save the truck and trailer pos when they are attached
and make that their spawn pos, when i enter one they are already attached.
Not sure if this is something with the NPC or not.
good luck.
|
Ahhh, I shall try that. Thanks
EDIT: Still isn't working.. :/