Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ___ _____ _ _
- |_ | / __ \ | | (_)
- | | _____ _| / \/ __ _ _ __ | |_ __ _ _ _ __
- | |/ _ \ \ /\ / / | / _` | '_ \| __/ _` | | '_ \
- /\__/ / __/\ V V /| \__/\ (_| | |_) | || (_| | | | | |
- \____/ \___| \_/\_/ \____/\__,_| .__/ \__\__,_|_|_| |_|
- | |
- |_|
- ==========================================================
- JewCaptain's Vehicle Spawner:
- Creation Date: 08/06/2012
- Version: 0.1
- -------------------------------
- Copyrights:
- -------------------------------
- Created by JewCaptain (CptK as in SA-MP forums), for public server usage. All copyrights reserved ©.
- You are NOT allowed to remove those credits.
- ==========================================================
- */
- //==========================================================
- #include <a_samp>
- //==========================================================
- #define VERSION "0.1"
- // Change dialog ids if it interrupt with other dialog ids
- #define DIALOG_MSG 500 // Messages
- #define DIALOG_SPAWNER 501 // Main spawner menu
- #define DIALOG_SPAWNER_1 502 // By ID
- #define DIALOG_SPAWNER_2 503 // By name
- //==========================================================
- new VehNames[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"},{"Rhino"},{"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"},{"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 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"}
- };
- //==========================================================
- public OnFilterScriptInit()
- {
- print("\n==========================================================");
- print(" JewCaptain's Vehicle Spawner V"VERSION" has been successfully loaded.");
- print("==========================================================\n");
- return 1;
- }
- //==========================================================
- public OnPlayerCommandText(playerid, cmdtext[]) // Not using any command processor because there's no need for params, and it's a pretty basic script with just one command
- {
- if (!strcmp(cmdtext, "/jcspawner", true))
- {
- if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You are not authorized to use this command!"); // Delete this line if you want all the players to be able to use the spawner
- ShowPlayerDialog(playerid, DIALOG_SPAWNER, DIALOG_STYLE_LIST, "{FFFFFF}JC's Spawner", "{FFFFFF}By ID\nBy Name", "Select", "Cancel");
- return 1;
- }
- return 0;
- }
- //==========================================================
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch (dialogid)
- {
- case DIALOG_SPAWNER: // Main menu
- {
- if (response)
- {
- if (listitem == 0) // By ID
- ShowPlayerDialog(playerid, DIALOG_SPAWNER_1, DIALOG_STYLE_INPUT, "{FFFFFF}JC's Spawner", "{FFFFFF}Type in a vehicle ID to spawn (400-611):", "Spawn", "Cancel");
- else if (listitem == 1) // By name
- ShowPlayerDialog(playerid, DIALOG_SPAWNER_2, DIALOG_STYLE_INPUT, "{FFFFFF}JC's Spawner", "{FFFFFF}Type in a vehicle name to spawn:", "Spawn", "Cancel");
- }
- return 1;
- }
- case DIALOG_SPAWNER_1: // By ID
- {
- if (response)
- {
- if (!strlen(inputtext) || strval(inputtext) < 400 || strval(inputtext) > 611) return ShowPlayerDialog(playerid, DIALOG_SPAWNER_1, DIALOG_STYLE_INPUT, "{FFFFFF}JC's Spawner", "{FF0000}Invalid vehicle ID!\n{FFFFFF}Type in a vehicle ID to spawn (400-611):", "Spawn", "Cancel");
- new CarSpawn, Float:pos[4];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- GetPlayerFacingAngle(playerid, pos[3]);
- CarSpawn = CreateVehicle(strval(inputtext), pos[0], pos[1], pos[2], pos[3], 0, 0, 999999);
- PutPlayerInVehicle(playerid, CarSpawn, 0);
- SendClientMessage(playerid, 0x33AA33AA, "The vehicle has been successfully spawned!");
- }
- return 1;
- }
- case DIALOG_SPAWNER_2: // By Name
- {
- if (response)
- {
- if (!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_SPAWNER_2, DIALOG_STYLE_INPUT, "{FFFFFF}JC's Spawner", "{FF0000}Invalid vehicle name!\n{FFFFFF}Type in a vehicle name to spawn:", "Spawn", "Cancel");
- new bool:found, carid;
- for (new i; i < sizeof(VehNames); i++)
- {
- if (!strcmp(VehNames[i], inputtext, true))
- {
- carid = i + 400;
- found = true;
- }
- if (i == sizeof(VehNames) + 1)
- found = false;
- }
- if (found != true) return ShowPlayerDialog(playerid, DIALOG_SPAWNER_2, DIALOG_STYLE_INPUT, "{FFFFFF}JC's Spawner", "{FF0000}Invalid vehicle name!\n{FFFFFF}Type in a vehicle name to spawn:", "Spawn", "Cancel");
- new CarSpawn, Float:pos[4];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- GetPlayerFacingAngle(playerid, pos[3]);
- CarSpawn = CreateVehicle(carid, pos[0], pos[1], pos[2], pos[3], 0, 0, 999999);
- PutPlayerInVehicle(playerid, CarSpawn, 0);
- SendClientMessage(playerid, 0x33AA33AA, "The vehicle has been successfully spawned!");
- }
- return 1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement