Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Completely redesigned from scratch. //
- // @ Project Developer : Alexis1999 //
- // Vehicle Control System //
- #include <a_samp>
- #if defined _samp_include
- #endinput
- #endif
- #define _samp_include
- new VCNames[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"}
- };
- stock VehicleControl(playerid, String[]) {
- if(!strcmp(String, "ActivateEngine")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(Vehicle, 1, lights, alarm, doors, bonnet, boot, objective);
- }
- }
- else if(!strcmp(String, "DeactivateEngine")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(Vehicle, 0, lights, alarm, doors, bonnet, boot, objective);
- }
- }
- else if(!strcmp(String, "ActivateLights")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine2, lights2, alarm2, doors2, bonnet2, boot2, objective2;
- GetVehicleParamsEx(Vehicle, engine2, lights2, alarm2, doors2, bonnet2, boot2, objective2);
- SetVehicleParamsEx(Vehicle, engine2, 1, alarm2, doors2, bonnet2, boot2, objective2);
- }
- }
- else if(!strcmp(String, "DeactivateLights")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine2, lights2, alarm2, doors2, bonnet2, boot2, objective2;
- GetVehicleParamsEx(Vehicle, engine2, lights2, alarm2, doors2, bonnet2, boot2, objective2);
- SetVehicleParamsEx(Vehicle, engine2, 0, alarm2, doors2, bonnet2, boot2, objective2);
- SendClientMessage(playerid, -1, "test24");
- }
- }
- else if(!strcmp(String, "EnableAlarm")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(Vehicle, engine, lights, 1, doors, bonnet, boot, objective);
- }
- }
- else if(!strcmp(String, "DisableAlarm")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(Vehicle, engine, lights, 0, doors, bonnet, boot, objective);
- }
- }
- else if(!strcmp(String, "UnlockVehicle")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(Vehicle, engine, lights, alarm, 0, bonnet, boot, objective);
- }
- }
- else if(!strcmp(String, "LockVehicle")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(Vehicle, engine, lights, alarm, 1, bonnet, boot, objective);
- }
- }
- else if(!strcmp(String, "OpenBonnet")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, 1, boot, objective);
- }
- }
- else if(!strcmp(String, "CloseBonnet")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, 0, boot, objective);
- }
- }
- else if(!strcmp(String, "OpenBoot")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, 1, objective);
- }
- }
- else if(!strcmp(String, "CloseBoot")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, 0, objective);
- }
- }
- else if(!strcmp(String, "DeleteVehicle")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- DestroyVehicle(Vehicle);
- }
- }
- else {
- SendClientMessage(playerid, -1, "{00FF99}Vehicle Control | {FFFFFF}Undefined Action Name ( VehicleControl ) KK?");
- }
- }
- stock VCBool(playerid, String[]) {
- if(!strcmp(String, "IsVehicleEngineOn")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- if(engine == 1) return 1;
- else return 0;
- }
- }
- else if(!strcmp(String, "IsVehicleLightsOn")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- if(lights == 1) return 1;
- else return 0;
- }
- }
- else if(!strcmp(String, "IsVehicleBonnetOpen")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- if(bonnet == 1) return 1;
- else return 0;
- }
- }
- else if(!strcmp(String, "IsVehicleBootOpen")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- if(boot == 1) return 1;
- else return 0;
- }
- }
- else if(!strcmp(String, "IsVehicleAlarmOn")) {
- new Vehicle = GetPlayerVehicleID(playerid);
- if(IsPlayerInVehicle(playerid, Vehicle)) {
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(Vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
- if(alarm == 1) return 1;
- else return 0;
- }
- }
- else {
- SendClientMessage(playerid, -1, "{00FF99}Vehicle Control Issue {FFFFFF}| Undefined Bool ( VCBool )");
- }
- return 1;
- }
- stock VCCreate(playerid, VCName[], ColorA, ColorB) {
- new Vehicle = ConvertToVehicleID(VCName);
- new Float: Pos[3];
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
- if(Vehicle != 0 && Vehicle >= 400 && Vehicle <= 611) {
- CreateVehicle(Vehicle, Pos[0], Pos[1], Pos[2], 0, ColorA, ColorB, 0);
- } else return SendClientMessage(playerid, -1, "Undefined Vehicle ( VCCreate )");
- return 1;
- }
- stock VCCreateEx(playerid, VCFormat[], Vehicle[], ColorA, ColorB) {
- format(VCFormat, 128, "%s", Vehicle);
- new Float: Pos[3];
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
- if(!IsNumeric(Vehicle)) {
- new VehicleEx = ConvertToVehicleID(Vehicle);
- if(VehicleEx != 0 && VehicleEx >= 400 && VehicleEx <= 611) {
- CreateVehicle(VehicleEx, Pos[0], Pos[1], Pos[2], 0, ColorA, ColorB, 0);
- }
- } else {
- if(strval(Vehicle) != 0 && strval(Vehicle) >= 400 && strval(Vehicle) <= 611) {
- CreateVehicle(strval(Vehicle), Pos[0], Pos[1], Pos[2], 0, ColorA, ColorB, 0);
- }
- }
- return 1;
- }
- stock IsNumeric( string[ ] ) { for (new i = 0, j = strlen( string); i < j; i++) if ( string[i] > '9' || string[i] < '0') return 0; return 1; }
- stock ConvertToVehicleID(VCName[]) {
- for(new j = 0; j < 211; j++) {
- if(strfind(VCNames[j], VCName, true) != -1)
- return j + 400;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement