SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 12/04/2009, 05:38 AM   #1
zxcvqw
Little Clucker
 
Join Date: Apr 2009
Posts: 2
Reputation: 0
Default [INC] Display player vehicle name upon entering

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:

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):

Code:
if (newstate == 2)
{
	display_vehicle_name(playerid);
}
zxcvqw is offline   Reply With Quote
Old 12/04/2009, 05:45 AM   #2
G_ROW_Chez
Big Clucker
 
Join Date: Jan 2009
Posts: 94
Reputation: 0
Default Re: [INC] Display player vehicle name upon entering

plagiator =\ and thief
G_ROW_Chez is offline   Reply With Quote
Old 12/04/2009, 05:56 AM   #3
Norn
High-roller
 
Norn's Avatar
 
Join Date: Jul 2008
Location: Northern Ireland
Posts: 2,269
Reputation: 206
Default Re: [INC] Display player vehicle name upon entering

You should still give the unenterable vehicles names, some players enter with PutPlayerInVehicle, and sending a blank string will crash the server.
__________________
Pursuing other endeavours.

Skype: datinvictusguy
Norn is offline   Reply With Quote
Old 12/04/2009, 06:17 AM   #4
RobertGraham
Gangsta
 
Join Date: Mar 2009
Posts: 607
Reputation: 30
Default Re: [INC] Display player vehicle name upon entering

Quote:
Originally Posted by [RD
Chez ]
plagiator =\ and thief
What?
RobertGraham is offline   Reply With Quote
Old 12/04/2009, 06:21 AM   #5
tom_jonez
Huge Clucker
 
Join Date: Dec 2007
Posts: 219
Reputation: 0
Default Re: [INC] Display player vehicle name upon entering

Quote:
Originally Posted by [RD
Chez ]
plagiator =\ and thief
its plagiarizer....
tom_jonez is offline   Reply With Quote
Old 12/04/2009, 06:37 AM   #6
zxcvqw
Little Clucker
 
Join Date: Apr 2009
Posts: 2
Reputation: 0
Default Re: [INC] Display player vehicle name upon entering

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.
zxcvqw is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SetPlayerSkin freezes player if entering vehicle BeckzyBoi Bug Reports 13 13/10/2011 05:48 PM
How to display Player name in this? Ihsan_Cingisiz Help Archive 7 12/06/2010 09:42 AM
/veh destroys vehicle while entering Andy_McKinley Help Archive 6 01/05/2010 03:20 PM
Display Vehicle Id's & Vehicle Flip Command? master000 Help Archive 2 03/03/2010 10:31 PM


All times are GMT. The time now is 02:17 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.