16.06.2012, 02:21
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.
I've tried pretty much everything.. Here's some of the things I have tried. There must be something I'm missing?
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;
}