Put NPC in vehicle ?
#1

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
PHP код:
new trainveh
OnGameModeInit
PHP код:
    ConnectNPC("train""train");
    
trainveh AddStaticVehicleEx(5380.00.00.00.0001); 
OnPlayerSpawn
PHP код:
    if(IsPlayerNPC(playerid))
      {
        new 
npcname[24];
        
GetPlayerName(playeridnpcname24);
        if(!
strcmp(npcname"train"true))
        {
            
SetPlayerSkin(playerid255);
               
PutPlayerInVehicle(playeridtrainveh0);
          }
        return 
1;
      } 
NPC is connect and I can see it but he don't spawn in the vehicle. What I can do?
Reply
#2

up^^
Reply
#3

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.
Reply
#4

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;'
Reply
#5

Staticvehicles ain't being id 0? Maybe cause of that putplayerinvehie bugged?
Reply
#6

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)