Need help with the bloc-notes "vehinfo"
#1

Hi , i'm using a RP GM , so the cars aren't saved on "Public ongamemodint" but on "vehinfo" folder located at "scriptfiles" , this is an ex of a car :
Код:
499|421|1556.638427|-1776.147949|13.429368|269.786254|1|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|100|Governement|Washington
so i want to add more cars , how to do it ? thanks .
Reply
#2

Well the script reads that line to load the vehicle. I'm assuming it's vehicle model, x, y, and z coords, rotation, and then modifications. You can either add vehicles on OnGameModeInit anyways, or if you want it to follow this system just search in the script and see how it saves.
Reply
#3

i see... i crated a vehicle using MTA but i have only the X,Y,Z coors.. and about the GM they didn't write any informations. Thank u for the repply
Reply
#4

Do you use the system vehicle by MrFreedo FR ?
Reply
#5

Yes, he is, you must save In Game with a special command
Reply
#6

Do you speak French ?
I use the same.
Here, I'll place my order and tries to emulate:

Код:
if(strcmp(cmd, "/veh", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(IsPlayerAdmin(playerid))// Connect in /rcon
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, 0xFFFFFF00, "[Usage]: /veh [ModelID] [Color1] [Color2]");
					return 1;
				}
                                new modelid = strval(tmp);
				if(modelid == 0)
				{
					SendClientMessage(playerid, 0xFFFFFF00, "Model du vйhicule incorrect");
					return 1;
				}
				new color1 = 0;
				tmp = strtok(cmdtext, idx);
				if(strlen(tmp)) color1 = strval(tmp);
				new color2 = 0;
				tmp = strtok(cmdtext, idx);
				if(strlen(tmp)) color2 = strval(tmp);

				new Float:x,Float:y,Float:z,Float:a;
				GetPlayerPos(playerid,x,y,z);
				GetPlayerFacingAngle(playerid,a);
				GetXYFront(x, y, a, 3.0);
				new Cveh = CreateVehicle(modelid,x,y,z,a,color1,color2,RESPAWN_DELAY);

				VehiculeInfo[Cveh][VehID]		= Cveh;
				VehiculeInfo[Cveh][Model]		= modelid;
				VehiculeInfo[Cveh][XSpawn]		= x;
				VehiculeInfo[Cveh][YSpawn]	 	= y;
				VehiculeInfo[Cveh][ZSpawn] 		= z;
				VehiculeInfo[Cveh][ASpawn]	  	= a;
				VehiculeInfo[Cveh][Couleur1]	= color1;
				VehiculeInfo[Cveh][Couleur2]	= color2;
				VehiculeInfo[Cveh][Prix]       	= 0;
				VehiculeInfo[Cveh][Status]     	= 0;
				VehiculeInfo[Cveh][Alarme]	  	= 0;
				VehiculeInfo[Cveh][Tuning0]		= 0;
				VehiculeInfo[Cveh][Tuning1]		= 0;
				VehiculeInfo[Cveh][Tuning2]		= 0;
				VehiculeInfo[Cveh][Tuning3]		= 0;
				VehiculeInfo[Cveh][Tuning4]		= 0;
				VehiculeInfo[Cveh][Tuning5]		= 0;
				VehiculeInfo[Cveh][Tuning6]		= 0;
				VehiculeInfo[Cveh][Tuning7]		= 0;
				VehiculeInfo[Cveh][Tuning8]		= 0;
				VehiculeInfo[Cveh][Tuning9]	= 0;
				VehiculeInfo[Cveh][Tuning10]	= 0;
				VehiculeInfo[Cveh][Tuning11]	= 0;
				VehiculeInfo[Cveh][Tuning12]	= 0;
				VehiculeInfo[Cveh][Tuning13]	= 0;
				VehiculeInfo[Cveh][Tuning14]	= 0;
				VehiculeInfo[Cveh][Tuning15]	= 0;
				VehiculeInfo[Cveh][Tuning16]	= 0;
				VehiculeInfo[Cveh][Peinture]	= 0;
				VehiculeInfo[Cveh][MaxEssence] 	= 100;
				VehiculeInfo[Cveh][Essence] 	= 100;
				Gas[Cveh] = 100;
				strmid(VehiculeInfo[Cveh][Proprio], "Aucun", 0, strlen("Aucun"),128);
    			strmid(VehiculeInfo[Cveh][Nom],VehicleName[modelid-400],0,strlen(VehicleName[modelid-400]),128);

				format(string,sizeof(string), "[ID]: %d. Nom: %s. | Vйhicule Crйer",Cveh,VehiculeInfo[Cveh][Nom]);
				SendClientMessage(playerid,0xFFFFFF00,string);
				PutPlayerInVehicle(playerid, Cveh, 0);
                                SauvegardeVeh();
			}
		    else
			{
				SendClientMessage(playerid,0xFFFFFF00, "Vous n'кtes pas autoriser а utilisй cette commande.");
				return 1;
			}
		}
		return 1;
	}
Note:

Change to variable for saving vehicle:
Код:
public SauvegardeVeh()
{
	for(new v = 1; v < MAX_VEHICLES; v++)
	{
        // code for saving
        }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)