Je suis sur GF
Double post
Alors, voilà
Alors voilà, j'ai suivis ce tuto :
http://forum.sa-mp.com/index.php?topic=119947.0 pour installer un NPC en voiture.
Je procédé comme tel :
- Je me suis connecté à mon serveur, j'ai installé un véhicule "/veh 560 3 3", puis j'ai "/save". J'ai récupéré la position du véhicule et j'ai placé la ligne dans "public OnGameModeInit()", puis dans "AddStaticVehicleEx" comme çà :
//------------------------------------Véhicules achetables----------------------------------------------------------------------------------------
AddStaticVehicleEx(560,490.4265,-1489.0308,19.7264,347.2856,3,3, 60000); //sultan
AddStaticVehicleEx(560,-2064.2214,-84.1129,34.8688,359.8634, 3,3, 60000);// Sultan à l'auto école
...........
.
Ensuite, je me suis connecté, je suis monté dans la voiture, je me suis logué en Rcon et j'ai commencé un enregistrement en voiture "/vrecord mynpc".
Une fois terminé, je suis allé dans le dossier "Scriptfiles", j'ai copié "mynpc.rec" dans Npcmodes/recording". Ensuite j'ai ouvert un nouveau fichier pawno et j'ai collé :
#define RECORDING "mynpc" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot.
#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#if RECORDING_TYPE == 1
public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
public OnNPCExitVehicle() StopRecordingPlayback();
#else
public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
Je l'es enregistré sous "mynpc" dans "npcmodes".
Ensuite, j'ai ouvert mon Gamemode, j'ai cherché la ligne "public OnGameModeInit()", et j'ai collé :
new MyFirstNPCVehicle; //Global variable!
public OnGameModeInit()
{
print("my gamemode");
ConnectNPC("MyFirstNPC","mynpc");
MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}
Comme ceci :
//------------------------------------------------------------------------------------------------------
public OnGameModeInit()
{
new string[MAX_PLAYER_NAME];
new string1[MAX_PLAYER_NAME];
for(new c=0;c<CAR_AMOUNT;c++)
{
Gas[c] = GasMax;
}
LoadProperty();
LoadBizz();
LoadSBizz();
LoadBoxer();
LoadStuff();
LoadIRC();
LoadFamilies();
LoadCK();
LoadTurfs();
LoadPapers();
IRCInfo[0][iPlayers] = 0; IRCInfo[1][iPlayers] = 0; IRCInfo[2][iPlayers] = 0;
IRCInfo[3][iPlayers] = 0; IRCInfo[4][iPlayers] = 0; IRCInfo[5][iPlayers] = 0;
IRCInfo[6][iPlayers] = 0; IRCInfo[7][iPlayers] = 0; IRCInfo[8][iPlayers] = 0;
IRCInfo[9][iPlayers] = 0;
News[hTaken1] = 0; News[hTaken2] = 0; News[hTaken3] = 0; News[hTaken4] = 0; News[hTaken5] = 0;
format(string, sizeof(string), "Nothing");
strmid(News[hAdd1], string, 0, strlen(string), 255);
strmid(News[hAdd2], string, 0, strlen(string), 255);
strmid(News[hAdd3], string, 0, strlen(string), 255);
strmid(News[hAdd4], string, 0, strlen(string), 255);
strmid(News[hAdd5], string, 0, strlen(string), 255);
format(string1, sizeof(string1), "No-one");
strmid(News[hContact1], string1, 0, strlen(string1), 255);
strmid(News[hContact2], string1, 0, strlen(string1), 255);
strmid(News[hContact3], string1, 0, strlen(string1), 255);
strmid(News[hContact4], string1, 0, strlen(string1), 255);
strmid(News[hContact5], string1, 0, strlen(string1), 255);
PlayerHaul[78][pCapasity] = 100;
PlayerHaul[79][pCapasity] = 100;
PlayerHaul[80][pCapasity] = 50;
PlayerHaul[81][pCapasity] = 50;
SetGameModeText("The Godfather: LS/SF");
format(objstore, sizeof(objstore), "MOLE: I got nothing, check back with me later.");
format(cbjstore, sizeof(cbjstore), "HQ: There is nothing in your Vicinity, Out.");
format(motd, sizeof(motd), "Welcome to the Role Play - The Godfather Server.");
gettime(ghour, gminute, gsecond);
FixHour(ghour);
ghour = shifthour;
if(!realtime)
{
SetWorldTime(wtime);
}
SetPDistance(10);
EnableTirePopping(1);
EnableZoneNames(1);
AllowInteriorWeapons(1);
AllowAdminTeleport(1);
UsePlayerPedAnims();
// CreatedCars check
for(new i = 0; i < sizeof(CreatedCars); i++)
{
CreatedCars = 0;
}
// Zones
for(new i = 0; i < sizeof(TurfInfo); i++)
{
Turfs = GangZoneCreate(TurfInfo[zMinX],TurfInfo[zMinY],TurfInfo[zMaxX],TurfInfo[zMaxY]);
}
// Player Class's
for(new i = 0; i <= sizeof(Peds)-1; i++)
{
AddPlayerClass(Peds[0],1958.3783,1343.1572,1100.3746,269.1425,-1,-1,-1,-1,-1,-1);
}
// Car Spawns
/*for(new h = 0; h < sizeof(HouseInfo); h++)
{
AddStaticVehicleEx(HouseInfo[h][hVec], HouseCarSpawns[h][0], HouseCarSpawns[h][1], HouseCarSpawns[h][2], HouseCarSpawns[h][3], HouseInfo[h][hVcol1], HouseInfo[h][hVcol2], 60000);
gCarLock[h+1] = 1;
}//34*/
{
print("Paradize");
ConnectNPC("MyFirstNPC","mynpc");
MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
}
.
et :
//------------------------------------[News]------------------------------------
new MyFirstNPCVehicle; //Global variable!
new Security = 0;
Ensuite, j'ai cherché "public OnPlayerSpawn(playerid)" et j'ai collé :
{
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;
}
//Other stuff for normal players goes here!
return 1;
}
Comme ceci :
//----------npc---------------------------
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;
}
//Other stuff for normal players goes here!
return 1;
}
//--------------------------------------------------------------
public CKLog(string[])
Voilà, ensuite j'ai enregistré et compilé. Aucune erreur.
Je configure le server.cfg. Car "maxnpc" était de 0. J'ai donc mis "maxnpc 50".
Ensuite j'ai lancé mon serveur mais sur la fenêtre de commande, il m'affiche çà :

Pourquoi le bot ce connecte et ce déconnecte directement ??
Merci