Dynamic car system help
#8

Hi!

PHP код:
stock LoadVehicle(i)
{
    
Vehicles[i][carmodel] = dini_Int(CarFile(i), "model");
    
Vehicles[i][fx] = dini_Float(CarFile(i), "x");
    
Vehicles[i][fy] = dini_Float(CarFile(i), "y");
    
Vehicles[i][fz] = dini_Float(CarFile(i), "z");
    
Vehicles[i][fa] = dini_Float(CarFile(i), "a");
    
Vehicles[i][color1] = dini_Int(CarFile(i), "color1");
    
Vehicles[i][color2] = dini_Int(CarFile(i), "color2");
    
Vehicles[i][nitro] = dini_Int(CarFile(i), "nitro");
    
Vehicles[i][paintjob] = dini_Int(CarFile(i), "paintjob");
    
Vehicles[i][carteam] = dini_Int(CarFile(i), "carteam");
    
Vehicles[i][cartype] = dini_Int(CarFile(i), "cartype");
    
Vehicles[i][modeltype] = dini_Int(CarFile(i), "modeltype");
    
Vehicles[i][biznumber] = dini_Int(CarFile(i), "biznumber");
    
Vehicles[i][reset] = dini_Int(CarFile(i), "resetted");
    
Vehicles[i][vw] = dini_Int(CarFile(i), "vw");
    
Vehicles[i][carprice] = dini_Int(CarFile(i), "price");
    
myStrcpy(Vehicles[i][jobname], dini_Get(CarFile(i), "jobname"));
    
myStrcpy(Vehicles[i][carowner],dini_Get(CarFile(i), "owner"));
    
myStrcpy(Vehicles[i][dupekey],dini_Get(CarFile(i), "dupekey"));
    
myStrcpy(Vehicles[i][numberplate],dini_Get(CarFile(i),"numberplate"));
    
sscanf(dini_Get(CarFile(i), "components"), "p<,>iiiiiiiiiiiiii",
    
Vehicles[i][Components][0],
    
Vehicles[i][Components][1],
    
Vehicles[i][Components][2],
    
Vehicles[i][Components][3],
    
Vehicles[i][Components][4],
    
Vehicles[i][Components][5],
    
Vehicles[i][Components][6],
    
Vehicles[i][Components][7],
    
Vehicles[i][Components][8],
    
Vehicles[i][Components][9],
    
Vehicles[i][Components][10],
    
Vehicles[i][Components][11],
    
Vehicles[i][Components][12],
    
Vehicles[i][Components][13]);
    
SetTimerEx("ModCar"20000"d"i);
    if(
Vehicles[i][carprice] == -1)
    {
        
dini_IntSet(CarFile(i), "price"0);
        
Vehicles[i][carprice] = 0;
    }
    new 
__a CreateVehicle(Vehicles[i][carmodel],Vehicles[i][fx], Vehicles[i][fy],Vehicles[i][fz],Vehicles[i][fa], Vehicles[i][color1],Vehicles[i][color2] , Vehicles[i][respawn]);
    
SetVehicleVirtualWorld(__aVehicles[i][vw]);
    if(
Vehicles[i][carprice]) UnlockVehicle(i);
    
format(iStrsizeof(iStr), "{d30404}LS - {000000}%d"i);
    
SetVehicleNumberPlate(iiStr);
    
SetVehicleToRespawn(i);
}
//When you buy a car:
dini_FloatSet(CarFile(carid), "x"1859.228637);
dini_FloatSet(CarFile(carid), "y", -1849.452026);
dini_FloatSet(CarFile(carid), "z"13.579807);
dini_FloatSet(CarFile(carid), "a"8.9621);
dini_IntSet(CarFile(carid), "resetted"0);
dini_IntSet(CarFile(carid), "cartype"0);
dini_IntSet(CarFile(carid), "carteam"0);
dini_IntSet(CarFile(carid), "model"jobcars[listitem][jcmodel]);
dini_Set(CarFile(carid), "owner"PlayerName(playerid));
new 
plate[12];
format(plate,sizeof(plate),"{d30404}LS - {000000}%d",carid);
dini_Set(CarFile(carid),"numberplate",plate);
ReloadVehicle(carid);
//The command (in OnPlayerCommandText; you can change the command processor):
if(!strcmp(cmdtext,"/cnplate",true))
{
    new 
plate[12];
    if(
sscanf(cmdtext,"s[12]",plate))return SendClientMessage(playerid,-1,"/cnplate [number plate]");
    
//Here you can go on

You have to go on with the command. You have to check if the player is in a vehicle and so on. Also you have to set the number plate of the vehicle (maybe you have to check if the player is the owner of this car).
Reply


Messages In This Thread
Dynamic car system help - by justjamie - 29.03.2016, 17:02
Re: Dynamic car system help - by justjamie - 29.03.2016, 17:21
Re: Dynamic car system help - by Skimmer - 29.03.2016, 17:24
Re: Dynamic car system help - by justjamie - 29.03.2016, 17:26
Re: Dynamic car system help - by Skimmer - 29.03.2016, 17:40
Re: Dynamic car system help - by justjamie - 29.03.2016, 18:03
Re: Dynamic car system help - by Pottus - 29.03.2016, 18:05
Re: Dynamic car system help - by Mencent - 29.03.2016, 18:11
Re: Dynamic car system help - by justjamie - 29.03.2016, 18:17
Re: Dynamic car system help - by Mencent - 29.03.2016, 18:21

Forum Jump:


Users browsing this thread: 1 Guest(s)