[Include] [INC] Display player vehicle name upon entering
#1

Yes, I understand that this is very easy to code. I also understand that similar code is probably easily found elsewhere. But I generally prefer to create my own scripts, and because I needed this, well, here it is. It does nothing more than display the name of a vehicle after a player enters it. Hopefully it saves someone some time.

Edit: If you discover any error with the vehicle names (I can guarantee there's at least one), please let me know.


Main code:

Код:
new g_vehicle_names[][18] =
{
	//blank strings represent unenterable vehicles
	"Landstalker",
	"Bravura",
	"Buffalo",
	"Linerunner",
	"Perennial",
	"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",
	"",
	"Previon",
	"Coach",
	"Cabbie",
	"Stallion",
	"Rumpo",
	"",
	"Romero",
	"Packer",
	"Monster",
	"Admiral",
	"Squallo",
	"Seasparrow",
	"Pizza Boy",
	"",
	"",
	"Turismo",
	"Speeder",
	"Reefer",
	"Tropic",
	"Flatbed",
	"Yankee",
	"Caddy",
	"Solair",
	"Berkley's RC Van",
	"Skimmer",
	"PCJ-600",
	"Faggio",
	"Freeway",
	"",
	"",
	"Glendale",
	"Oceanic",
	"Sanchez",
	"Sparrow",
	"Patriot",
	"Quadbike",
	"Coastguard",
	"Dinghy",
	"Hermes",
	"Sabre",
	"Rustler",
	"ZR-350",
	"Walton",
	"Regina",
	"Comet",
	"BMX",
	"Burrito",
	"Camper",
	"Marquis",
	"Baggage",
	"Dozer",
	"Maverick",
	"SAN News Maverick",
	"Rancher",
	"FBI Rancher",
	"Virgo",
	"Greenwood",
	"Jetmax",
	"Hotring Racer",
	"Sandking",
	"Blista Compact",
	"Police Maverick",
	"Boxville",
	"Benson",
	"Mesa",
	"",
	"Hotring Racer",
	"Hotring Racer",
	"Bloodring Banger",
	"Rancher",
	"Super GT",
	"Elegant",
	"Journey",
	"Bike",
	"Mountain Bike",
	"Beagle",
	"Cropduster",
	"Stuntplane",
	"Tanker",
	"Roadtrain",
	"Nebula",
	"Majestic",
	"Buccaneer",
	"Shamal",
	"Hydra",
	"FCR-900",
	"NRG-500",
	"HPV-1000",
	"Cement Truck",
	"Tow Truck",
	"Fortune",
	"Cadrona",
	"FBI Truck",
	"Willard",
	"Forklift",
	"Tractor",
	"Combine Harvester",
	"Feltzer",
	"Remington",
	"Slamvan",
	"Blade",
	"Freight",
	"Brown Streak",
	"Vortex",
	"Vincent",
	"Bullet",
	"Clover",
	"Sadler",
	"Fire Truck",
	"Hustler",
	"Intruder",
	"Primo",
	"Cargobob",
	"Tampa",
	"Sunrise",
	"Merit",
	"Utility Van",
	"Nevada",
	"Yosemite",
	"Windsor",
	"Monster",
	"Monster",
	"Uranus",
	"Jester",
	"Sultan",
	"Stratum",
	"Elegy",
	"Raindance",
	"",
	"Flash",
	"Tahoma",
	"Savanna",
	"Bandito",
	"",
	"",
	"Kart",
	"Mower",
	"Dune",
	"Sweeper",
	"Broadway",
	"Tornado",
	"AT400",
	"DFT-30",
	"Huntley",
	"Stafford",
	"BF-400",
	"News Van",
	"Tug",
	"",
	"Emperor",
	"Wayfarer",
	"Euros",
	"Hotdog",
	"Club",
	"",
	"",
	"Andromada",
	"Dodo",
	"",
	"Launch",
	"Police Car", //Los Santos
	"Police Car", //San Fierro
	"Police Car", //Las Venturas
	"Ranger",
	"Picador",
	"SWAT Tank",
	"Alpha",
	"Phoenix",
	"Glendale",
	"Sadler",
	"",
	"",
	"",
	"Boxburg"
};

display_vehicle_name(player_id)
{
	new vehicle_id = GetPlayerVehicleID(player_id);
	new vehicle_index = GetVehicleModel(vehicle_id) - 400;
	GameTextForPlayer(player_id, g_vehicle_names[vehicle_index], 6000, 1);
}
Usage code (to be inserted into OnPlayerStateChange):

Код:
if (newstate == 2)
{
	display_vehicle_name(playerid);
}
Reply
#2

plagiator =\ and thief
Reply
#3

You should still give the unenterable vehicles names, some players enter with PutPlayerInVehicle, and sending a blank string will crash the server.
Reply
#4

Quote:
Originally Posted by [RD
Chez ]
plagiator =\ and thief
What?
Reply
#5

Quote:
Originally Posted by [RD
Chez ]
plagiator =\ and thief
its plagiarizer....
Reply
#6

Quote:
Originally Posted by [RD
Chez ]
plagiator =\ and thief
Really? Do you think it's my goal to attain godlike status on the Internet by passing simple scripts off as my own? I coded this last night for my server, and posted it here with the intention of maybe helping someone. I'm assuming you skipped right over the disclaimer that reads, "I also understand that similar code is probably easily found elsewhere."

Quote:
Originally Posted by Norn
You should still give the unenterable vehicles names, some players enter with PutPlayerInVehicle, and sending a blank string will crash the server.
I appreciate your bringing this to my attention. I just tested it, and my server did in fact crash when sent a blank string. Originally I had the unenterable vehicles named "UNENTERABLE," but I figured that this was simply a waste of space. The thing is, the vehicles that can't be entered would probably hardly ever be entered, even through irregular means (eg., trailers), although RC vehicles are always a possibility. I suppose I'll go through and add in the names, just for good measure.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)