[Ajuda] [NPC] veнculos
#1

й o seguinte quando tento por 2 npcs cada um dentro dum veiculo apenas um funciona normal e outro fica la parado sem veiculo

com esse mesmo cod eu ja spwanei 5 npc sem veiculos e funcionaram perfeitamente mais com o veiculos so consigo fazer 1 npc se tenta por 2 ja da esse problema de ele ficar la parado em pй sem veiculos

ja tentei por um npc em cada FS e o mesmo problema e ja tentei por todos tabem no game mod e tabem da o mesmo problema


Alguem Poderia me ajudar ?

Код HTML:
new k3;
public OnGameModeInit()
{
	ConnectNPC("npc_k3", "k3"); // nome do  npc  a ser carregado em veiculo
    k3 = AddStaticVehicle(411, 0.0, 0.0, 0.0, 0.0, 0, 0);//veiculo do npc onibus
	return 1;
}

public OnGameModeExit()
{
	return 1;
}


public OnPlayerConnect(playerid)
{
	if(IsPlayerNPC(playerid))PutPlayerInVehicle(playerid, k3, 0);
	return 1;
}
Reply
#2

Crie um veiculo (e variavel) pra cada veiculo dos NPC
Exemplo: 2 NPC = 2 Veiculos = 2 Variaveis
.-.
Reply
#3

Eu fiz isso mais apenas o id 0 que й o primeiro npc a ser spwanando funciona o outro fica la paradao.
Reply
#4

Checa qual NPC logou pelos nomes e coloque ele no respectivo veiculo .-.
Reply
#5

tб assim olha
Quote:

new pk1;
new pk2;

public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid))PutPlayerInVehicle(player id, pk1, 0);
if(IsPlayerNPC(playerid))PutPlayerInVehicle(player id, pk2,0);

return 1;
}

public OnGameModeInit()
{
ConnectNPC("npc_bmx", "pk1");
ConnectNPC("npc_bmx2", "pk2");
AddPlayerClass(265,1958.3783,1343.1572,15.3746,270 .1425,0,0,0,0,-1,-1);

pk1 = AddStaticVehicle(481, 0.0, 0.0, 0.0, 0.0, 0, 0);
pk2 = AddStaticVehicle(481, 0.0, 0.0, 0.0, 0.0, 0, 0);
return 1;
}

Reply
#6

Quote:
Originally Posted by Wakayama
Посмотреть сообщение
tб assim olha
Vocк estб colocando os dois NPC como motoristas...

pawn Код:
if(IsPlayerNPC(playerid))PutPlayerInVehicle(player id, pk1, 0);
if(IsPlayerNPC(playerid))PutPlayerInVehicle(player id, pk2, 1);
https://sampwiki.blast.hk/wiki/PutPlayerInVehicle
Reply
#7

Quote:
Originally Posted by AlucardSnow
Посмотреть сообщение
Vocк estб colocando os dois NPC como motoristas...

pawn Код:
if(IsPlayerNPC(playerid))PutPlayerInVehicle(player id, pk1, 0);
if(IsPlayerNPC(playerid))PutPlayerInVehicle(player id, pk2, 1);
https://sampwiki.blast.hk/wiki/PutPlayerInVehicle
й mas й cada um nun veiculo.... os 2 tem que estar como motorista mesmo
Reply
#8

Da uma lida (ta em ingles, deve ter o mesmo em portugues): https://sampforum.blast.hk/showthread.php?tid=95034
Olhe especialmente essa parte:

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
        if(!strcmp(npcname, "MyFirstNPC", true)) //Checking if the NPC's name is MyFirstNPC
        {
            PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
        }
        return 1;
    }
  return 1;
}
No seu caso, ficaria parecido com isso:
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname));
       
        if(!strcmp(npcname, "npc_bmx", true)) PutPlayerInVehicle(playerid, pk1, 0);
        if(!strcmp(npcname, "npc_bmx2", true)) PutPlayerInVehicle(playerid, pk2, 0);
       
        return 1;
    }
  return 1;
}
Reply
#9

Quote:
Originally Posted by Wakayama
Посмотреть сообщение
й mas й cada um nun veiculo.... os 2 tem que estar como motorista mesmo
Li errado, desculpa ae, nгo mecho com NPC, boa sorte na ajuda
Reply
#10

Quote:
Originally Posted by Kmatsu
Посмотреть сообщение
Da uma lida (ta em ingles, deve ter o mesmo em portugues): https://sampforum.blast.hk/showthread.php?tid=95034
Olhe especialmente essa parte:

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
        if(!strcmp(npcname, "MyFirstNPC", true)) //Checking if the NPC's name is MyFirstNPC
        {
            PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
        }
        return 1;
    }
  return 1;
}
No seu caso, ficaria parecido com isso:
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname));
       
        if(!strcmp(npcname, "npc_bmx", true)) PutPlayerInVehicle(playerid, pk1, 0);
        if(!strcmp(npcname, "npc_bmx2", true)) PutPlayerInVehicle(playerid, pk2, 0);
       
        return 1;
    }
  return 1;
}
Muito obrigado cara, agora ta funcionando certinho, +Reep para vocк!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)