Veh Names
#1

PHP код:
new vID GetVehicleModel(GetPlayerVehicleID(i));
            switch(
vID)
            {
                case 
411:
                { 
Can I somehow instead of vehicle's ID type name of it..??
Reply
#2

use ******!

judging your "wonderful" sentence, i think u need this.

PHP код:
new vehicleNames[][] =
{
    
"Landstalker""Bravura""Buffalo""Linerunner""Perrenial""Sentinel",
    
"Dumper""Firetruck""Trashmaster""Stretch""Manana""Infernus",
    
"Voodoo""Pony""Mule""Cheetah""Ambulance""Leviathan""Moonbeam",
    
"Esperanto""Taxi""Washington""Bobcat""Whoopee""BF Injection",
    
"Hunter""Premier""Enforcer""Securicar""Banshee""Predator""Bus",
    
"Rhino""Barracks""Hotknife""Trailer""Previon""Coach""Cabbie",
    
"Stallion""Rumpo""RC Bandit""Romero""Packer""Monster""Admiral",
    
"Squalo""Seasparrow""Pizzaboy""Tram""Trailer""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""Cropduster""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""Hustler""Intruder""Primo",
    
"Cargobob""Tampa""Sunrise""Merit""Utility""Nevada""Yosemite",
    
"Windsor""Monster""Monster""Uranus""Jester""Sultan""Stratium",
    
"Elegy""Raindance""RC Tiger""Flash""Tahoma""Savanna""Bandito",
    
"Freight Flat""Streak Carriage""Kart""Mower""Dune""Sweeper",
    
"Broadway""Tornado""AT-400""DFT-30""Huntley""Stafford""BF-400",
    
"News Van""Tug""Trailer""Emperor""Wayfarer""Euros""Hotdog""Club",
    
"Freight Box""Trailer""Andromada""Dodo""RC Cam""Launch""Police Car",
     
"Police Car""Police Car""Police Ranger""Picador""S.W.A.T""Alpha",
     
"Phoenix""Glendale""Sadler""Luggage""Luggage""Stairs""Boxville",
     
"Tiller""Utility Trailer"
}; 
PHP код:
getVehicleName(vehicleid)
{
    new 
carName[30];
    
format(carNamesizeof(carName),"%s"vehicleNames[GetVehicleModel(vehicleid) - 400]);
    return 
carName;

If you want name to id , you ahve to reverse the function, loop thru the array and get the id
Reply
#3

Quote:
Originally Posted by Micko123
Посмотреть сообщение
PHP код:
new vID GetVehicleModel(GetPlayerVehicleID(i));
            switch(
vID)
            {
                case 
411:
                { 
Can I somehow instead of vehicle's ID type name of it..??
see my post here: https://sampforum.blast.hk/showthread.php?tid=624489
so no, it has to be a constant (or list of constants) following the "case"
Reply
#4

Okay thx man
Reply
#5

You can make an enum of all vehicle names then you can use that. It would purely be for the benefit of the programmer.
PHP код:
enum
{
    
VEHICLE_LANDSTAL 400,
    
VEHICLE_BRAVURA,
    
VEHICLE_BUFFALO,
    
// ...

Reply
#6

Quote:
Originally Posted by CutX
Посмотреть сообщение
see my post here: https://sampforum.blast.hk/showthread.php?tid=624489
so no, it has to be a constant (or list of constants) following the "case"
Click the number behind the hashtag (#) sign next time for a single post. in your case (http://forum.sa-mp.com/showpost.php?...60&postcount=2)
Reply
#7

Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
Click the number behind the hashtag (#) sign next time for a single post. in your case (http://forum.sa-mp.com/showpost.php?...60&postcount=2)
ya i know but i also wanted him to see what Konstantinos posted there after me.
since i wasn't sure of how the things work Konstantinos speaks of there,
i didn't say so specifically but thought @op might know so ill give him the whole thread

so ya, im not sure if it's only relevant for that other thread but apparently,
you can do some neat stuff with streamer which might allow what @op hoped to be abel to do
it's got me curious ever since i read that...
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)