PDA

View Full Version : [Tutorial] Creare NPC in vehicul


gabitzu4ever
05/07/2011, 06:51 AM
http://img233.imageshack.us/img233/1382/2q3123.png

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 :)

Pasul 1
Descarcati aces FS de aici (http://www.2shared.com/file/SjytR1GA/npc_record.html), si bagati in filterscript editati server.cfg si la linia cu filterscripts adaugati npc_record.

Pasul 2
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.

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

Pasul 4
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>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCExitVehicle() StopRecordingPlayback();

Salvam si compilam.


Pasul 5
Mergem in gamemode si salvam vehiculul si ii facem conexiunea !
Definim global:
new buscar1;

la public OnPlayerSpawn adaugam:
if(IsPlayerNPC(playerid))
{
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:
if(IsPlayerNPC(playerid))
{
new playername[64];
GetPlayerName(playerid,playername,64);

if(!strcmp(playername,"Mihai",true)) { // Mihai fiind numele botului
SetPlayerColor(playerid,COLOR_WHITE); // culoare lui
SetSpawnInfo(playerid,69,236,1462.0745,2630.8787,1 0.8203,0.0,-1,-1,-1,-1,-1,-1);
}
return 1;
}

Mergem la public OnPlayerConnect(playerid)
if(IsPlayerNPC(playerid)) {
new ip_addr_npc[64+1];
new ip_addr_server[64+1];
GetServerVarAsString("bind",ip_addr_server,64);
GetPlayerIp(playerid,ip_addr_npc,64);

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

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);
Kick(playerid);
return 0;
}
printf("NPC: Connection from %s is allowed.",ip_addr_npc);
}

Si mai avem de adaugat la public OnPlayerDisconnect
if(IsPlayerNPC(playerid))
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

!!--Ryder_RO--!!
22/07/2011, 08:32 PM
Frumos
bravo

GangsTa_
28/07/2011, 11:30 AM
Good job)

StR_MaRy
09/08/2011, 06:46 PM
boss la inceputu tutorialului astea

main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCExitVehicle() StopRecordingPlayback();

unde mai exact :| dami un ex: ... cum ar veni

sub public onplayerconnect ... s-au pnm :|

Skaizo
19/08/2011, 08:52 AM
dupa #include

Users
08/10/2011, 08:47 AM
Cum il pot face sa conduca vehiculul anumit spre destinatii , gen NPC Taxist

Slake
08/10/2011, 12:22 PM
inregistrezi urmareste tutorialul cu atentie k scrie

Crystyan12
08/10/2011, 01:37 PM
inregistrezi urmareste tutorialul cu atentie k scrie

E chior, probabil uita sa-si puna ochelari cand citeste.



Pasul 2
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.

an4rei
30/10/2011, 06:17 PM
Misto!

BoSs_S
10/11/2011, 08:38 PM
e frumos dar am primit niste erori le puteti rezolva?


C:\Users\Administrator\Desktop\blackpedia.pwn(234) : warning 235: public function lacks forward declaration (symbol "OnRecordingPlaybackEnd")
C:\Users\Administrator\Desktop\blackpedia.pwn(234) : error 017: undefined symbol "StartRecordingPlayback"
C:\Users\Administrator\Desktop\blackpedia.pwn(235) : warning 235: public function lacks forward declaration (symbol "OnNPCEnterVehicle")
C:\Users\Administrator\Desktop\blackpedia.pwn(235) : error 017: undefined symbol "StartRecordingPlayback"
C:\Users\Administrator\Desktop\blackpedia.pwn(236) : warning 235: public function lacks forward declaration (symbol "OnNPCExitVehicle")
C:\Users\Administrator\Desktop\blackpedia.pwn(236) : error 017: undefined symbol "StopRecordingPlayback"
C:\Users\Administrator\Desktop\blackpedia.pwn(2248 ) : error 021: symbol already defined: "main"
C:\Users\Administrator\Desktop\blackpedia.pwn(2309 ) : warning 235: public function lacks forward declaration (symbol "inchidereTCC")
C:\Users\Administrator\Desktop\blackpedia.pwn(2318 ) : warning 235: public function lacks forward declaration (symbol "inchiderepoarta")
C:\Users\Administrator\Desktop\blackpedia.pwn(4603 ) : error 010: invalid function or declaration
C:\Users\Administrator\Desktop\blackpedia.pwn(4604 ) : error 010: invalid function or declaration
C:\Users\Administrator\Desktop\blackpedia.pwn(7419 ) : error 010: invalid function or declaration
C:\Users\Administrator\Desktop\blackpedia.pwn(7422 ) : error 021: symbol already defined: "GetPlayerName"
C:\Users\Administrator\Desktop\blackpedia.pwn(7424 ) : error 010: invalid function or declaration
C:\Users\Administrator\Desktop\blackpedia.pwn(7428 ) : error 010: invalid function or declaration
C:\Users\Administrator\Desktop\blackpedia.pwn(8475 ) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(8475 ) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(8679 ) : warning 235: public function lacks forward declaration (symbol "AHackTog")
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 3) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 3) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 4) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 4) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 5) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 5) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 6) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 6) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 7) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 7) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 8) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 8) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(1526 2) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\blackpedia.pwn(1643 4) : warning 219: local variable "playername" shadows a variable at a preceding level
C:\Users\Administrator\Desktop\blackpedia.pwn(2059 9) : warning 219: local variable "playername" shadows a variable at a preceding level
C:\Users\Administrator\Desktop\blackpedia.pwn(2383 6) : warning 204: symbol is assigned a value that is never used: "string3"
C:\Users\Administrator\Desktop\blackpedia.pwn(3163 7) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(3444 3) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(3444 3) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(4932 9) : warning 203: symbol is never used: "Iswhisper"
C:\Users\Administrator\Desktop\blackpedia.pwn(4932 9) : warning 203: symbol is never used: "inchidereagate"
C:\Users\Administrator\Desktop\blackpedia.pwn(4932 9) : warning 203: symbol is never used: "playername"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


10 Errors.

TheDrx
19/12/2011, 05:10 PM
e frumos dar am primit niste erori le puteti rezolva?


C:\Users\Administrator\Desktop\blackpedia.pwn(234) : warning 235: public function lacks forward declaration (symbol "OnRecordingPlaybackEnd")
C:\Users\Administrator\Desktop\blackpedia.pwn(234) : error 017: undefined symbol "StartRecordingPlayback"
C:\Users\Administrator\Desktop\blackpedia.pwn(235) : warning 235: public function lacks forward declaration (symbol "OnNPCEnterVehicle")
C:\Users\Administrator\Desktop\blackpedia.pwn(235) : error 017: undefined symbol "StartRecordingPlayback"
C:\Users\Administrator\Desktop\blackpedia.pwn(236) : warning 235: public function lacks forward declaration (symbol "OnNPCExitVehicle")
C:\Users\Administrator\Desktop\blackpedia.pwn(236) : error 017: undefined symbol "StopRecordingPlayback"
C:\Users\Administrator\Desktop\blackpedia.pwn(2248 ) : error 021: symbol already defined: "main"
C:\Users\Administrator\Desktop\blackpedia.pwn(2309 ) : warning 235: public function lacks forward declaration (symbol "inchidereTCC")
C:\Users\Administrator\Desktop\blackpedia.pwn(2318 ) : warning 235: public function lacks forward declaration (symbol "inchiderepoarta")
C:\Users\Administrator\Desktop\blackpedia.pwn(4603 ) : error 010: invalid function or declaration
C:\Users\Administrator\Desktop\blackpedia.pwn(4604 ) : error 010: invalid function or declaration
C:\Users\Administrator\Desktop\blackpedia.pwn(7419 ) : error 010: invalid function or declaration
C:\Users\Administrator\Desktop\blackpedia.pwn(7422 ) : error 021: symbol already defined: "GetPlayerName"
C:\Users\Administrator\Desktop\blackpedia.pwn(7424 ) : error 010: invalid function or declaration
C:\Users\Administrator\Desktop\blackpedia.pwn(7428 ) : error 010: invalid function or declaration
C:\Users\Administrator\Desktop\blackpedia.pwn(8475 ) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(8475 ) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(8679 ) : warning 235: public function lacks forward declaration (symbol "AHackTog")
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 3) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 3) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 4) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 4) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 5) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 5) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 6) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 6) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 7) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 7) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 8) : warning 213: tag mismatch
C:\Users\Administrator\Desktop\blackpedia.pwn(1390 8) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(1526 2) : warning 215: expression has no effect
C:\Users\Administrator\Desktop\blackpedia.pwn(1643 4) : warning 219: local variable "playername" shadows a variable at a preceding level
C:\Users\Administrator\Desktop\blackpedia.pwn(2059 9) : warning 219: local variable "playername" shadows a variable at a preceding level
C:\Users\Administrator\Desktop\blackpedia.pwn(2383 6) : warning 204: symbol is assigned a value that is never used: "string3"
C:\Users\Administrator\Desktop\blackpedia.pwn(3163 7) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(3444 3) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(3444 3) : warning 202: number of arguments does not match definition
C:\Users\Administrator\Desktop\blackpedia.pwn(4932 9) : warning 203: symbol is never used: "Iswhisper"
C:\Users\Administrator\Desktop\blackpedia.pwn(4932 9) : warning 203: symbol is never used: "inchidereagate"
C:\Users\Administrator\Desktop\blackpedia.pwn(4932 9) : warning 203: symbol is never used: "playername"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


10 Errors.
Nu ai includele, de care ai nevoie.

Este folositor acest tutorial, multumim pentru el.

saringan_cs
27/12/2011, 03:10 PM
si cum fac pentru GF?

gabitzu4ever
01/01/2012, 09:35 PM
si cum fac pentru GF?

ce scrie pe prima pagina