Car ID to Car Name
#1

Does anyone have one of these in their script that has every vehicle?
Typing it out is very tedious and if someone has already done it could you post it below?

This is what I have:

Quote:

case 0: format(name, sizeof(name), "None");
case 400: format(name, sizeof(name), "Landstalker");
case 401: format(name, sizeof(name), "Bravura");
case 402: format(name, sizeof(name), "Buffalo");
case 403: format(name, sizeof(name), "Linerunner");
case 404: format(name, sizeof(name), "Perenniel");
case 405: format(name, sizeof(name), "Sentinel");
case 406: format(name, sizeof(name), "Dumper");
case 407: format(name, sizeof(name), "Fire Truck");
case 408: format(name, sizeof(name), "Trashmaster");
case 409: format(name, sizeof(name), "Stretch");
case 410: format(name, sizeof(name), "Manana");
case 411: format(name, sizeof(name), "Infernus");
case 412: format(name, sizeof(name), "Voodoo");
case 413: format(name, sizeof(name), "Pony");
case 414: format(name, sizeof(name), "Mule");
case 415: format(name, sizeof(name), "Cheetah");
case 416: format(name, sizeof(name), "Ambulance");
case 417: format(name, sizeof(name), "Leviathan");
case 418: format(name, sizeof(name), "Moonbeam");
case 419: format(name, sizeof(name), "Esperanto");
case 420: format(name, sizeof(name), "Taxi");
case 421: format(name, sizeof(name), "Washington");
case 422: format(name, sizeof(name), "Bobcat");
case 423: format(name, sizeof(name), "Mr Whoopee");
case 424: format(name, sizeof(name), "BF Injection");
case 425: format(name, sizeof(name), "Hunter");
case 426: format(name, sizeof(name), "Premier");
case 427: format(name, sizeof(name), "Enforcer");
case 428: format(name, sizeof(name), "Securicar");
case 429: format(name, sizeof(name), "Banshee");
case 430: format(name, sizeof(name), "Predator");
case 431: format(name, sizeof(name), "Bus");
case 432: format(name, sizeof(name), "Rhino");
case 433: format(name, sizeof(name), "Barracks");
case 434: format(name, sizeof(name), "Hotknife");
case 435: format(name, sizeof(name), "Article Trailer");
case 436: format(name, sizeof(name), "Previon");
case 437: format(name, sizeof(name), "Coach");
case 438: format(name, sizeof(name), "Cabbie");
case 439: format(name, sizeof(name), "Stallion");
case 440: format(name, sizeof(name), "Rumpo");
case 441: format(name, sizeof(name), "RC Bandit");
case 442: format(name, sizeof(name), "Romero");
case 443: format(name, sizeof(name), "Packer");
case 444: format(name, sizeof(name), "Monster");
case 445: format(name, sizeof(name), "Admiral");
case 446: format(name, sizeof(name), "Squallo");
case 447: format(name, sizeof(name), "Seasparrow");
case 448: format(name, sizeof(name), "Pizzaboy");
case 449: format(name, sizeof(name), "Tram");
case 450: format(name, sizeof(name), "Article Trailer 2");
case 451: format(name, sizeof(name), "Turismo");
case 452: format(name, sizeof(name), "Speeder");
case 453: format(name, sizeof(name), "Reefer");
case 454: format(name, sizeof(name), "Tropic");
case 455: format(name, sizeof(name), "Flatbed");
case 456: format(name, sizeof(name), "Yankee");
case 457: format(name, sizeof(name), "Caddy");
case 458: format(name, sizeof(name), "Solair");
case 459: format(name, sizeof(name), "Topfun Van");
case 460: format(name, sizeof(name), "Skimmer");
case 461: format(name, sizeof(name), "PCJ-600");
case 462: format(name, sizeof(name), "Faggio");
case 463: format(name, sizeof(name), "Freeway");
case 464: format(name, sizeof(name), "RC Baron");
case 465: format(name, sizeof(name), "RC Raider");
case 466: format(name, sizeof(name), "Glendale");
case 467: format(name, sizeof(name), "Oceanic");
case 468: format(name, sizeof(name), "Sanchez");
case 469: format(name, sizeof(name), "Sparrow");
case 470: format(name, sizeof(name), "Patriot");
case 471: format(name, sizeof(name), "Quad");
case 472: format(name, sizeof(name), "Coastguard");
case 473: format(name, sizeof(name), "Dinghy");
case 474: format(name, sizeof(name), "Hermes");
case 475: format(name, sizeof(name), "Sabre");
case 476: format(name, sizeof(name), "Rustler");
case 477: format(name, sizeof(name), "ZR-350");
case 478: format(name, sizeof(name), "Walton");
case 479: format(name, sizeof(name), "Regina");
case 480: format(name, sizeof(name), "Comet");
case 481: format(name, sizeof(name), "BMX");
case 495: format(name, sizeof(name), "Sandking");
case 506: format(name, sizeof(name), "Super GT");
case 521: format(name, sizeof(name), "FCR-900");
case 522: format(name, sizeof(name), "NRG-500");
case 533: format(name, sizeof(name), "Feltzer");
case 555: format(name, sizeof(name), "Windsor");
case 579: format(name, sizeof(name), "Huntley");
case 560: format(name, sizeof(name), "Sultan");
case 589: format(name, sizeof(name), "Club");
case 541: format(name, sizeof(name), "Bullet");
case 559: format(name, sizeof(name), "Jester");
case 536: format(name, sizeof(name), "Blade");
case 575: format(name, sizeof(name), "Broadway");
case 534: format(name, sizeof(name), "Remington");
case 567: format(name, sizeof(name), "Savanna");
case 535: format(name, sizeof(name), "Slamvan");
case 603: format(name, sizeof(name), "Phoenix");

I need the rest, so like every car. Thanks
Reply
#2

pawn Код:
new static const VehicleNames[][] =
{
    "Landstalker", "Bravura", "Buffalo", "Linerunner", "Pereniel", "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", "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", "ZR3 50", "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", "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", "Trailer", "Kart", "Mower",
    "Duneride", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400", "Newsvan", "Tug", "Trailer A", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club", "Trailer B", "Trailer C", "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"
};

stock GetVehicleName(vehiclemodel)
{
    new VName[30]; format(VName, sizeof(VName), "%s", VehicleNames[vehiclemodel-400]);
    return VName;
}
Use GetVehicleName(vehiclemodel); or GetVehicleName(GetVehicleModel(vehicleid)); it returns the vehicle's name
Reply
#3

Okay, but this was the stock and when I change it the names are not appearing:

pawn Код:
stock RVN(carid)
{
    new name[32];
    switch(carid)
 {
        case 0: format(name, sizeof(name), "None");
        case 400: format(name, sizeof(name), "Landstalker");
        case 401: format(name, sizeof(name), "Bravura");
        case 402: format(name, sizeof(name), "Buffalo");
        case 403: format(name, sizeof(name), "Linerunner");
        case 404: format(name, sizeof(name), "Perenniel");
        case 405: format(name, sizeof(name), "Sentinel");
        case 406: format(name, sizeof(name), "Dumper");
        case 407: format(name, sizeof(name), "Fire Truck");
        case 408: format(name, sizeof(name), "Trashmaster");
        case 409: format(name, sizeof(name), "Stretch");
        case 410: format(name, sizeof(name), "Manana");
        case 411: format(name, sizeof(name), "Infernus");
        case 412: format(name, sizeof(name), "Voodoo");
        case 413: format(name, sizeof(name), "Pony");
        case 414: format(name, sizeof(name), "Mule");
        case 415: format(name, sizeof(name), "Cheetah");
        case 416: format(name, sizeof(name), "Ambulance");
        case 417: format(name, sizeof(name), "Leviathan");
        case 418: format(name, sizeof(name), "Moonbeam");
        case 419: format(name, sizeof(name), "Esperanto");
        case 420: format(name, sizeof(name), "Taxi");
        case 421: format(name, sizeof(name), "Washington");
        case 422: format(name, sizeof(name), "Bobcat");
        case 423: format(name, sizeof(name), "Mr Whoopee");
        case 424: format(name, sizeof(name), "BF Injection");
        case 425: format(name, sizeof(name), "Hunter");
        case 426: format(name, sizeof(name), "Premier");
        case 427: format(name, sizeof(name), "Enforcer");
        case 428: format(name, sizeof(name), "Securicar");
        case 429: format(name, sizeof(name), "Banshee");
        case 430: format(name, sizeof(name), "Predator");
        case 431: format(name, sizeof(name), "Bus");
        case 432: format(name, sizeof(name), "Rhino");
        case 433: format(name, sizeof(name), "Barracks");
        case 434: format(name, sizeof(name), "Hotknife");
        case 435: format(name, sizeof(name), "Article Trailer");
        case 436: format(name, sizeof(name), "Previon");
        case 437: format(name, sizeof(name), "Coach");
        case 438: format(name, sizeof(name), "Cabbie");
        case 439: format(name, sizeof(name), "Stallion");
        case 440: format(name, sizeof(name), "Rumpo");
        case 441: format(name, sizeof(name), "RC Bandit");
        case 442: format(name, sizeof(name), "Romero");
        case 443: format(name, sizeof(name), "Packer");
        case 444: format(name, sizeof(name), "Monster");
        case 445: format(name, sizeof(name), "Admiral");
        case 446: format(name, sizeof(name), "Squallo");
        case 447: format(name, sizeof(name), "Seasparrow");
        case 448: format(name, sizeof(name), "Pizzaboy");
        case 449: format(name, sizeof(name), "Tram");
        case 450: format(name, sizeof(name), "Article Trailer 2");
        case 451: format(name, sizeof(name), "Turismo");
        case 452: format(name, sizeof(name), "Speeder");
        case 453: format(name, sizeof(name), "Reefer");
        case 454: format(name, sizeof(name), "Tropic");
        case 455: format(name, sizeof(name), "Flatbed");
        case 456: format(name, sizeof(name), "Yankee");
        case 457: format(name, sizeof(name), "Caddy");
        case 458: format(name, sizeof(name), "Solair");
        case 459: format(name, sizeof(name), "Topfun Van");
        case 460: format(name, sizeof(name), "Skimmer");
        case 461: format(name, sizeof(name), "PCJ-600");
        case 462: format(name, sizeof(name), "Faggio");
        case 463: format(name, sizeof(name), "Freeway");
        case 464: format(name, sizeof(name), "RC Baron");
        case 465: format(name, sizeof(name), "RC Raider");
        case 466: format(name, sizeof(name), "Glendale");
        case 467: format(name, sizeof(name), "Oceanic");
        case 468: format(name, sizeof(name), "Sanchez");
        case 469: format(name, sizeof(name), "Sparrow");
        case 470: format(name, sizeof(name), "Patriot");
        case 471: format(name, sizeof(name), "Quad");
        case 472: format(name, sizeof(name), "Coastguard");
        case 473: format(name, sizeof(name), "Dinghy");
        case 474: format(name, sizeof(name), "Hermes");
        case 475: format(name, sizeof(name), "Sabre");
        case 476: format(name, sizeof(name), "Rustler");
        case 477: format(name, sizeof(name), "ZR-350");
        case 478: format(name, sizeof(name), "Walton");
        case 479: format(name, sizeof(name), "Regina");
        case 480: format(name, sizeof(name), "Comet");
        case 481: format(name, sizeof(name), "BMX");
        case 495: format(name, sizeof(name), "Sandking");
        case 506: format(name, sizeof(name), "Super GT");
        case 521: format(name, sizeof(name), "FCR-900");
        case 522: format(name, sizeof(name), "NRG-500");
        case 533: format(name, sizeof(name), "Feltzer");
        case 555: format(name, sizeof(name), "Windsor");
        case 579: format(name, sizeof(name), "Huntley");
        case 560: format(name, sizeof(name), "Sultan");
        case 589: format(name, sizeof(name), "Club");
        case 541: format(name, sizeof(name), "Bullet");
        case 559: format(name, sizeof(name), "Jester");
        case 536: format(name, sizeof(name), "Blade");
        case 575: format(name, sizeof(name), "Broadway");
        case 534: format(name, sizeof(name), "Remington");
        case 567: format(name, sizeof(name), "Savanna");
        case 535: format(name, sizeof(name), "Slamvan");
        case 603: format(name, sizeof(name), "Phoenix");
 }
    return name;
}
How do I convert this to what your wrote?
Reply
#4

[BUMP]
Reply
#5

pawn Код:
new name[32];
new vID = GetPlayerVehicleID(playerid);
new model = GetVehicleModel(vID);
format(name, sizeof(name), "%s", GetVehicleName(model));
or in short:
pawn Код:
format(name, sizeof(name), "%s", GetVehicleName(GetVehicleModel(GetPlayerVehicleID(playerid))));
or wherever you want to add "name" you don't need to format it, you can just use:
pawn Код:
GetVehicleName(GetVehicleModel(GetPlayerVehicleID(playerid)));
Reply
#6

Quote:
Originally Posted by Ciarannn
Посмотреть сообщение
[BUMP]
Don't convert it, replace it with my script and use it like this
Quote:
Originally Posted by Schneider
Посмотреть сообщение
pawn Код:
new name[32];
new vID = GetPlayerVehicleID(playerid);
new model = GetVehicleModel(vID);
format(name, sizeof(name), "%s", GetVehicleName(model));
or in short:
pawn Код:
format(name, sizeof(name), "%s", GetVehicleName(GetVehicleModel(GetPlayerVehicleID(playerid))));
or wherever you want to add "name" you don't need to format it, you can just use:
pawn Код:
GetVehicleName(GetVehicleModel(GetPlayerVehicleID(playerid))));
Reply
#7

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
Don't convert it, replace it with my script and use it like this
I have to convert it, it's added to a lot of commands in the server.
Reply
#8

You only have to add the code I wrote in each command.

and you have to put the array with all vehicle names as well as the stock function that xVip3rX posted on top of the script.

That GetVehicleName-function does the same as the RVN-function that you originally posted, except with all the cases.
Reply
#9

Here you go, just replace it and you won't have to change other names,
pawn Код:
new static const VehicleNames[][] =
{
    "Landstalker", "Bravura", "Buffalo", "Linerunner", "Pereniel", "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", "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", "ZR3 50", "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", "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", "Trailer", "Kart", "Mower",
    "Duneride", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400", "Newsvan", "Tug", "Trailer A", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club", "Trailer B", "Trailer C", "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"
};

stock RVN(carid)
{
    new VName[30]; format(VName, sizeof(VName), "%s", VehicleNames[GetVehicleModel(carid)-400]);
    return VName;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)