SA-MP Forums Archive
/veh help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /veh help. (/showthread.php?tid=311041)



/veh help. - nogh445 - 14.01.2012

Here is my /veh code.

pawn Код:
CMD:veh(playerid, params[])
{
    new vehicleid, color1, color2;
    if(!sscanf(params, "iii", vehicleid, color1, color2))
    {
        new vin;
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        vin=CreateVehicle(vehicleid, x, y, z, 0.0, color1, color2, -1);
        PutPlayerInVehicle(playerid, vin, 0);
    }else{
        SendClientMessage(playerid, COLOR_PURPLE, "ERROR: This command requires: /veh [vehicleid][color1][color2]");
    }
    return 1;
}
I would like to have it to where instead of /veh ID COLOR COLOR it can be /veh CARNAME COLOR COLOR.

I have found this in another script my friend gave me and I was wondering how I could use this or something similar in mine.
pawn Код:
new VehNames[][] =
{
   "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",   "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",   "Hotring Racer",   "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",   "Monster",   "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",   "Emperor",   "Wayfarer",
   "Euros",   "Hotdog",   "Club",   "Trailer",   "Trailer",   "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",
   "Luggage Trailer",   "Stair Trailer",   "Boxville",   "Farm Plow",   "Utility Trailer"



Re: /veh help. - BleverCastard - 14.01.2012

Well, if you have that defined, and you know the name of the vehicle, you can use this command:
Код:
CMD:vehname(playerid, params[]) {

	if(playerVariables[playerid][pAdminLevel] >= 3) {

		SendClientMessage(playerid, COLOR_TEAL, "--------------------------------------------------------------------------------------------------------------------------------");
		SendClientMessage(playerid, COLOR_WHITE, "Vehicle Search:");

		new
			rcount,
			string[128];

		if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "No keyword specified.");
		if(strlen(params) < 3) return SendClientMessage(playerid, COLOR_GREY, "Search keyword too short.");

		for(new v; v < sizeof(VehicleNames); v++) {
			if(strfind(VehicleNames[v], params, true) != -1) {

				if(rcount == 0) format(string, sizeof(string), "%s (ID %d)", VehicleNames[v], v+400);
				else format(string, sizeof(string), "%s | %s (ID %d)", string, VehicleNames[v], v+400);

				rcount++;
			}
		}

		if(rcount == 0) SendClientMessage(playerid, COLOR_GREY, "No results found.");

		else if(strlen(string) >= 128) SendClientMessage(playerid, COLOR_GREY, "Too many results found.");

		else SendClientMessage(playerid, COLOR_WHITE, string);

		SendClientMessage(playerid, COLOR_TEAL, "--------------------------------------------------------------------------------------------------------------------------------");
	}
	return 1;
}



Re: /veh help. - BleverCastard - 14.01.2012

Forget him he is a troller, Look at the command I posted.


Re: /veh help. - BleverCastard - 14.01.2012

Did the command help Nogh?


Re: /veh help. - nogh445 - 14.01.2012

Quote:
Originally Posted by [MP]Ditch
Посмотреть сообщение
Did the command help Nogh?
The spacing and brackets are a bit whack. I'm trying to figure out the loose indentation problems.


Re: /veh help. - BleverCastard - 14.01.2012

Post the errors here.
I dont seem to get any errors.


Re: /veh help. - nogh445 - 14.01.2012

I'v messed with it a bit so it might be a little wrong. I'm only a beginner. :P

pawn Код:
CMD:vehname(playerid, params[])  
{

        SendClientMessage(playerid, COLOR_TEAL, "--------------------------------------------------------------------------------------------------------------------------------");
        SendClientMessage(playerid, COLOR_WHITE, "Vehicle Search:");

        new
            rcount,
            string[128];

        if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "No keyword specified.");
        if(strlen(params) < 3) return SendClientMessage(playerid, COLOR_GREY, "Search keyword too short.");
        {
        for(new v; v < sizeof(VehNames); v++) {
            if(strfind(VehNames[v], params, true) != -1) {
            {
                if(rcount == 0) format(string, sizeof(string), "%s (ID %d)", VehNames[v], v+400);
                else format(string, sizeof(string), "%s | %s (ID %d)", string, VehNames[v], v+400);

                rcount++;
            }
            if(rcount == 0) SendClientMessage(playerid, COLOR_GREY, "No results found.");

            else if(strlen(string) >= 128) SendClientMessage(playerid, COLOR_GREY, "Too many results found.");

            else SendClientMessage(playerid, COLOR_WHITE, string);

            SendClientMessage(playerid, COLOR_TEAL, "--------------------------------------------------------------------------------------------------------------------------------");
        }
        return 1; // line 759
}
..... For some reason it is affecting another CMD: line.....
pawn Код:
CMD:adminpack(playerid, params[])    // line 761
{
    if(!IsPlayerAdmin(playerid))return 0;
    GivePlayerWeapon(playerid, 38, 10000 );
    SetPlayerArmour(playerid, 10000 );
    SetPlayerHealth(playerid, 10000 );
    return 1;
}
Errors:
Код:
C:\Users\user\Desktop\Kush Mania\pawno\KM.pwn(759) : warning 217: loose indentation
C:\Users\user\Desktop\Kush Mania\pawno\KM.pwn(761) : warning 217: loose indentation
C:\Users\user\Desktop\Kush Mania\pawno\KM.pwn(761) : error 029: invalid expression, assumed zero
C:\Users\user\Desktop\Kush Mania\pawno\KM.pwn(761) : error 017: undefined symbol "cmd_adminpack"
C:\Users\user\Desktop\Kush Mania\pawno\KM.pwn(761) : error 029: invalid expression, assumed zero
C:\Users\user\Desktop\Kush Mania\pawno\KM.pwn(761) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: /veh help. - BleverCastard - 14.01.2012

pawn Код:
CMD:vehname(playerid, params[]) {

    if(playerVariables[playerid][pAdminLevel] >= 3) {

        SendClientMessage(playerid, COLOR_TEAL, "--------------------------------------------------------------------------------------------------------------------------------");
        SendClientMessage(playerid, COLOR_WHITE, "Vehicle Search:");

        new
            rcount,
            string[128];

        if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "No keyword specified.");
        if(strlen(params) < 3) return SendClientMessage(playerid, COLOR_GREY, "Search keyword too short.");

        for(new v; v < sizeof(VehicleNames); v++) {
            if(strfind(VehicleNames[v], params, true) != -1) {

                if(rcount == 0) format(string, sizeof(string), "%s (ID %d)", VehicleNames[v], v+400);
                else format(string, sizeof(string), "%s | %s (ID %d)", string, VehicleNames[v], v+400);

                rcount++;
            }
        }

        if(rcount == 0) SendClientMessage(playerid, COLOR_GREY, "No results found.");

        else if(strlen(string) >= 128) SendClientMessage(playerid, COLOR_GREY, "Too many results found.");

        else SendClientMessage(playerid, COLOR_WHITE, string);

        SendClientMessage(playerid, COLOR_TEAL, "--------------------------------------------------------------------------------------------------------------------------------");
    }
    return 1;
}
Show me the errors you get without ANY Changes made. Also, What script are you using?


Re: /veh help. - nogh445 - 14.01.2012

Look at my last post up there^

Ohh.. And i've made this script from scratch.


Re: /veh help. - BleverCastard - 14.01.2012

@Vincee, No wonder you just troll, you have no idea on how to Script at all...