[Snippet] GetVehicleNameFromModel, GetVehicleType [For Custom, Originals Vehs]

Started by Mahmoud Tornado, Sep 20, 2018, 02:00 PM

Previous topic - Next topic

Mahmoud Tornado

GetVehicleNameFromModel()*
[noae][noae] MessagePlayer("Entered In: "+GetVehicleNameFromModel( player.Vehicle.Model )+".") [/noae][/noae]
[noae][noae]function GetVehicleNameFromModel(model)
{
switch(model)
{
case 130: return "Landstalker";
case 131: return "Idaho";
case 132: return "Stinger";
case 133: return "Linerunner";
case 134: return "Perennial";
case 135: return "Sentinel";
case 136: return "Rio";
case 137: return "Firetruck";
case 138: return "Trashmaster";
case 139: return "Stretch";
case 140: return "Manana";
case 141: return "Infernus";
case 142: return "Voodoo";
case 143: return "Pony";
case 144: return "Mule";
case 145: return "Cheetah #1";
case 146: return "Ambulance";
case 147: return "FBI Washington";
case 148: return "Moonbeam";
case 149: return "Esperanto";
case 150: return "Taxi";
case 151: return "Washington";
case 152: return "Bobcat";
case 153: return "Mr Whoopee";
case 154: return "BF Injection";
case 155: return "Hunter";
case 156: return "Police";
case 157: return "Enforcer";
case 158: return "Securicar";
case 159: return "Banshee";
case 160: return "Predator";
case 161: return "Bus";
case 162: return "Rhino";
case 163: return "Barracks OL";
case 164: return "Cuban Hermes";

case 166: return "Angel";
case 167: return "Coach";
case 168: return "Cabbie";
case 169: return "Stallion";
case 170: return "Rumpo";
case 171: return "RC Bandit";
case 172: return "Romero's Hearse";
case 173: return "Packer";
case 174: return "Sentinel XS";
case 175: return "Admiral";
case 176: return "Squalo";
case 177: return "Sea Sparrow";
case 178: return "Pizza boy";
case 179: return "Gang Burrito";

case 182: return "Speeder";
case 183: return "Reefer";
case 184: return "Tropic";
case 185: return "Flatbed";
case 186: return "Yankee";
case 187: return "Caddy";
case 188: return "Zebra Cab";
case 189: return "Top Fun";
case 190: return "Skimmer";
case 191: return "PCJ 600";
case 192: return "Faggio";
case 193: return "Freeway";
case 194: return "RC Baron";
case 195: return "RC Raider";
case 196: return "Glendale";
case 197: return "Oceanic";
case 198: return "Sanchez";
case 199: return "Sparrow";
case 200: return "Patriot";
case 201: return "Love Fist";
case 202: return "Coast Guard";
case 203: return "Dinghy";
case 204: return "Hermes";
case 205: return "Sabre";
case 206: return "Sabre Turbo";
case 207: return "Phoenix";
case 208: return "Walton";
case 209: return "Regina";
case 210: return "Comet";
case 211: return "Deluxo";
case 212: return "Burrito";
case 213: return "Spand Express";
case 214: return "Marquis";
case 215: return "Baggage Handler";
case 216: return "Kaufman Cab";
case 217: return "Maverick";
case 218: return "VCN Maverick";
case 219: return "Rancher";
case 220: return "FBI Rancher";
case 221: return "Virgo";
case 222: return "Greenwood";
case 223: return "Cuban Jetmax";
case 224: return "Hotring Racer #1";
case 225: return "Sandking";
case 226: return "Blista Compact";
case 227: return "Police Maverick";
case 228: return "Boxville";
case 229: return "Benson";
case 230: return "Mesa Grande";
case 231: return "RC Goblin";
case 232: return "Hotring Racer #2";
case 233: return "Hotring Racer #3";
case 234: return "Bloodring Banger #1";
case 235: return "Bloodring Banger #2";
case 236: return "Cheetah #2";

case 6400: return " "; //For the first custom car.
default: return "Name not specified";
}
}
[/noae][/noae]

GetVehicleType()*
[noae][noae] MessagePlayer("Entered In: "+GetVehicleType( player.Vehicle.Model )+".") [/noae][/noae]
[noae][noae]function GetVehicleType( model )
{
        switch ( model ) {
                case 166:
                case 178:
                case 191:
                case 192:
                case 193:
                case 198:
                        return "Bike";
                case 155:
                case 165:
                case 217:
                case 218:
                case 227:
                        return "Heli";
                case 180:
                case 181:
                        return "Plane";
                case 136:
                case 160:
                case 176:
                case 182:
                case 183:
                case 184:
                case 190:
                case 202:
                case 203:
                case 214:
                case 223:
                        return "Boat";
                case 171:
                case 194:
                case 195:
                case 231:
                        return "RC";
                case 6400:
                        return "Special Model";
                default:
                        return "Car";
        }
}
[/noae][/noae]

=RK=MarineForce

#1
Mahmoud Tornado You Scripts Nice.
Mahmoud Tornado How can i make Custom Markers? can u make it? like CvH

Some Commands(xD) This is First Time i make a Vehicle Command without copy cat xD

else if ( cmd == "car" )
{
if(!text) MessagePlayer("[#ff0000]Error - /" + cmd + " <Nick> ",player);
else{
local plr = FindPlayer(text);
if(!plr) MessagePlayer(" [#FF0000] Error- " + text + " is not online",player);
if(!player.Vehicle) MessagePlayer(" [#FF0000] Error - " + plr.Name + " is not driving car ",player);
else{
MessagePlayer(" [#00ccff] " + plr.Name + " Vehicle "+GetVehicleType( plr.Vehicle.Model )+" "+GetVehicleNameFromModel( plr.Vehicle.Model )+" ID " + veh.ID + " ",player);
}
}
}

else if ( cmd == "getcar" )
{
if ( stats[ player.ID ].level < 3 ) PrivMessage( player, "Error: You are not authorized to use this command." );
else{
if ( !text ) MessagePlayer( "Syntax, /" + cmd + " <ID>", player );
else {
local veh = FindVehicle( text.tointeger() );
veh.Pos = Vector( ( player.Pos.x ), player.Pos.y, ( player.Pos.z ) );
Message( "[#FFbb00]** Admin " + player.Name + " Spawned "+GetVehicleType( veh.Model )+" "+GetVehicleNameFromModel( veh.Model )+"  ID " + veh.ID + " ");
}
}
}

else if ( cmd == "gotocar" )
{
if(!text) MessagePlayer(" /"+cmd+" <ID> ",player);
else{
local veh = FindVehicle( text.tointeger() );
player.Pos = Vector( ( veh.Pos.x ), veh.Pos.y, ( veh.Pos.z ) );
}
}

else if ( cmd == "gotocar" )
{
if(!text) MessagePlayer(" /"+cmd+" <ID> ",player);
else{
local veh = FindVehicle( text.tointeger() );
player.Pos = Vector( ( veh.Pos.x ), veh.Pos.y, ( veh.Pos.z ) );
Message( "[#FFbb00]** Admin " + player.Name + " Goto "+GetVehicleType( veh.Model )+" "+GetVehicleNameFromModel( veh.Model )+"  ID " + veh.ID + " ");
}
}

Xmair

You could just..
oldGetAutomobileModel <- GetVehicleNameFromModel;
function GetVehicleNameFromModel( intModel ) {
switch( intModel ) {
case 6400:
return "Custom vehicle #1";
break;

case 6401:
return "Custom vehicle #2";
break;

// And so on

default:
return oldGetAutomobileModel( intModel );
break;
}
}

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

=RK=MarineForce

@xmair its only for customs vehicle? hmm nyc.

Xmair

No it can work with both.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD