Guest User

Car Spawn By Falco3205

a guest
Feb 11th, 2013
700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.92 KB | None | 0 0
  1. /*Car Spawner  By Falco3205*/
  2. #define FILTERSCRIPT
  3.  
  4. #include <a_samp>
  5.  
  6. public OnFilterScriptInit()
  7. {
  8.         print("\n--------------------------------------");
  9.         print(" Car Spawner By Falco3205 scripter LOADED!");
  10.         print("--------------------------------------\n");
  11.         return 1;
  12. }
  13.  
  14. public OnFilterScriptExit()
  15. {
  16.     print("\n--------------------------------------");
  17.         print(" Car Spawner By Falco3205 scripter UN-LOADED!");
  18.         print("--------------------------------------\n");
  19.         return 1;
  20. }
  21. new VehicleName[][] = {
  22.    "Landstalker",
  23.    "Bravura",
  24.    "Buffalo",
  25.    "Linerunner",
  26.    "Perennial",
  27.    "Sentinel",
  28.    "Dumper",
  29.    "Firetruck",
  30.    "Trashmaster",
  31.    "Stretch",
  32.    "Manana",
  33.    "Infernus",
  34.    "Voodoo",
  35.    "Pony",
  36.    "Mule",
  37.    "Cheetah",
  38.    "Ambulance",
  39.    "Leviathan",
  40.    "Moonbeam",
  41.    "Esperanto",
  42.    "Taxi",
  43.    "Washington",
  44.    "Bobcat",
  45.    "MrWhoopee",
  46.    "BFInjection",
  47.    "Hunter",
  48.    "Premier",
  49.    "Enforcer",
  50.    "Securicar",
  51.    "Banshee",
  52.    "Predator",
  53.    "Bus",
  54.    "Rhino",
  55.    "Barracks",
  56.    "Hotknife",
  57.    "Trailer",
  58.    "Previon",
  59.    "Coach",
  60.    "Cabbie",
  61.    "Stallion",
  62.    "Rumpo",
  63.    "RCBandit",
  64.    "Romero",
  65.    "Packer",
  66.    "Monster",
  67.    "Admiral",
  68.    "Squalo",
  69.    "Seasparrow",
  70.    "Pizzaboy",
  71.    "Tram",
  72.    "Trailer",
  73.    "Turismo",
  74.    "Speeder",
  75.    "Reefer",
  76.    "Tropic",
  77.    "Flatbed",
  78.    "Yankee",
  79.    "Caddy",
  80.    "Solair",
  81.    "RCVan",
  82.    "Skimmer",
  83.    "PCJ600",
  84.    "Faggio",
  85.    "Freeway",
  86.    "RCBaron",
  87.    "RCRaider",
  88.    "Glendale",
  89.    "Oceanic",
  90.    "Sanchez",
  91.    "Sparrow",
  92.    "Patriot",
  93.    "Quad",
  94.    "Coastguard",
  95.    "Dinghy",
  96.    "Hermes",
  97.    "Sabre",
  98.    "Rustler",
  99.    "ZR350",
  100.    "Walton",
  101.    "Regina",
  102.    "Comet",
  103.    "BMX",
  104.    "Burrito",
  105.    "Camper",
  106.    "Marquis",
  107.    "Baggage",
  108.    "Dozer",
  109.    "Maverick",
  110.    "NewsChopper",
  111.    "Rancher",
  112.    "FBIRancher",
  113.    "Virgo",
  114.    "Greenwood",
  115.    "Jetmax",
  116.    "Hotring",
  117.    "Sandking",
  118.    "BlistaCompact",
  119.    "PoliceMaverick",
  120.    "Boxville",
  121.    "Benson",
  122.    "Mesa",
  123.    "RCGoblin",
  124.    "HotringA",
  125.    "HotringB",
  126.    "BloodringBanger",
  127.    "Rancher",
  128.    "SuperGT",
  129.    "Elegant",
  130.    "Journey",
  131.    "Bike",
  132.    "MountainBike",
  133.    "Beagle",
  134.    "Cropdust",
  135.    "Stunt",
  136.    "Tanker",
  137.    "RoadTrain",
  138.    "Nebula",
  139.    "Majestic",
  140.    "Buccaneer",
  141.    "Shamal",
  142.    "Hydra",
  143.    "FCR900",
  144.    "NRG500",
  145.    "HPV1000",
  146.    "CementTruck",
  147.    "TowTruck",
  148.    "Fortune",
  149.    "Cadrona",
  150.    "FBITruck",
  151.    "Willard",
  152.    "Forklift",
  153.    "Tractor",
  154.    "Combine",
  155.    "Feltzer",
  156.    "Remington",
  157.    "Slamvan",
  158.    "Blade",
  159.    "Freight",
  160.    "Streak",
  161.    "Vortex",
  162.    "Vincent",
  163.    "Bullet",
  164.    "Clover",
  165.    "Sadler",
  166.    "Firetruck",
  167.    "Hustler",
  168.    "Intruder",
  169.    "Primo",
  170.    "Cargobob",
  171.    "Tampa",
  172.    "Sunrise",
  173.    "Merit",
  174.    "Utility",
  175.    "Nevada",
  176.    "Yosemite",
  177.    "Windsor",
  178.    "MonsterA",
  179.    "MonsterB",
  180.    "Uranus",
  181.    "Jester",
  182.    "Sultan",
  183.    "Stratum",
  184.    "Elegy",
  185.    "Raindance",
  186.    "RCTiger",
  187.    "Flash",
  188.    "Tahoma",
  189.    "Savanna",
  190.    "Bandito",
  191.    "Freight",
  192.    "Trailer",
  193.    "Kart",
  194.    "Mower",
  195.    "Duneride",
  196.    "Sweeper",
  197.    "Broadway",
  198.    "Tornado",
  199.    "AT400",
  200.    "DFT30",
  201.    "Huntley",
  202.    "Stafford",
  203.    "BF400",
  204.    "Newsvan",
  205.    "Tug",
  206.    "Trailer",
  207.    "Emperor",
  208.    "Wayfarer",
  209.    "Euros",
  210.    "Hotdog",
  211.    "Club",
  212.    "Trailer",
  213.    "Trailer",
  214.    "Andromada",
  215.    "Dodo",
  216.    "RCCam",
  217.    "Launch",
  218.    "LSPD",
  219.    "SFPD",
  220.    "LVPD",
  221.    "PoliceRanger",
  222.    "Picador",
  223.    "SWAT",
  224.    "Alpha",
  225.    "Phoenix",
  226.    "Glendale",
  227.    "Sadler",
  228.    "Trailer1",
  229.    "Trailer2",
  230.    "Trailer3",
  231.    "Boxville",
  232.    "FarmPlow",
  233.    "UtilityTrailer"
  234. };
  235.  
  236. stock GetVehicleIDFromName(modelname[]) {
  237.   for (new i = 400; i <= 611; i++) {
  238.     if (strcmp(modelname, VehicleName[i-400], true) == 0) {
  239.       return i;
  240.     }
  241.   }
  242.   return 0;
  243. }
  244.  
  245.  
  246.  
  247. public OnPlayerCommandText(playerid, cmdtext[])
  248. {
  249. new tmp[256];
  250. new cmd[256], idx; cmd = strtok(cmdtext, idx);
  251. new stringa[256];
  252. if(strcmp(cmd,"/car", true)== 0)
  253. {
  254.   new Float:vx, Float:vy, Float:vz, vid;
  255.   tmp = strtok(cmdtext, idx);
  256.   if (!strlen(tmp)) return SendClientMessage(playerid, 0x00D90044, "/car [vehicleid/nome]");
  257.   if (IsNumeric(tmp) == 1)
  258.   {
  259.     vid = strval(tmp);
  260.   } else {
  261.     vid = GetVehicleIDFromName(tmp);
  262.   }
  263.   if ((vid < 400) || (vid > 611) || (vid == 590) || (vid == 569) || (vid == 570) || (vid == 537) || (vid == 538) || (vid == 449))
  264.   {
  265.     return SendClientMessage(playerid, 0x00D90044, "Veicolo non riconosciuto.");
  266.   }
  267.   else
  268.   {
  269.     GetPlayerPos(playerid, vx, vy, vz);
  270.     CreateVehicle(vid, vx + random(9) - 4, vy + random(9) - 4, vz, 0, -1, -1, -1);
  271.     new car = GetPlayerVehicleID(playerid);
  272.     format(stringa,sizeof(stringa),"{FF0A00}T{FFFFFF}B{00FF1E}D{FFFFFF} %d",random(999));
  273.     SetVehicleNumberPlate(car, stringa);
  274.     SendClientMessage(playerid, 0xffffffff, "Auto Spawnata");
  275.         return 1;
  276. }
  277. }
  278. return 0;
  279. }
  280.  
  281. strtok(const string[], &index)
  282. {
  283.         new length = strlen(string);
  284.         while ((index < length) && (string[index] <= ' '))
  285.         {
  286.                 index++;
  287.         }
  288.  
  289.         new offset = index;
  290.         new result[20];
  291.         while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  292.         {
  293.                 result[index - offset] = string[index];
  294.                 index++;
  295.         }
  296.         result[index - offset] = EOS;
  297.         return result;
  298. }
  299.  
  300. stock IsNumeric(const string[]) {
  301.         new length=strlen(string);
  302.         if (length==0) return false;
  303.         for (new i = 0; i < length; i++) {
  304.                 if (
  305.                 (string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+')
  306.                 || (string[i]=='-' && i!=0)
  307.                 || (string[i]=='+' && i!=0)
  308.                 ) return false;
  309.         }
  310.         if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
  311.         return true;
  312. }
Advertisement
Add Comment
Please, Sign In to add comment