Y_Less

sscanf2.inc

Oct 24th, 2012
24,029
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 22.85 KB | None | 0 0
  1. /*  
  2.  *  Version: MPL 1.1
  3.  *  
  4.  *  The contents of this file are subject to the Mozilla Public License Version
  5.  *  1.1 (the "License"); you may not use this file except in compliance with
  6.  *  the License. You may obtain a copy of the License at
  7.  *  [url]http://www.mozilla.org/MPL/[/url]
  8.  *  
  9.  *  Software distributed under the License is distributed on an "AS IS" basis,
  10.  *  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11.  *  for the specific language governing rights and limitations under the
  12.  *  License.
  13.  *  
  14.  *  The Original Code is the sscanf 2.0 SA:MP plugin.
  15.  *  
  16.  *  The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  17.  *  Portions created by the Initial Developer are Copyright (C) 2010
  18.  *  the Initial Developer. All Rights Reserved.
  19.  *  
  20.  *  Contributor(s):
  21.  *  
  22.  *  Special Thanks to:
  23.  *  
  24.  *      SA:MP Team past, present and future
  25.  */
  26.  
  27. #if defined _inc_a_npc
  28.     #pragma library sscanf
  29. #elseif !defined _inc_a_samp
  30.     #error Please include <a_npc> or <a_samp> first.
  31. #endif
  32.  
  33. #define SSCANF:%0(%1) sscanf_%0(%1);public sscanf_%0(%1)
  34.  
  35. #if defined sscanf
  36.     #error sscanf (possibly the PAWN version) already defined.
  37. #endif
  38.  
  39. native sscanf(const data[], const format[], {Float,_}:...);
  40. native unformat(const data[], const format[], {Float,_}:...) = sscanf;
  41. native SSCANF_Init(players, invalid, len);
  42. native SSCANF_Join(playerid, const name[], npc);
  43. native SSCANF_Leave(playerid);
  44.  
  45. native SSCANF_Option(const name[], value);
  46.  
  47. stock const
  48.     SSCANF_QUIET[] = "SSCANF_QUIET",
  49.     OLD_DEFAULT_NAME[] = "OLD_DEFAULT_NAME",
  50.     MATCH_NAME_PARTIAL[] = "MATCH_NAME_PARTIAL",
  51.     CELLMIN_ON_MATCHES[] = "CELLMIN_ON_MATCHES",
  52.     OLD_DEFAULT_KUSTOM[] = "OLD_DEFAULT_KUSTOM",
  53.     OLD_DEFAULT_CUSTOM[] = "OLD_DEFAULT_CUSTOM";
  54.  
  55. static stock
  56.     bool:SSCANF_gInit = false,
  57.     SSCANF_g_sPlayers[MAX_PLAYERS char];
  58.  
  59. #if defined _inc_a_npc
  60.     forward SSCANF_PlayerCheck();
  61.    
  62.     /*
  63.       OnNPCModeInit
  64.  
  65.       Called when the script starts if it is a NPC mode, sets up the system,
  66.       then calls the "real" OnNPCModeInit (using the new ALS 2 hook method).
  67.     */
  68.    
  69.     public OnNPCModeInit()
  70.     {
  71.         SSCANF_Init(MAX_PLAYERS, INVALID_PLAYER_ID, MAX_PLAYER_NAME);
  72.         #if !defined SSCANF_NO_PLAYERS
  73.             // Initialise the system.
  74.             SSCANF_PlayerCheck();
  75.             SetTimer("SSCANF_PlayerCheck", 1, 1);
  76.         #endif
  77.         #if defined SSCANF_OnNPCModeInit
  78.             SSCANF_OnNPCModeInit();
  79.         #endif
  80.         return 1;
  81.     }
  82.    
  83.     #if defined _ALS_OnNPCModeInit
  84.         #undef OnNPCModeInit
  85.     #else
  86.         #define _ALS_OnNPCModeInit
  87.     #endif
  88.     #define OnNPCModeInit SSCANF_OnNPCModeInit
  89.     #if defined SSCANF_OnNPCModeInit
  90.         forward SSCANF_OnNPCModeInit();
  91.     #endif
  92.    
  93.     /*
  94.       SSCANF_PlayerCheck
  95.  
  96.       NPC modes have no "OnPlayerConnect callback, so we need to simulate one.
  97.     */
  98.    
  99.     #if !defined SSCANF_NO_PLAYERS
  100.         public SSCANF_PlayerCheck()
  101.         {
  102.             for (new i = 0; i != MAX_PLAYERS; ++i)
  103.             {
  104.                 if (IsPlayerConnected(i))
  105.                 {
  106.                     if (!SSCANF_g_sPlayers{i})
  107.                     {
  108.                         new
  109.                             name[MAX_PLAYER_NAME];
  110.                         GetPlayerName(i, name, sizeof (name));
  111.                         // We have no way to know if they are an NPC or not!
  112.                         SSCANF_Join(i, name, 0);
  113.                         SSCANF_g_sPlayers{i} = 1;
  114.                     }
  115.                 }
  116.                 else
  117.                 {
  118.                     if (SSCANF_g_sPlayers{i})
  119.                     {
  120.                         SSCANF_Leave(i);
  121.                         SSCANF_g_sPlayers{i} = 0;
  122.                     }
  123.                 }
  124.             }
  125.         }
  126.     #endif
  127. #else
  128.     /*
  129.       OnFilterScriptInit
  130.  
  131.       Called when the script starts if it is a filterscript, sets up the system,
  132.       then calls the "real" OnFilterScriptInit (using the new ALS 2 hook
  133.       method).
  134.     */
  135.    
  136.     public OnFilterScriptInit()
  137.     {
  138.         SSCANF_Init(GetMaxPlayers(), INVALID_PLAYER_ID, MAX_PLAYER_NAME);
  139.         SSCANF_gInit = true;
  140.         #if defined SSCANF_OnFilterScriptInit
  141.             SSCANF_OnFilterScriptInit();
  142.         #endif
  143.         return 1;
  144.     }
  145.    
  146.     #if defined _ALS_OnFilterScriptInit
  147.         #undef OnFilterScriptInit
  148.     #else
  149.         #define _ALS_OnFilterScriptInit
  150.     #endif
  151.     #define OnFilterScriptInit SSCANF_OnFilterScriptInit
  152.     #if defined SSCANF_OnFilterScriptInit
  153.         forward SSCANF_OnFilterScriptInit();
  154.     #endif
  155.    
  156.     /*
  157.       OnGameModeInit
  158.  
  159.       Called when the script starts if it is a gamemode.  This callback is also
  160.       called in filterscripts so we don't want to reinitialise the system in
  161.       that case.
  162.     */
  163.    
  164.     public OnGameModeInit()
  165.     {
  166.         if (!SSCANF_gInit)
  167.         {
  168.             SSCANF_Init(GetMaxPlayers(), INVALID_PLAYER_ID, MAX_PLAYER_NAME);
  169.             SSCANF_gInit = true;
  170.         }
  171.         #if defined SSCANF_OnGameModeInit
  172.             SSCANF_OnGameModeInit();
  173.         #endif
  174.         return 1;
  175.     }
  176.    
  177.     #if defined _ALS_OnGameModeInit
  178.         #undef OnGameModeInit
  179.     #else
  180.         #define _ALS_OnGameModeInit
  181.     #endif
  182.     #define OnGameModeInit SSCANF_OnGameModeInit
  183.     #if defined SSCANF_OnGameModeInit
  184.         forward SSCANF_OnGameModeInit();
  185.     #endif
  186.    
  187.     /*
  188.       OnPlayerConnect
  189.  
  190.       Called when a player connects.  Actually increments an internal count so
  191.       that if a script ends and "OnPlayerDisconnect" is called then "sscanf"
  192.       still knows that the player is really connected.  Also stores their name
  193.       internally.
  194.     */
  195.    
  196.     public OnPlayerConnect(playerid)
  197.     {
  198.         new
  199.             name[MAX_PLAYER_NAME];
  200.         GetPlayerName(playerid, name, sizeof (name));
  201.         SSCANF_Join(playerid, name, IsPlayerNPC(playerid));
  202.         CallLocalFunction("SSCANF_OnPlayerConnect", "i", playerid);
  203.         return 1;
  204.     }
  205.    
  206.     #if defined _ALS_OnPlayerConnect
  207.         #undef OnPlayerConnect
  208.     #else
  209.         #define _ALS_OnPlayerConnect
  210.     #endif
  211.     #define OnPlayerConnect SSCANF_OnPlayerConnect
  212.    
  213.     forward SSCANF_OnPlayerConnect(playerid);
  214.    
  215.     /*
  216.       OnPlayerDisconnect
  217.  
  218.       Called when a player disconnects, or when a script is ended.
  219.     */
  220.    
  221.     public OnPlayerDisconnect(playerid, reason)
  222.     {
  223.         CallLocalFunction("SSCANF_OnPlayerDisconnect", "ii", playerid, reason);
  224.         SSCANF_Leave(playerid);
  225.         return 1;
  226.     }
  227.    
  228.     #if defined _ALS_OnPlayerDisconnect
  229.         #undef OnPlayerDisconnect
  230.     #else
  231.         #define _ALS_OnPlayerDisconnect
  232.     #endif
  233.     #define OnPlayerDisconnect SSCANF_OnPlayerDisconnect
  234.    
  235.     forward SSCANF_OnPlayerDisconnect(playerid, reason);
  236. #endif
  237.  
  238. #define SSCANF_Init
  239. #define SSCANF_Join
  240. #define SSCANF_Leave
  241.  
  242. #define extract%0->%1; EXTRN%1;unformat(_:EXTRZ:EXTRV:EXTRX:%0,##,%1,,);
  243. #define unformat(_:EXTRZ:EXTRV:EXTRX:%0,##,%1);%2else if (unformat(_:EXTRV:EXTRX:%0,##,%1))
  244.  
  245. #define EXTRV:EXTRX:%0<%3>##,%9new%1,%2) EXTRY:%0##P<%3>,|||%1|||%2)
  246. #define EXTRX:%0##,%9new%1,%2) EXTRY:%0##,|||%1|||%2)
  247. #define EXTRY: EXTR8:EXTR9:EXTR0:EXTR1:EXTR2:EXTR3:EXTR4:
  248.  
  249. #define EXTR8:EXTR9:EXTR0:EXTR1:EXTR2:EXTR3:EXTR4:%0##%1,%2|||%6:%3=%9|||%4) %6_EXTRO:%0##%1,%2|||%3=%9|||%4)
  250. #define EXTR9:EXTR0:EXTR1:EXTR2:EXTR3:EXTR4:%0##%1,%2|||%3=%9|||%4) __EXTRO:%0##%1,%2|||%3=%9|||%4)
  251. #define EXTR0:EXTR1:EXTR2:EXTR3:EXTR4:%0##%1,%2|||%6:%3[%7]|||%4) %6_EXTRW:%0##%1,%2|||%3[%7]|||%4)
  252. #define EXTR1:EXTR2:EXTR3:EXTR4:%0##%1,%2|||%3[%7]|||%4) __EXTRW:%0##%1,%2|||%3|||%4)
  253. #define EXTR2:EXTR3:EXTR4:%0##%1,%2|||%6:%3|||%4) %6_EXTRN:%0##%1,%2|||%3|||%4)
  254. #define EXTR3:EXTR4:%0##%1,,%2||||||%4) %0##%1,%2)
  255. #define EXTR4:%0##%1,%2|||%3|||%4) __EXTRN:%0##%1,%2|||%3|||%4)
  256.  
  257. // Optional specifiers.
  258. #define __EXTRO:%0##%1,%2|||%3=%9|||%4,%5) EXTRY:%0##%1I"("#%9")"#,%2,%3|||%4|||%5)
  259. #define Float_EXTRO:%0##%1,%2|||%3=%9|||%4,%5) EXTRY:%0##%1F"("#%9")"#,%2,%3|||%4|||%5)
  260. #define player_EXTRO:%0##%1,%2|||%3=%9|||%4,%5) EXTRY:%0##%1U"("#%9")"#,%2,%3|||%4|||%5)
  261. #define string_EXTRO:%0##%1,%2|||%3[%7]=%9|||%4,%5) EXTRY:%0##%1S"("#%9")"#[%7],%2,%3|||%4|||%5)
  262.  
  263. // Normal specifiers (the double underscore is to work for "_:".
  264. #define __EXTRN:%0##%1,%2|||%3|||%4,%5) EXTRY:%0##%1i,%2,%3|||%4|||%5)
  265. #define Float_EXTRN:%0##%1,%2|||%3|||%4,%5) EXTRY:%0##%1f,%2,%3|||%4|||%5)
  266. #define player_EXTRN:%0##%1,%2|||%3|||%4,%5) EXTRY:%0##%1u,%2,%3|||%4|||%5)
  267. //#define string_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1s[%7],%2,%3|||%4|||%5)
  268.  
  269. // Array versions of normal specifiers.
  270. #define __EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1a<i>[%7],%2,%3|||%4|||%5)
  271. #define Float_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1a<f>[%7],%2,%3|||%4|||%5)
  272. #define player_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1a<u>[%7],%2,%3|||%4|||%5)
  273. #define string_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1s[%7],%2,%3|||%4|||%5)
  274.  
  275. // Get rid of excess leading space which causes warnings.
  276. #define EXTRN%0new%1; new%1;
  277.  
  278. #if !defined string
  279.     #define string:
  280. #endif
  281.  
  282. #define player:
  283.  
  284. #define hex:
  285. #define hex_EXTRO:%0##%1,%2|||%3=%9|||%4,%5) EXTRY:%0##%1H"("#%9")"#,%2,%3|||%4|||%5)
  286. #define hex_EXTRN:%0##%1,%2|||%3|||%4,%5) EXTRY:%0##%1h,%2,%3|||%4|||%5)
  287. #define hex_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1a<h>[%7],%2,%3|||%4|||%5)
  288.  
  289. #define bin:
  290. #define bin_EXTRO:%0##%1,%2|||%3=%9|||%4,%5) EXTRY:%0##%1B"("#%9")"#,%2,%3|||%4|||%5)
  291. #define bin_EXTRN:%0##%1,%2|||%3|||%4,%5) EXTRY:%0##%1b,%2,%3|||%4|||%5)
  292. #define bin_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1a<b>[%7],%2,%3|||%4|||%5)
  293.  
  294. #define kustom:%0<%1> %0
  295. #define kustom_EXTRO:%0##%1,%2|||%3<%8>=%9|||%4,%5) EXTRY:%0##%1K<%8>"("#%9")"#,%2,%3|||%4|||%5)
  296. #define kustom_EXTRN:%0##%1,%2|||%3<%8>|||%4,%5) EXTRY:%0##%1k<%8>,%2,%3|||%4|||%5)
  297. //#define bin_EXTRW:%0##%1,%2|||%3[%7]|||%4,%5) EXTRY:%0##%1a<b>[%7],%2,%3|||%4|||%5)
  298.  
  299. SSCANF:weapon(string[])
  300. {
  301.     // This function is VERY basic, needs VASTLY improving to detect variations.
  302.     if ('0' <= string[0] <= '9')
  303.     {
  304.         new
  305.             ret = strval(string);
  306.         if (0 <= ret <= 18 || 22 <= ret <= 46)
  307.         {
  308.             return ret;
  309.         }
  310.     }
  311.     else if (!strcmp(string, "Unarmed")) return 0;
  312.     else if (!strcmp(string, "Brass Knuckles")) return 1;
  313.     else if (!strcmp(string, "Golf Club")) return 2;
  314.     else if (!strcmp(string, "Night Stick")) return 3;
  315.     else if (!strcmp(string, "Knife")) return 4;
  316.     else if (!strcmp(string, "Baseball Bat")) return 5;
  317.     else if (!strcmp(string, "Shovel")) return 6;
  318.     else if (!strcmp(string, "Pool cue")) return 7;
  319.     else if (!strcmp(string, "Katana")) return 8;
  320.     else if (!strcmp(string, "Chainsaw")) return 9;
  321.     else if (!strcmp(string, "Purple Dildo")) return 10;
  322.     else if (!strcmp(string, "White Dildo")) return 11;
  323.     else if (!strcmp(string, "Long White Dildo")) return 12;
  324.     else if (!strcmp(string, "White Dildo 2")) return 13;
  325.     else if (!strcmp(string, "Flowers")) return 14;
  326.     else if (!strcmp(string, "Cane")) return 15;
  327.     else if (!strcmp(string, "Grenades")) return 16;
  328.     else if (!strcmp(string, "Tear Gas")) return 17;
  329.     else if (!strcmp(string, "Molotovs")) return 18;
  330.     else if (!strcmp(string, "Pistol")) return 22;
  331.     else if (!strcmp(string, "Silenced Pistol")) return 23;
  332.     else if (!strcmp(string, "Desert Eagle")) return 24;
  333.     else if (!strcmp(string, "Shotgun")) return 25;
  334.     else if (!strcmp(string, "Sawn Off Shotgun")) return 26;
  335.     else if (!strcmp(string, "Combat Shotgun")) return 27;
  336.     else if (!strcmp(string, "Micro Uzi")) return 28;
  337.     else if (!strcmp(string, "Mac 10")) return 28;
  338.     else if (!strcmp(string, "MP5")) return 29;
  339.     else if (!strcmp(string, "AK47")) return 30;
  340.     else if (!strcmp(string, "M4")) return 31;
  341.     else if (!strcmp(string, "Tec9")) return 32;
  342.     else if (!strcmp(string, "Rifle")) return 33;
  343.     else if (!strcmp(string, "Sniper Rifle")) return 34;
  344.     else if (!strcmp(string, "RPG")) return 35;
  345.     else if (!strcmp(string, "Missile Launcher")) return 36;
  346.     else if (!strcmp(string, "Flame Thrower")) return 37;
  347.     else if (!strcmp(string, "Minigun")) return 38;
  348.     else if (!strcmp(string, "Sachel Charges")) return 39;
  349.     else if (!strcmp(string, "Detonator")) return 40;
  350.     else if (!strcmp(string, "Spray Paint")) return 41;
  351.     else if (!strcmp(string, "Fire Extinguisher")) return 42;
  352.     else if (!strcmp(string, "Camera")) return 43;
  353.     else if (!strcmp(string, "Nightvision Goggles")) return 44;
  354.     else if (!strcmp(string, "Thermal Goggles")) return 45;
  355.     else if (!strcmp(string, "Parachute")) return 46;
  356.     return -1;
  357. }
  358.  
  359. SSCANF:vehicle(string[])
  360. {
  361.     // This function is VERY basic, needs VASTLY improving to detect variations.
  362.     if ('0' <= string[0] <= '9')
  363.     {
  364.         new
  365.             ret = strval(string);
  366.         if (400 <= ret <= 611)
  367.         {
  368.             return ret;
  369.         }
  370.     }
  371.     else if (!strcmp(string, "Landstalker")) return 400;
  372.     else if (!strcmp(string, "Bravura")) return 401;
  373.     else if (!strcmp(string, "Buffalo")) return 402;
  374.     else if (!strcmp(string, "Linerunner")) return 403;
  375.     else if (!strcmp(string, "Perenniel")) return 404;
  376.     else if (!strcmp(string, "Sentinel")) return 405;
  377.     else if (!strcmp(string, "Dumper")) return 406;
  378.     else if (!strcmp(string, "Firetruck")) return 407;
  379.     else if (!strcmp(string, "Trashmaster")) return 408;
  380.     else if (!strcmp(string, "Stretch")) return 409;
  381.     else if (!strcmp(string, "Manana")) return 410;
  382.     else if (!strcmp(string, "Infernus")) return 411;
  383.     else if (!strcmp(string, "Voodoo")) return 412;
  384.     else if (!strcmp(string, "Pony")) return 413;
  385.     else if (!strcmp(string, "Mule")) return 414;
  386.     else if (!strcmp(string, "Cheetah")) return 415;
  387.     else if (!strcmp(string, "Ambulance")) return 416;
  388.     else if (!strcmp(string, "Leviathan")) return 417;
  389.     else if (!strcmp(string, "Moonbeam")) return 418;
  390.     else if (!strcmp(string, "Esperanto")) return 419;
  391.     else if (!strcmp(string, "Taxi")) return 420;
  392.     else if (!strcmp(string, "Washington")) return 421;
  393.     else if (!strcmp(string, "Bobcat")) return 422;
  394.     else if (!strcmp(string, "Mr Whoopee")) return 423;
  395.     else if (!strcmp(string, "BF Injection")) return 424;
  396.     else if (!strcmp(string, "Hunter")) return 425;
  397.     else if (!strcmp(string, "Premier")) return 426;
  398.     else if (!strcmp(string, "Enforcer")) return 427;
  399.     else if (!strcmp(string, "Securicar")) return 428;
  400.     else if (!strcmp(string, "Banshee")) return 429;
  401.     else if (!strcmp(string, "Predator")) return 430;
  402.     else if (!strcmp(string, "Bus")) return 431;
  403.     else if (!strcmp(string, "Rhino")) return 432;
  404.     else if (!strcmp(string, "Barracks")) return 433;
  405.     else if (!strcmp(string, "Hotknife")) return 434;
  406.     else if (!strcmp(string, "Article Trailer")) return 435;
  407.     else if (!strcmp(string, "Previon")) return 436;
  408.     else if (!strcmp(string, "Coach")) return 437;
  409.     else if (!strcmp(string, "Cabbie")) return 438;
  410.     else if (!strcmp(string, "Stallion")) return 439;
  411.     else if (!strcmp(string, "Rumpo")) return 440;
  412.     else if (!strcmp(string, "RC Bandit")) return 441;
  413.     else if (!strcmp(string, "Romero")) return 442;
  414.     else if (!strcmp(string, "Packer")) return 443;
  415.     else if (!strcmp(string, "Monster")) return 444;
  416.     else if (!strcmp(string, "Admiral")) return 445;
  417.     else if (!strcmp(string, "Squallo")) return 446;
  418.     else if (!strcmp(string, "Seasparrow")) return 447;
  419.     else if (!strcmp(string, "Pizzaboy")) return 448;
  420.     else if (!strcmp(string, "Tram")) return 449;
  421.     else if (!strcmp(string, "Article Trailer 2")) return 450;
  422.     else if (!strcmp(string, "Turismo")) return 451;
  423.     else if (!strcmp(string, "Speeder")) return 452;
  424.     else if (!strcmp(string, "Reefer")) return 453;
  425.     else if (!strcmp(string, "Tropic")) return 454;
  426.     else if (!strcmp(string, "Flatbed")) return 455;
  427.     else if (!strcmp(string, "Yankee")) return 456;
  428.     else if (!strcmp(string, "Caddy")) return 457;
  429.     else if (!strcmp(string, "Solair")) return 458;
  430.     else if (!strcmp(string, "Berkley's RC Van")) return 459;
  431.     else if (!strcmp(string, "Skimmer")) return 460;
  432.     else if (!strcmp(string, "PCJ-600")) return 461;
  433.     else if (!strcmp(string, "Faggio")) return 462;
  434.     else if (!strcmp(string, "Freeway")) return 463;
  435.     else if (!strcmp(string, "RC Baron")) return 464;
  436.     else if (!strcmp(string, "RC Raider")) return 465;
  437.     else if (!strcmp(string, "Glendale")) return 466;
  438.     else if (!strcmp(string, "Oceanic")) return 467;
  439.     else if (!strcmp(string, "Sanchez")) return 468;
  440.     else if (!strcmp(string, "Sparrow")) return 469;
  441.     else if (!strcmp(string, "Patriot")) return 470;
  442.     else if (!strcmp(string, "Quad")) return 471;
  443.     else if (!strcmp(string, "Coastguard")) return 472;
  444.     else if (!strcmp(string, "Dinghy")) return 473;
  445.     else if (!strcmp(string, "Hermes")) return 474;
  446.     else if (!strcmp(string, "Sabre")) return 475;
  447.     else if (!strcmp(string, "Rustler")) return 476;
  448.     else if (!strcmp(string, "ZR-350")) return 477;
  449.     else if (!strcmp(string, "Walton")) return 478;
  450.     else if (!strcmp(string, "Regina")) return 479;
  451.     else if (!strcmp(string, "Comet")) return 480;
  452.     else if (!strcmp(string, "BMX")) return 481;
  453.     else if (!strcmp(string, "Burrito")) return 482;
  454.     else if (!strcmp(string, "Camper")) return 483;
  455.     else if (!strcmp(string, "Marquis")) return 484;
  456.     else if (!strcmp(string, "Baggage")) return 485;
  457.     else if (!strcmp(string, "Dozer")) return 486;
  458.     else if (!strcmp(string, "Maverick")) return 487;
  459.     else if (!strcmp(string, "SAN News Maverick")) return 488;
  460.     else if (!strcmp(string, "Rancher")) return 489;
  461.     else if (!strcmp(string, "FBI Rancher")) return 490;
  462.     else if (!strcmp(string, "Virgo")) return 491;
  463.     else if (!strcmp(string, "Greenwood")) return 492;
  464.     else if (!strcmp(string, "Jetmax")) return 493;
  465.     else if (!strcmp(string, "Hotring Racer")) return 494;
  466.     else if (!strcmp(string, "Sandking")) return 495;
  467.     else if (!strcmp(string, "Blista Compact")) return 496;
  468.     else if (!strcmp(string, "Police Maverick")) return 497;
  469.     else if (!strcmp(string, "Boxville")) return 498;
  470.     else if (!strcmp(string, "Benson")) return 499;
  471.     else if (!strcmp(string, "Mesa")) return 500;
  472.     else if (!strcmp(string, "RC Goblin")) return 501;
  473.     else if (!strcmp(string, "Hotring Racer")) return 502;
  474.     else if (!strcmp(string, "Hotring Racer")) return 503;
  475.     else if (!strcmp(string, "Bloodring Banger")) return 504;
  476.     else if (!strcmp(string, "Rancher")) return 505;
  477.     else if (!strcmp(string, "Super GT")) return 506;
  478.     else if (!strcmp(string, "Elegant")) return 507;
  479.     else if (!strcmp(string, "Journey")) return 508;
  480.     else if (!strcmp(string, "Bike")) return 509;
  481.     else if (!strcmp(string, "Mountain Bike")) return 510;
  482.     else if (!strcmp(string, "Beagle")) return 511;
  483.     else if (!strcmp(string, "Cropduster")) return 512;
  484.     else if (!strcmp(string, "Stuntplane")) return 513;
  485.     else if (!strcmp(string, "Tanker")) return 514;
  486.     else if (!strcmp(string, "Roadtrain")) return 515;
  487.     else if (!strcmp(string, "Nebula")) return 516;
  488.     else if (!strcmp(string, "Majestic")) return 517;
  489.     else if (!strcmp(string, "Buccaneer")) return 518;
  490.     else if (!strcmp(string, "Shamal")) return 519;
  491.     else if (!strcmp(string, "Hydra")) return 520;
  492.     else if (!strcmp(string, "FCR-900")) return 521;
  493.     else if (!strcmp(string, "NRG-500")) return 522;
  494.     else if (!strcmp(string, "HPV1000")) return 523;
  495.     else if (!strcmp(string, "Cement Truck")) return 524;
  496.     else if (!strcmp(string, "Towtruck")) return 525;
  497.     else if (!strcmp(string, "Fortune")) return 526;
  498.     else if (!strcmp(string, "Cadrona")) return 527;
  499.     else if (!strcmp(string, "FBI Truck")) return 528;
  500.     else if (!strcmp(string, "Willard")) return 529;
  501.     else if (!strcmp(string, "Forklift")) return 530;
  502.     else if (!strcmp(string, "Tractor")) return 531;
  503.     else if (!strcmp(string, "Combine Harvester")) return 532;
  504.     else if (!strcmp(string, "Feltzer")) return 533;
  505.     else if (!strcmp(string, "Remington")) return 534;
  506.     else if (!strcmp(string, "Slamvan")) return 535;
  507.     else if (!strcmp(string, "Blade")) return 536;
  508.     else if (!strcmp(string, "Freight (Train)")) return 537;
  509.     else if (!strcmp(string, "Brownstreak (Train)")) return 538;
  510.     else if (!strcmp(string, "Vortex")) return 539;
  511.     else if (!strcmp(string, "Vincent")) return 540;
  512.     else if (!strcmp(string, "Bullet")) return 541;
  513.     else if (!strcmp(string, "Clover")) return 542;
  514.     else if (!strcmp(string, "Sadler")) return 543;
  515.     else if (!strcmp(string, "Firetruck LA")) return 544;
  516.     else if (!strcmp(string, "Hustler")) return 545;
  517.     else if (!strcmp(string, "Intruder")) return 546;
  518.     else if (!strcmp(string, "Primo")) return 547;
  519.     else if (!strcmp(string, "Cargobob")) return 548;
  520.     else if (!strcmp(string, "Tampa")) return 549;
  521.     else if (!strcmp(string, "Sunrise")) return 550;
  522.     else if (!strcmp(string, "Merit")) return 551;
  523.     else if (!strcmp(string, "Utility Van")) return 552;
  524.     else if (!strcmp(string, "Nevada")) return 553;
  525.     else if (!strcmp(string, "Yosemite")) return 554;
  526.     else if (!strcmp(string, "Windsor")) return 555;
  527.     else if (!strcmp(string, "Monster \"A\"")) return 556;
  528.     else if (!strcmp(string, "Monster \"B\"")) return 557;
  529.     else if (!strcmp(string, "Uranus")) return 558;
  530.     else if (!strcmp(string, "Jester")) return 559;
  531.     else if (!strcmp(string, "Sultan")) return 560;
  532.     else if (!strcmp(string, "Stratum")) return 561;
  533.     else if (!strcmp(string, "Elegy")) return 562;
  534.     else if (!strcmp(string, "Raindance")) return 563;
  535.     else if (!strcmp(string, "RC Tiger")) return 564;
  536.     else if (!strcmp(string, "Flash")) return 565;
  537.     else if (!strcmp(string, "Tahoma")) return 566;
  538.     else if (!strcmp(string, "Savanna")) return 567;
  539.     else if (!strcmp(string, "Bandito")) return 568;
  540.     else if (!strcmp(string, "Freight Flat Trailer (Train)")) return 569;
  541.     else if (!strcmp(string, "Streak Trailer (Train)")) return 570;
  542.     else if (!strcmp(string, "Kart")) return 571;
  543.     else if (!strcmp(string, "Mower")) return 572;
  544.     else if (!strcmp(string, "Dune")) return 573;
  545.     else if (!strcmp(string, "Sweeper")) return 574;
  546.     else if (!strcmp(string, "Broadway")) return 575;
  547.     else if (!strcmp(string, "Tornado")) return 576;
  548.     else if (!strcmp(string, "AT400")) return 577;
  549.     else if (!strcmp(string, "DFT-30")) return 578;
  550.     else if (!strcmp(string, "Huntley")) return 579;
  551.     else if (!strcmp(string, "Stafford")) return 580;
  552.     else if (!strcmp(string, "BF-400")) return 581;
  553.     else if (!strcmp(string, "Newsvan")) return 582;
  554.     else if (!strcmp(string, "Tug")) return 583;
  555.     else if (!strcmp(string, "Petrol Trailer")) return 584;
  556.     else if (!strcmp(string, "Emperor")) return 585;
  557.     else if (!strcmp(string, "Wayfarer")) return 586;
  558.     else if (!strcmp(string, "Euros")) return 587;
  559.     else if (!strcmp(string, "Hotdog")) return 588;
  560.     else if (!strcmp(string, "Club")) return 589;
  561.     else if (!strcmp(string, "Freight Box Trailer (Train)")) return 590;
  562.     else if (!strcmp(string, "Article Trailer 3")) return 591;
  563.     else if (!strcmp(string, "Andromada")) return 592;
  564.     else if (!strcmp(string, "Dodo")) return 593;
  565.     else if (!strcmp(string, "RC Cam")) return 594;
  566.     else if (!strcmp(string, "Launch")) return 595;
  567.     else if (!strcmp(string, "Police Car (LSPD)")) return 596;
  568.     else if (!strcmp(string, "Police Car (SFPD)")) return 597;
  569.     else if (!strcmp(string, "Police Car (LVPD)")) return 598;
  570.     else if (!strcmp(string, "Police Ranger")) return 599;
  571.     else if (!strcmp(string, "Picador")) return 600;
  572.     else if (!strcmp(string, "S.W.A.T.")) return 601;
  573.     else if (!strcmp(string, "Alpha")) return 602;
  574.     else if (!strcmp(string, "Phoenix")) return 603;
  575.     else if (!strcmp(string, "Glendale Shit")) return 604;
  576.     else if (!strcmp(string, "Sadler Shit")) return 605;
  577.     else if (!strcmp(string, "Baggage Trailer \"A\"")) return 606;
  578.     else if (!strcmp(string, "Baggage Trailer \"B\"")) return 607;
  579.     else if (!strcmp(string, "Tug Stairs Trailer")) return 608;
  580.     else if (!strcmp(string, "Boxville")) return 609;
  581.     else if (!strcmp(string, "Farm Trailer")) return 610;
  582.     else if (!strcmp(string, "Utility Trailer")) return 611;
  583.     return -1;
  584. }
  585.  
  586. // Fix the compiler crash when both the PAWN and Plugin versions of sscanf are
  587. // found by renaming the old version at declaration.  (fixes.inc compatible
  588. // naming scheme: "BAD_Function()").
  589. #define sscanf(%0:...) BAD_sscanf(%0:...)
Advertisement
Add Comment
Please, Sign In to add comment