[Little help] With vehicle command
#1

Hey I wanna make this: when a player type /v nrg or anny vehicle that I have added in my pawno, he will automatically in the vehicle that he got choosen.

But I didnt want that a player type /v nrg-500 (that is possible to)
But a player can /v nrg (press to)

Same for the other vehicle's

A player can type /v infernus
or /v inf
or /infer

All he can type, for spawn the choosen vehicle. BUT it must be max 3 letters.

How can I makte that?

I got now this:

PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
new VehicleNames[212][] = {
{
"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"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"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"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"},{"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"},{"Cropdust"},{"Stunt"},
{
"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"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 LA"},{"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 Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
{
"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
{
"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
{
"Trailer 3"},{"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"}
};
//******************************************************************************
// Forwards
//******************************************************************************
forward CarSpawner(playerid,model);
forward VehRes(vehicleid);
forward EraseVeh(vehicleid);
forward InVehTotal();
forward InCarCount();
//****************************************************************************** 
Thanks
Reply
#2

[Edit] Anyone that can help me?

Thanks

mickos0087

[Edit] Sorry i tough I was edit my question
Reply
#3

Well you can change the vehicle names to 1st 3 letters of every vehicle. For Example: Sultan can be wrote as Sul.
Reply
#4

Dunno what you mean exactly, but do you mean you want to have /v spawning the vehicle with the full name of it or a shortcut of it?

If so, you can use strfind function if i am right for the params. of the command
Reply
#5

Now I mean:
/v is the command for spawn a vehicle (and a player will be automatically in)
When a player type /v
He will be see: * Sorry, you must be type /v <name>
Let we do as example an infernus.
When a player type /v infernus, he just spawned a infernus and will be automatically in the infernus.
But a player can type:

/v inf
/v infe
/v infer
/v infern
/v infernu
/v infernus

He can type everything for spawn a vehicle but the player need be max type the first three letters.
For spawn the vehicle that he want.

And how can I make the command /v
Reply
#6

Try this then:

pawn Код:
for(new veh; veh < sizeof(VehicleNames); veh++)
{
    if(strfind(VehicleNames(veh),  params, true) == -1) // Whatever you use for params.
    {
         // Your code of having the player in the vehicle.
    }
}
Reply
#7

Oke thanks I gonna try it +rep
Reply
#8

It didnt work?
0 errors and warnings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)