#1

If i have npc recordings in the folder recordings inside npcmodes what do i do in pawno to connect them to the server??
Reply
#2

Try this

Код:
new bot1,bot2,bot3,bot4,bot5,bot6;
OnGameModeInit
Код:
ConnectNPC("AT400_LOS_SANTOS","at400_ls");
    ConnectNPC("AT400_LAS_VENTURAS","at400_lv");
    ConnectNPC("AT400_SAN_FIERRO","at400_sf");
    ConnectNPC("VLAK_LS","VLAK_ls");
    ConnectNPC("VLAK_LV","VLAK_lv");
    ConnectNPC("VLAK_SF","VLAK_sf");
    
    bot1 = CreateVehicle(577, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // AT400_LOS_SANTOS
    bot2 = CreateVehicle(577, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // AT400_LAS_VENTURAS
    bot3 = CreateVehicle(577, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // AT400_SAN_FIERRO
    bot4 = AddStaticVehicleEx(538, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // VLAK_LS
    bot5 = AddStaticVehicleEx(538, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // VLAK_LV
    bot6 = AddStaticVehicleEx(538, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // VLAK_SF
OnPlayerSpawn
Код:
if(IsPlayerNPC(playerid)) 
    {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname)); 
    if(!strcmp(npcname, "AT400_LOS_SANTOS", true))
    {
      PutPlayerInVehicle(playerid, bot1, 0);
      return 1;
    }
    if(!strcmp(npcname, "AT400_LAS_VENTURAS", true))
    {
      PutPlayerInVehicle(playerid, bot2, 0);
      return 1;
    }
    if(!strcmp(npcname, "AT400_SAN_FIERRO", true))
    {
      PutPlayerInVehicle(playerid, bot3,0);
      return 1;
        }
        if(!strcmp(npcname, "VLAK_LS", true))
    {
      PutPlayerInVehicle(playerid, bot4, 0);
      return 1;
    }
    if(!strcmp(npcname, "VLAK_LV", true))
    {
      PutPlayerInVehicle(playerid, bot5, 0);
      return 1;
    }
    if(!strcmp(npcname, "VLAK_SF", true))
    {
      PutPlayerInVehicle(playerid, bot6,0);
      return 1;
        }
    return 1;
    }
Reply
#3

Quote:
Originally Posted by ShaneOvSina
Посмотреть сообщение
Try this

Код:
new bot1,bot2,bot3,bot4,bot5,bot6;
OnGameModeInit
Код:
ConnectNPC("AT400_LOS_SANTOS","at400_ls");
    ConnectNPC("AT400_LAS_VENTURAS","at400_lv");
    ConnectNPC("AT400_SAN_FIERRO","at400_sf");
    ConnectNPC("VLAK_LS","VLAK_ls");
    ConnectNPC("VLAK_LV","VLAK_lv");
    ConnectNPC("VLAK_SF","VLAK_sf");
    
    bot1 = CreateVehicle(577, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // AT400_LOS_SANTOS
    bot2 = CreateVehicle(577, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // AT400_LAS_VENTURAS
    bot3 = CreateVehicle(577, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // AT400_SAN_FIERRO
    bot4 = AddStaticVehicleEx(538, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // VLAK_LS
    bot5 = AddStaticVehicleEx(538, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // VLAK_LV
    bot6 = AddStaticVehicleEx(538, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // VLAK_SF
OnPlayerSpawn
Код:
if(IsPlayerNPC(playerid)) 
    {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname)); 
    if(!strcmp(npcname, "AT400_LOS_SANTOS", true))
    {
      PutPlayerInVehicle(playerid, bot1, 0);
      return 1;
    }
    if(!strcmp(npcname, "AT400_LAS_VENTURAS", true))
    {
      PutPlayerInVehicle(playerid, bot2, 0);
      return 1;
    }
    if(!strcmp(npcname, "AT400_SAN_FIERRO", true))
    {
      PutPlayerInVehicle(playerid, bot3,0);
      return 1;
        }
        if(!strcmp(npcname, "VLAK_LS", true))
    {
      PutPlayerInVehicle(playerid, bot4, 0);
      return 1;
    }
    if(!strcmp(npcname, "VLAK_LV", true))
    {
      PutPlayerInVehicle(playerid, bot5, 0);
      return 1;
    }
    if(!strcmp(npcname, "VLAK_SF", true))
    {
      PutPlayerInVehicle(playerid, bot6,0);
      return 1;
        }
    return 1;
    }
Did you even read what i wrote, why just why do you comment here if you don't know shit?
Reply
#4

For connect the NPC to your server.You first need to create a script for each recording in your npcrecords folder.
If you have some_rec.rec in your recordings folder, you need to create some_rec.pwn in your npcrecordings folder where you will put all the NPC handling code(includes playing,stopping,pausing the recording).Once you do that open your main script(filterscript or gamemode or whatever) and use ConnectNPC to connect the player.Then OnPlayerConnect/OnPlayerSpawn do some strcmps to check each NPC and set the skin,pos,etc.

Refer https://sampforum.blast.hk/showthread.php?tid=95034 for complete explanation.

NOTE:You cannot load multiple NPCs at once.If you have more than one NPC then use timers to load NPCs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)