Jump to content

Creare NPC in vehicul


Recommended Posts


Am facut un NPC in vehicul, mai bine zic intr-un autobuz si am mam gandit ca poate vreti si voi sa faceti si nu va descurcati  :grin:

[glow=red,2,300]Pasul 1[/glow]

Descarcati aces FS de aici, si bagati in filterscript editati server.cfg si la linia cu filterscripts adaugati npc_record.

[glow=red,2,300]Pasul 2[/glow]

Deschidem server, intram in joc si tastam /rcon login ( rcon din server.cfg), dupa tastam /vrecord {nume} intr-un vehicul ca sa facem inregistrarea. Dupa ce am facut inregistrarea tastam /stoprecord.

[glow=red,2,300]Pasul 3[/glow]

Mergem in scriptfiles si avem nume.rec (nume insemnand ce ati scris voi la /vrecord {nume}) si il mutam in folderul cu npcmodes -> recordings.

[glow=red,2,300]Pasul 4[/glow]

Deschidem pawno, facem un nou script si adaugam in el:

#define RECORDING "nume" //numele inregistratii
#define RECORDING_TYPE 1 //1 npc fiind in vehicul

#include <a_npc>
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCExitVehicle() StopRecordingPlayback();
Salvam si compilam si folderul npcmodes. [glow=red,2,300]Pasul 5[/glow] Mergem in gamemode si salvam vehiculul si ii facem conexiunea ! Definim global:
new buscar1;
la public OnPlayerSpawn adaugam:
        new npcname[MAX_PLAYER_NAME]; GetPlayerName(playerid, npcname, sizeof(npcname));
        if(!strcmp(npcname, "Mihai", true))// Mihai find numele botului
            PutPlayerInVehicle(playerid, buscar1, 0);// pune botul in vehicul
            SetPlayerSkin(playerid, 253);// skinul botuui
            SetPlayerColor(playerid,COLOR_WHITE);// culoare lui
            PlayerInfo[playerid][pCarLic] = 1;// in caz ca vreti sa adaugati pe RP mai recomandat este sa ii dati licenta
            return 1;
Bagam vehiculul la public OnGameModeInit():
buscar1 = AddStaticVehicle(coordonate, etc...); //
si tot aici adaugam: ConnectNPC("Mihai","nume");// nume find .amx din npcmodes iar Mihai numele botului Mergem la public OnPlayerRequestClass si adaugam:
        new playername[64];

        if(!strcmp(playername,"Mihai",true)) { // Mihai fiind numele botului
            SetPlayerColor(playerid,COLOR_WHITE); // culoare lui
        return 1;
Mergem la public OnPlayerConnect(playerid)
if(IsPlayerNPC(playerid)) {
        new ip_addr_npc[64+1];
        new ip_addr_server[64+1];

        if(!strlen(ip_addr_server)) {
            ip_addr_server = "";

        if(strcmp(ip_addr_npc,ip_addr_server,true) != 0) {
            printf("NPC: Got a remote NPC connecting from %s and I'm kicking it.",ip_addr_npc);
            return 0;
        printf("NPC: Connection from %s is allowed.",ip_addr_npc);
Si mai avem de adaugat la public OnPlayerDisconnect
        return 1;

EDIT: sa va asugurati ca in server.cfg aveti maxnpc 1 ( 1 find doar 1 bot pe server)

Daca intampinati probleme nu ezitati sa postati

Link to comment
Share on other sites

Am facut totul exact cum ai spus,si nu se misca autobusul..

Ai facut ceva gresit, mie imi merge de minune  :afro:

[glow=black,2,300]Merge frate tutorialul :D e foarte bun 5/5[/glow]

Uite vezi lui ia functionat

2/5 este un tutorial deja al lui cmglife.

Sunt multe in plus fata de cel a lui cmg4life :P

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.