VehicleId AddStaticVehicle NPC
#1

Hello,

In my GM i have CreateVehicle. I load 10 cars with a file ( for save position-color...)
So the vehicleID: First vehicle: Police id: 1 Police1 id: 2 Police2 id: 3 Taxi id: 4 Taxi1 id: 5 Sultan id: 6 Sultan id: 7 Sultan id: 8 Sultan id: 9 Sultan id: 10.

Now i want to add a NPC who drive a train. I need AddStaticVehicle. If i add AddStaticVehicle in the OnGameModeInit, vehicleID of the train is 1 and first vehicle Police id2 ....

My Question is simple. How in OnGameModeInit to choose a Vehicle d for AddStaticVehicle.

Example:

Vehicleid(11) = AddStaticVehicle(444,-302.5649,1777.7349,42.2514,238.5039,6,25); .

Thank.
Reply
#2

if your using Addstaticvehicle in your gamemode the first vehicle is classed as id 1 then id 2 then id 3 etc etc but if you want a NPC to drive a train i recommend just creating the vehicle onplayerspawn with npc and then just put them in the vehicle IE

Код:
public OnPlayerSpawn(playerid) 
{
 // For NPC Spawns
  if(IsPlayerNPC(playerid))
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "Traindriver1", true))// LS Train
    {
      new LSTrain = AddStaticVehicle(538,0,0,0,270.1690,1,1);
      PutPlayerInVehicle(playerid, LSTrain, 0);
      SetPlayerColor(playerid,COLOR_GREEN);
      SetPlayerSkin(playerid,16); // Orange Jacket Guy
      new Text3D:textlabel1,string[256];
      format(string, sizeof(string), "Train Driver (%d)",playerid);
      textlabel1 = Create3DTextLabel(string,COLOR_GREEN,0,0,0,25.0,0,1);
      Attach3DTextLabelToPlayer(textlabel1,playerid,0,0,0);
    }
  }

}
obviously this isn't the code you should use as i just ripped it straight from my GM as an example to you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)