Hello everyone.
I am making vehicle system, I done basic things.
I just need little help, I need when player types /stats it shows his owned vehicles.
I must add at "enum PlayerInfo" something for vehicles if I wanted cars owned limit?
This question wasn't really well explained.
In order to show the "owned" vehicles, you need a way you can save the owned vehicles, and then afterwards use the same way to read and show the owned vehicles.
First thing we need to know is, how do you assign a vehicle to a player? And do you save this to a DB or not? etc...
Try to fill out the question a bit more and we might be able to help you with the issue, and guide you what to do next
okay I see.
To show model ID: "GetVehicleModel(VehicleInfo[...][...])" --> that will return the model of the vehicle id, read more here:
Код:
new VehicleNames[212][] = {
{"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
{"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
{"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
{"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
{"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
{"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
{"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
{"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
{"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
{"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
{"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
{"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
{"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
{"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
{"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
{"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
{"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
{"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
{"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
{"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
{"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
{"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
{"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
{"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
{"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
{"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
{"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
{"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
{"Utility Trailer"}
};
Put that somewhere in your script, outside any callbacks and functions, pretty far up in your script.
Use the GetVehicleModel in order to find the correct name for the car, the way used above.
Please note the code above is copy-pasted from Luxurions LuxAdmin Admin system.
PHP код:
enum vehicleInfo
{
vehModel,
vehOwner[32],
vehicle,
Float:vehX,
Float:vehY,
Float:vehZ,
vehC1,
vehC2
}
new VehicleInfo[MAX_VEHS][vehicleInfo];
new newvehicle;
stock LoadVehs()
{
for(new i=0;i<MAX_VEHS;i++)
{
new string[64];
format(string, sizeof(string), "/vehicles/%d.ini", i);
if(fexist(string))
{
INI_ParseFile(string, "LoadVehicles_%s", .bExtra = true, .extra = i);
VehicleInfo[i][vehicle] = CreateVehicle(VehicleInfo[i][vehModel], VehicleInfo[i][vehX], VehicleInfo[i][vehY], VehicleInfo[i][vehZ], VehicleInfo[i][vehC1], VehicleInfo[i][vehC2], 0, -1);
newvehicle=i+1;
}
}
return 1;
}
forward LoadVehicles_data(vehicleid, name[], value[]);
public LoadVehicles_data(vehicleid, name[], value[])
{
INI_Int("Model", VehicleInfo[vehicleid][vehModel]);
INI_String("Owner", VehicleInfo[vehicleid][vehOwner], MAX_PLAYER_NAME);
INI_Float("PosX", VehicleInfo[vehicleid][vehX]);
INI_Float("PosY", VehicleInfo[vehicleid][vehY]);
INI_Float("PosZ", VehicleInfo[vehicleid][vehZ]);
INI_Int("color1", VehicleInfo[vehicleid][vehC1]);
INI_Int("color2", VehicleInfo[vehicleid][vehC2]);
return 1;
}
stock SaveVehs()
{
for(new i=0; i<MAX_VEHS; i++)
{
new string[64];
format(string, sizeof(string), "/vehicles/%d.ini", i);
if(fexist(string))
{
new INI:File=INI_Open(string);
GetVehiclePos(VehicleInfo[i][vehicle], VehicleInfo[i][vehX], VehicleInfo[i][vehY], VehicleInfo[i][vehZ]);
INI_WriteInt(File, "Model", VehicleInfo[i][vehModel]);
INI_WriteString(File, "Owner", VehicleInfo[i][vehOwner]);
INI_WriteFloat(File, "PosX", VehicleInfo[i][vehX]);
INI_WriteFloat(File, "PosY", VehicleInfo[i][vehY]);
INI_WriteFloat(File, "PosZ", VehicleInfo[i][vehZ]);
INI_WriteInt(File, "color1", VehicleInfo[i][vehC1]);
INI_WriteInt(File, "color2", VehicleInfo[i][vehC2]);
INI_Close(File);
}
}
}
To make car limit, or to make Only the owner of the vehicle can use an command to his vehicle I need to add this to playerinfo?