Jump to content
  • 0

pomoc NPC aneb jak mám dát každýmu NPC vozidlo


ActiV3Drifter

Dotaz

Dobrý večer :) mám menší problém s NPC.....chci dát 3 a více npc do jednoho FS ale tak aby každý měl svoje vozidlo jak to mám udělat? :d

NPC BUS1 se normálně v autobusu spawne a jede ale ostatní tam jakoby sou ale nic nedělají neboly sou na ty farmě tak jak je mám hodit také do tech jejich vybraních aut?

 

takle to momentálně mám:

 

#include <a_samp>
new AutoBota; //Global variable!
public OnGameModeInit()
{
ConnectNPC("BUS1","BUS1");
AutoBota = CreateVehicle(431, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
 
ConnectNPC("BUS2","BUS2");
AutoBota = CreateVehicle(431, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
 
ConnectNPC("speed1","speed1");
AutoBota = CreateVehicle(541, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
 
 
return 1;
}
 
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); 
if(!strcmp(npcname, "BUS1", true))
{
PutPlayerInVehicle(playerid, AutoBota, 0); 
 
}
}
return 1;
}
 
Takže otázka zní jak mám dát NPC do vozidel nebo jak to mám rozdělit aby se tam neukazovaly chyby? :) děkuji moc za odpovědi :)  
Link to comment
Share on other sites

7 odpovědí na tuto otázku

Recommended Posts

  • 0


ConnectNPC("BUS1","BUS1");
AutoBota1 = CreateVehicle(431, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);

ConnectNPC("BUS2","BUS2");
AutoBota2 = CreateVehicle(431, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);

ConnectNPC("speed1","speed1");
AutoBota3 = CreateVehicle(541, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);

 

Link to comment
Share on other sites

  • 0

Problém stále přetrvává  udělal jsem to tak jak si řekl takže to vypadá takle:

 

#include <a_samp>
new AutoBota1; //Global variable!
new AutoBota2; //Global variable!
new AutoBota3; //Global variable!
public OnGameModeInit()
{
ConnectNPC("BUS1","BUS1");
AutoBota1 = CreateVehicle(431, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
 
ConnectNPC("BUS2","BUS2");
AutoBota2 = CreateVehicle(431, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
 
ConnectNPC("speed1","speed1");
AutoBota3 = CreateVehicle(541, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
 
 
return 1;
}
 
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); 
if(!strcmp(npcname, "BUS1", true))
if(!strcmp(npcname, "BUS2", true))
if(!strcmp(npcname, "speed1", true))
{
PutPlayerInVehicle(playerid, AutoBota1, 0);
PutPlayerInVehicle(playerid, AutoBota2, 0);
PutPlayerInVehicle(playerid, AutoBota3, 0);
 
}
}
return 1;
}
 
ale napadá mě nemé se jeste neco změnit v OnPlayerSpawn? pokud ano napis co prosím te :)
Link to comment
Share on other sites

  • 0

public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if(!strcmp(npcname, "BUS1", true)) PutPlayerInVehicle(playerid, AutoBota1, 0);
else if(!strcmp(npcname, "BUS2", true)) PutPlayerInVehicle(playerid, AutoBota2, 0);
else if(!strcmp(npcname, "speed1", true)) PutPlayerInVehicle(playerid, AutoBota3, 0);
}
return 1;
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...