Advertisement
rockbandcheeseman

RandomWeapon 3.0.1

Aug 26th, 2013
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 73.66 KB | None | 0 0
  1. -- RandomWeapon 3.0.1
  2.  
  3. -- Every time you spawn, you will spawn with random attributes.
  4. -- This includes weapons, grenades, ammo, and special abilities.
  5. -- I've written this script intentionally to make it easy for inexperienced scripters to edit and flexible for more experienced scripters to customize.
  6. -- If any of my comments are confusing, or you have any questions about how the script works, you can PM me (Nuggets) at phasor.proboards.com
  7.  
  8. function GetRequiredVersion()
  9.  
  10.     return 200
  11. end
  12.  
  13. function OnScriptLoad(processId, game, persistent)
  14.  
  15.     -- Printing --
  16.    
  17.     use_console = true  -- Toggle whether the messages should be sent to the player's console or via chat.
  18.  
  19.     -- Probabilities --
  20.    
  21.     probability = {}
  22.        
  23.     -- In each probabilities table, you may create new entries in the same syntax as I've written them, remove any entries I've included, and easily change the probabilities of all attributes.
  24.     -- If you add any probabilities, make sure you give them entries under Player Multipliers, Messages, and Recurrence or they will not work correctly.
  25.    
  26.     -- **If you are using Player Multipliers (see next section entitled "Player Multipliers")**:
  27.     -- Keep in mind these probabilities are for when there are 0 players in your server.
  28.     -- Probabilities that should increase as the number of players increases should therefore be set decently lower than their desired value and vice versa.
  29.  
  30.    
  31.     -- Primary Weapon Probabilities --
  32.  
  33.     probability.primary = {}
  34.  
  35.     --                    Tag:                                      Probability:     Description:
  36.     probability.primary[false] =                                          0          -- No Weapon
  37.     probability.primary["weapons\\assault rifle\\assault rifle"] =        14         -- Assault Rifle
  38.     probability.primary["weapons\\plasma pistol\\plasma pistol"] =        13         -- Plasma Pistol
  39.     probability.primary["weapons\\needler\\mp_needler"] =                 13         -- Needler
  40.     probability.primary["weapons\\plasma rifle\\plasma rifle"] =          13         -- Plasma Rifle
  41.     probability.primary["weapons\\shotgun\\shotgun"] =                    14         -- Shotgun
  42.     probability.primary["weapons\\pistol\\pistol"] =                      13         -- Pistol
  43.     probability.primary["weapons\\sniper rifle\\sniper rifle"] =          12         -- Sniper Rifle
  44.     probability.primary["weapons\\flamethrower\\flamethrower"] =          4          -- Flamethrower
  45.     probability.primary["weapons\\rocket launcher\\rocket launcher"] =    2          -- Rocket Launcher
  46.     probability.primary["weapons\\plasma_cannon\\plasma_cannon"] =        2          -- Fuel Rod
  47.  
  48.     -- Secondary Weapon Probabilities --
  49.    
  50.     probability.secondary = {}
  51.  
  52.     --                    Tag:                                       Probability:     Description:
  53.     probability.secondary[false] =                                        15          -- No Weapon
  54.     probability.secondary["weapons\\assault rifle\\assault rifle"] =      14          -- Assault Rifle
  55.     probability.secondary["weapons\\plasma pistol\\plasma pistol"] =      13          -- Plasma Pistol
  56.     probability.secondary["weapons\\needler\\mp_needler"] =               11          -- Needler
  57.     probability.secondary["weapons\\plasma rifle\\plasma rifle"] =        12          -- Plasma Rifle
  58.     probability.secondary["weapons\\shotgun\\shotgun"] =                  13          -- Shotgun
  59.     probability.secondary["weapons\\pistol\\pistol"] =                    10          -- Pistol
  60.     probability.secondary["weapons\\sniper rifle\\sniper rifle"] =        7           -- Sniper Rifle
  61.     probability.secondary["weapons\\flamethrower\\flamethrower"] =        3           -- Flamethrower
  62.     probability.secondary["weapons\\rocket launcher\\rocket launcher"] =  1           -- Rocket Launcher
  63.     probability.secondary["weapons\\plasma_cannon\\plasma_cannon"] =      1           -- Fuel Rod
  64.    
  65.     -- Tertiary Weapon Probabilities --
  66.  
  67.     probability.tertiary = {}
  68.  
  69.     --                    Tag:                                       Probability:     Description:
  70.     probability.tertiary[false] =                                         100         -- No Weapon
  71.     probability.tertiary["weapons\\assault rifle\\assault rifle"] =       0           -- Assault Rifle
  72.     probability.tertiary["weapons\\plasma pistol\\plasma pistol"] =       0           -- Plasma Pistol
  73.     probability.tertiary["weapons\\needler\\mp_needler"] =                0           -- Needler
  74.     probability.tertiary["weapons\\plasma rifle\\plasma rifle"] =         0           -- Plasma Rifle
  75.     probability.tertiary["weapons\\shotgun\\shotgun"] =                   0           -- Shotgun
  76.     probability.tertiary["weapons\\pistol\\pistol"] =                     0           -- Pistol
  77.     probability.tertiary["weapons\\sniper rifle\\sniper rifle"] =         0           -- Sniper Rifle
  78.     probability.tertiary["weapons\\flamethrower\\flamethrower"] =         0           -- Flamethrower
  79.     probability.tertiary["weapons\\rocket launcher\\rocket launcher"] =   0           -- Rocket Launcher
  80.     probability.tertiary["weapons\\plasma_cannon\\plasma_cannon"] =       0           -- Fuel Rod
  81.    
  82.     -- Quartenary Weapon Probabilities --
  83.  
  84.     probability.quartenary = {}
  85.  
  86.     --                    Tag:                                       Probability:     Description:
  87.     probability.quartenary[false] =                                       100         -- No Weapon
  88.     probability.quartenary["weapons\\assault rifle\\assault rifle"] =     0           -- Assault Rifle
  89.     probability.quartenary["weapons\\plasma pistol\\plasma pistol"] =     0           -- Plasma Pistol
  90.     probability.quartenary["weapons\\needler\\mp_needler"] =              0           -- Needler
  91.     probability.quartenary["weapons\\plasma rifle\\plasma rifle"] =       0           -- Plasma Rifle
  92.     probability.quartenary["weapons\\shotgun\\shotgun"] =                 0           -- Shotgun
  93.     probability.quartenary["weapons\\pistol\\pistol"] =                   0           -- Pistol
  94.     probability.quartenary["weapons\\sniper rifle\\sniper rifle"] =       0           -- Sniper Rifle
  95.     probability.quartenary["weapons\\flamethrower\\flamethrower"] =       0           -- Flamethrower
  96.     probability.quartenary["weapons\\rocket launcher\\rocket launcher"] = 0           -- Rocket Launcher
  97.     probability.quartenary["weapons\\plasma_cannon\\plasma_cannon"] =     0           -- Fuel Rod
  98.  
  99.     -- Grenade Probabilities --
  100.  
  101.     probability.grenades = {}  -- Formatted as probability.grenades[{amount of frag grenades, amount of plasma grenades}] = probability
  102.                                -- This format allows you to add custom grenade loadouts by just adding another entry in the same syntax with whatever numbers you like.
  103.    
  104.     --                  Frag,Plasma:    Probability:   Description:
  105.     probability.grenades[{0, 0}] =          30         -- No grenades
  106.     probability.grenades[{1, 0}] =          20         -- 1 frag, no plasmas
  107.     probability.grenades[{2, 0}] =          10         -- 2 frags, no plasmas
  108.     probability.grenades[{0, 1}] =          20         -- no frags, 1 plasma
  109.     probability.grenades[{0, 2}] =          10         -- no frags, 2 plasmas
  110.     probability.grenades[{2, 2}] =          7          -- 2 frags, 2 plasmas
  111.     probability.grenades[{4, 4}] =          3          -- 4 frags, 4 plasmas
  112.    
  113.     -- Ammo Probabilities --
  114.    
  115.     probability.ammo = {}      -- Formatted as probability.ammo[multiplier] = probability
  116.                                -- This format allows you to add custom ammo multipliers by just adding another entry in the same syntax with whatever number you like.
  117.    
  118.     --             Mult:        Probability:    Description:        Multiplier Description:
  119.     probability.ammo[1] =             60        -- Normal Ammo      (Multiplier x1)
  120.     probability.ammo[2] =             20        -- Double Ammo      (Multiplier x2)
  121.     probability.ammo[3] =             12        -- Triple Ammo      (Multiplier x3)
  122.     probability.ammo[4] =             7.8       -- Quadruple Ammo   (Multiplier x4)
  123.     probability.ammo[math.inf] =      0.2       -- Infinite Ammo    (Mulitplier xInf)
  124.    
  125.     -- Special Probabilities --
  126.    
  127.     probability.special = {}   -- Formatted as probability.special[{function to be called <, args...>}] = probability
  128.                                -- The function specified should take in a player's memory id as its first argument; all other arguments are defined by the optional <, args...> in the above syntax.
  129.                                -- This function should also return a boolean which specifies if the attribute should be considered (for example, overshield shouldn't be considered in a no-shields gametype).
  130.                                -- Keep in mind your function can have more than the amount of arguments than the functions I've listed below; it just happened that none of my functions exceeded two.
  131.                                -- This format allows you to add custom probability.special spawns by just adding another entry in the same syntax with whatever function you like.
  132.    
  133.     --                        Function:       arg1:     arg2:          Probability:    Description:                            Function Description:
  134.     probability.special[{    "setspeed",       1               }] =         90         -- No Special Attributes                (uses setspeed(player, 1) to reset a player's speed if they received a speed bonus previously)
  135.     probability.special[{    "applycamo",      0               }] =         2          -- Camo                                 (uses applycamo(player, 0) to give a player camo until death)
  136.     probability.special[{    "applyos"                         }] =         3.25       -- Overshield                           (uses applyos(player) to give the player overshield)
  137.     probability.special[{    "setspeed",       2               }] =         1.5        -- Double Speed                         (uses setspeed(player, 2) to double a player's speed)
  138.     probability.special[{    "oscamo",         0               }] =         1          -- Camo and Overshield                  (uses oscamo(player, 0) to give a player overshield and camo until death)
  139.     probability.special[{    "camospeed",      0,         2    }] =         0.5        -- Camo and Double Speed                (uses camospeed(player, 0, 2) to give a player camo until death and double speed)
  140.     probability.special[{    "speedos",        2               }] =         0.75       -- Overshield and Double Speed          (uses speedos(player, 2) to give a player overshield and double speed)
  141.     probability.special[{    "speedoscamo",    0,         2    }] =         0.25       -- Camo, Overshield and Double Speed    (uses speedoscamo(player, 0, 2) to give a player camo until death, overshield, and double speed)
  142.     probability.special[{    "damagemultiply", 2               }] =         0.5        -- Double Damage                        (uses damagemultiply(player, 2) to give a player double damage
  143.     probability.special[{    "healthmultiply", 2               }] =         0.25       -- Double Health and Shields            (uses healthmultiply(player, 2) to give a player double health and shields
  144.    
  145.    
  146.     -- Player Multipliers --
  147.    
  148.     multiplier = {}             -- Changes attribute probabilities based on the amount of players in the server.
  149.                                 -- Value specifies percentage of probability per player in the server.
  150.                                 -- For example, multiplier.ammo[2] = 0.5 will divide Double Ammo's probability in half per player who joins (if ammo[2] = 10, 2 players = 5, 3 players = 2.5, 4 players = 1.25, etc)
  151.                                 -- Keep in mind that increasing every attribute's probability by the same amount will do nothing since the probability of each attribute is dependent on the probability of every other attribute in that category.
  152.                                 -- In general, 1.0000 ± 0.0025 is a slow increase/decrease, 1.0000 ± 0.0050 is a moderate increase/decrease, and 1.0000 ± 0.0075 is a sharp increase/decrease in probability per joining player.
  153.                                
  154.                                 -- The variable player_multipliers must be true in order to see how the multipliers affect the percentage probabilities.
  155.                                
  156.                                 -- Keep in mind that for the most part, these numbers should be extremely close to 1.  Probabilities change drastically faster than you may think.
  157.                                
  158.                                 -- If you don't want to use Player Multipliers, make player_multipliers = false.
  159.  
  160.     player_multipliers = true   -- Use to toggle the use of Player Multipliers.  If false, all values in the multipliers table below are completely ignored (therefore, 1.0000).
  161.    
  162.     multiplier.primary = {}    -- Player Multipliers for Primary Weapons
  163.    
  164.     --                                Tag:                                Multiplier:         Description:
  165.     multiplier.primary[false] =                                             1.0000            -- No Weapon:  We never want this probability to be anything but zero.
  166.     multiplier.primary["weapons\\assault rifle\\assault rifle"] =           1.0050            -- Assault Rifle:  We want this probability to moderately increase as more players join.
  167.     multiplier.primary["weapons\\plasma pistol\\plasma pistol"] =           1.0025            -- Plasma Pistol:  We want this probability to slowly increase as more players join.
  168.     multiplier.primary["weapons\\needler\\mp_needler"] =                    1.0025            -- Needler:  We want this probability to moderately increase as more players join.
  169.     multiplier.primary["weapons\\plasma rifle\\plasma rifle"] =             1.0050            -- Plasma Rifle:  We want this probability to moderately increase as more players join.
  170.     multiplier.primary["weapons\\shotgun\\shotgun"] =                       1.0025            -- Shotgun:  We want this probability to slowly increase as more players join.
  171.     multiplier.primary["weapons\\pistol\\pistol"] =                         1.0000            -- Pistol:  We want this probability to remain the same no matter how many players join.
  172.     multiplier.primary["weapons\\sniper rifle\\sniper rifle"] =             0.9975            -- Sniper Rifle:  We want this probability to slowly decrease as more players join.
  173.     multiplier.primary["weapons\\flamethrower\\flamethrower"] =             0.9950            -- Flamethrower:  We want this probability to moderately decrease as more players join.
  174.     multiplier.primary["weapons\\rocket launcher\\rocket launcher"] =       0.9900            -- Rocket Launcher:  We want this probability to very sharply decrease as more players join.
  175.     multiplier.primary["weapons\\plasma_cannon\\plasma_cannon"] =           0.9875            -- Fuel Rod:  We want this probability to very sharply decrease as more players join.
  176.    
  177.     multiplier.secondary = {}    -- Player Multipliers for Secondary Weapons
  178.    
  179.         --                                Tag:                            Multiplier:         Description:
  180.     multiplier.secondary[false] =                                           1.0125            -- No Weapon:  We want this probability to very sharply increase as more players join.
  181.     multiplier.secondary["weapons\\assault rifle\\assault rifle"] =         1.0050            -- Assault Rifle:  We want this probability to moderately increase as more players join.
  182.     multiplier.secondary["weapons\\plasma pistol\\plasma pistol"] =         1.0000            -- Plasma Pistol:  We want this probability to remain the same as more players join.
  183.     multiplier.secondary["weapons\\needler\\mp_needler"] =                  1.0025            -- Needler:  We want this probability to moderately increase as more players join.
  184.     multiplier.secondary["weapons\\plasma rifle\\plasma rifle"] =           1.0025            -- Plasma Rifle:  We want this probability to slowly increase as more players join.
  185.     multiplier.secondary["weapons\\shotgun\\shotgun"] =                     0.9975            -- Shotgun:  We want this probability to remain the same as more players join.
  186.     multiplier.secondary["weapons\\pistol\\pistol"] =                       0.9950            -- Pistol:  We want this probability to remain the same no matter how many players join.
  187.     multiplier.secondary["weapons\\sniper rifle\\sniper rifle"] =           0.9975            -- Sniper Rifle:  We want this probability to slowly decrease as more players join.
  188.     multiplier.secondary["weapons\\flamethrower\\flamethrower"] =           0.9900            -- Flamethrower:  We want this probability to slowly decrease as more players join.
  189.     multiplier.secondary["weapons\\rocket launcher\\rocket launcher"] =     0.9850            -- Rocket Launcher:  We want this probability to sharply decrease as more players join.
  190.     multiplier.secondary["weapons\\plasma_cannon\\plasma_cannon"] =         0.9800            -- Fuel Rod:  We want this probability to very sharply decrease as more players join.
  191.    
  192.     multiplier.tertiary = {}    -- Player Multipliers for Tertiary Weapons
  193.                                 -- I've set this script up to not include Tertiary Weapon probabilities (other than No Weapon), therefore I have made all of these multipliers 1.0000.
  194.                                 -- Use Primary and Secondary Weapon Player Multipliers for reference if you wish to change these values.
  195.    
  196.     --                                Tag:                                Multiplier:         Description:
  197.     multiplier.tertiary[false] =                                             1.0000           -- No Weapon
  198.     multiplier.tertiary["weapons\\assault rifle\\assault rifle"] =           1.0000           -- Assault Rifle
  199.     multiplier.tertiary["weapons\\plasma pistol\\plasma pistol"] =           1.0000           -- Plasma Pistol
  200.     multiplier.tertiary["weapons\\needler\\mp_needler"] =                    1.0000           -- Needler
  201.     multiplier.tertiary["weapons\\plasma rifle\\plasma rifle"] =             1.0000           -- Plasma Rifle
  202.     multiplier.tertiary["weapons\\shotgun\\shotgun"] =                       1.0000           -- Shotgun
  203.     multiplier.tertiary["weapons\\pistol\\pistol"] =                         1.0000           -- Pistol
  204.     multiplier.tertiary["weapons\\sniper rifle\\sniper rifle"] =             1.0000           -- Sniper Rifle
  205.     multiplier.tertiary["weapons\\flamethrower\\flamethrower"] =             1.0000           -- Flamethrower
  206.     multiplier.tertiary["weapons\\rocket launcher\\rocket launcher"] =       1.0000           -- Rocket Launcher
  207.     multiplier.tertiary["weapons\\plasma_cannon\\plasma_cannon"] =           1.0000           -- Fuel Rod
  208.    
  209.     multiplier.quartenary = {}    -- Player Multipliers for Quartenary Weapons
  210.                                 -- See Tertiary Weapon Player Multipliers if you wish to change these values.
  211.    
  212.     --                                Tag:                                Multiplier:        Description:
  213.     multiplier.quartenary[false] =                                           1.0000           -- No Weapon
  214.     multiplier.quartenary["weapons\\assault rifle\\assault rifle"] =         1.0000           -- Assault Rifle
  215.     multiplier.quartenary["weapons\\plasma pistol\\plasma pistol"] =         1.0000           -- Plasma Pistol
  216.     multiplier.quartenary["weapons\\needler\\mp_needler"] =                  1.0000           -- Needler
  217.     multiplier.quartenary["weapons\\plasma rifle\\plasma rifle"] =           1.0000           -- Plasma Rifle
  218.     multiplier.quartenary["weapons\\shotgun\\shotgun"] =                     1.0000           -- Shotgun
  219.     multiplier.quartenary["weapons\\pistol\\pistol"] =                       1.0000           -- Pistol
  220.     multiplier.quartenary["weapons\\sniper rifle\\sniper rifle"] =           1.0000           -- Sniper Rifle
  221.     multiplier.quartenary["weapons\\flamethrower\\flamethrower"] =           1.0000           -- Flamethrower
  222.     multiplier.quartenary["weapons\\rocket launcher\\rocket launcher"] =     1.0000           -- Rocket Launcher
  223.     multiplier.quartenary["weapons\\plasma_cannon\\plasma_cannon"] =         1.0000           -- Fuel Rod
  224.    
  225.     multiplier.grenades = {}    -- Player Multipliers for Grenades
  226.    
  227.     --                 Frag,Plasma:    Multiplier:        Description:
  228.     multiplier.grenades[{0, 0}] =         1.0075            -- No Grenades
  229.     multiplier.grenades[{1, 0}] =         0.9975            -- One Frag
  230.     multiplier.grenades[{2, 0}] =         0.9975            -- Two Frags
  231.     multiplier.grenades[{0, 1}] =         0.9975            -- One Plasma
  232.     multiplier.grenades[{0, 2}] =         0.9975            -- Two Plasmas
  233.     multiplier.grenades[{2, 2}] =         0.9950            -- Two of Each
  234.     multiplier.grenades[{4, 4}] =         0.9925            -- Four of Each
  235.    
  236.     multiplier.ammo = {}        -- Player Multipliers for Ammo
  237.    
  238.     --    Ammo Multiplier:    Probability Multiplier:        Description:
  239.     multiplier.ammo[1] =                 0.9950                -- Normal Ammo
  240.     multiplier.ammo[2] =                 1.0050                -- Double Ammo
  241.     multiplier.ammo[3] =                 1.0075                -- Triple Ammo
  242.     multiplier.ammo[4] =                 1.0075                -- Ammotacular
  243.     multiplier.ammo[math.inf] =          0.9250                -- Infinite Ammo
  244.    
  245.     multiplier.special = {}        -- Player Multipliers for Special Attributes
  246.    
  247.     --                     Function:                Multiplier:         Description:
  248.     multiplier.special[{"setspeed", 1}] =             1.0075            -- No Special
  249.     multiplier.special[{"applycamo", 0}] =            0.9975            -- Camo
  250.     multiplier.special[{"applyos"}] =                 0.9975            -- Overshield
  251.     multiplier.special[{"setspeed", 2}] =             1.0000            -- Double Speed
  252.     multiplier.special[{"oscamo", 0}] =               0.9975            -- Overshield and Camo
  253.     multiplier.special[{"camospeed", 0, 2}] =         0.9950            -- Double Speed and Camo
  254.     multiplier.special[{"speedos", 2}] =              0.9925            -- Double Speed and Overshield
  255.     multiplier.special[{"speedoscamo", 0, 2}] =       0.9900            -- Double Speed, Overshield and Camo
  256.     multiplier.special[{"damagemultiply", 2}] =       0.9950            -- Double Damage
  257.     multiplier.special[{"healthmultiply", 2}] =       1.0050            -- Double Health and Shields
  258.    
  259.    
  260.     -- Messages --
  261.        
  262.     messages = {}   -- If you add any custom probabilities above, make sure a message accompanies it.
  263.                     -- Use nil as the message if you don't want a message sent.
  264.                     -- All table indexing syntaxes are the same as above.
  265.    
  266.     messages.primary = {}
  267.    
  268.     --                            Tag:                                    Message:
  269.     messages.primary[false] =                                             "No Weapon"
  270.     messages.primary["weapons\\assault rifle\\assault rifle"] =           "Assault Rifle"
  271.     messages.primary["weapons\\plasma pistol\\plasma pistol"] =           "Plasma Pistol"
  272.     messages.primary["weapons\\needler\\mp_needler"] =                    "Needler"
  273.     messages.primary["weapons\\plasma rifle\\plasma rifle"] =             "Plasma Rifle"
  274.     messages.primary["weapons\\shotgun\\shotgun"] =                       "Shotgun"
  275.     messages.primary["weapons\\pistol\\pistol"] =                         "Pistol"
  276.     messages.primary["weapons\\sniper rifle\\sniper rifle"] =             "Sniper"
  277.     messages.primary["weapons\\flamethrower\\flamethrower"] =             "Flamethrower"
  278.     messages.primary["weapons\\rocket launcher\\rocket launcher"] =       "Rocket"
  279.     messages.primary["weapons\\plasma_cannon\\plasma_cannon"] =           "Fuel Rod"
  280.    
  281.     messages.secondary = {}
  282.    
  283.     --                            Tag:                                    Message:
  284.     messages.secondary[false] =                                            nil
  285.     messages.secondary["weapons\\assault rifle\\assault rifle"] =         "Secondary: Assault Rifle"
  286.     messages.secondary["weapons\\plasma pistol\\plasma pistol"] =         "Secondary: Plasma Pistol"
  287.     messages.secondary["weapons\\needler\\mp_needler"] =                  "Secondary: Needler"
  288.     messages.secondary["weapons\\plasma rifle\\plasma rifle"] =           "Secondary: Plasma Rifle"
  289.     messages.secondary["weapons\\shotgun\\shotgun"] =                     "Secondary: Shotgun"
  290.     messages.secondary["weapons\\pistol\\pistol"] =                       "Secondary: Pistol"
  291.     messages.secondary["weapons\\sniper rifle\\sniper rifle"] =           "Secondary: Sniper"
  292.     messages.secondary["weapons\\flamethrower\\flamethrower"] =           "Secondary: Flamethrower"
  293.     messages.secondary["weapons\\rocket launcher\\rocket launcher"] =     "Secondary: Rocket"
  294.     messages.secondary["weapons\\plasma_cannon\\plasma_cannon"] =         "Secondary: Fuel Rod"
  295.    
  296.     messages.tertiary = {}
  297.    
  298.     --                            Tag:                                    Message:
  299.     messages.tertiary[false] =                                             nil
  300.     messages.tertiary["weapons\\assault rifle\\assault rifle"] =          "Tertiary: Assault Rifle"
  301.     messages.tertiary["weapons\\plasma pistol\\plasma pistol"] =          "Tertiary: Plasma Pistol"
  302.     messages.tertiary["weapons\\needler\\mp_needler"] =                   "Tertiary: Needler"
  303.     messages.tertiary["weapons\\plasma rifle\\plasma rifle"] =            "Tertiary: Plasma Rifle"
  304.     messages.tertiary["weapons\\shotgun\\shotgun"] =                      "Tertiary: Shotgun"
  305.     messages.tertiary["weapons\\pistol\\pistol"] =                        "Tertiary: Pistol"
  306.     messages.tertiary["weapons\\sniper rifle\\sniper rifle"] =            "Tertiary: Sniper"
  307.     messages.tertiary["weapons\\flamethrower\\flamethrower"] =            "Tertiary: Flamethrower"
  308.     messages.tertiary["weapons\\rocket launcher\\rocket launcher"] =      "Tertiary: Rocket"
  309.     messages.tertiary["weapons\\plasma_cannon\\plasma_cannon"] =          "Tertiary: Fuel Rod"
  310.    
  311.     messages.quartenary = {}
  312.    
  313.     --                            Tag:                                    Message:
  314.     messages.quartenary[false] =                                           nil
  315.     messages.quartenary["weapons\\assault rifle\\assault rifle"] =        "Quartenary: Assault Rifle"
  316.     messages.quartenary["weapons\\plasma pistol\\plasma pistol"] =        "Quartenary: Plasma Pistol"
  317.     messages.quartenary["weapons\\needler\\mp_needler"] =                 "Quartenary: Needler"
  318.     messages.quartenary["weapons\\plasma rifle\\plasma rifle"] =          "Quartenary: Plasma Rifle"
  319.     messages.quartenary["weapons\\shotgun\\shotgun"] =                    "Quartenary: Shotgun"
  320.     messages.quartenary["weapons\\pistol\\pistol"] =                      "Quartenary: Pistol"
  321.     messages.quartenary["weapons\\sniper rifle\\sniper rifle"] =          "Quartenary: Sniper"
  322.     messages.quartenary["weapons\\flamethrower\\flamethrower"] =          "Quartenary: Flamethrower"
  323.     messages.quartenary["weapons\\rocket launcher\\rocket launcher"] =    "Quartenary: Rocket"
  324.     messages.quartenary["weapons\\plasma_cannon\\plasma_cannon"] =        "Quartenary: Fuel Rod"
  325.    
  326.     messages.grenades = {}
  327.    
  328.     --            Grenades:         Message:
  329.     messages.grenades[{0, 0}] =      nil
  330.     messages.grenades[{1, 0}] =     "A Frag Grenade"
  331.     messages.grenades[{2, 0}] =     "Two Frag Grenades"
  332.     messages.grenades[{0, 1}] =     "A Plasma Grenade"
  333.     messages.grenades[{0, 2}] =     "Two Plasma Grenades"
  334.     messages.grenades[{2, 2}] =     "Two of each Grenade"
  335.     messages.grenades[{4, 4}] =     "Four of each Grenade!"
  336.    
  337.     messages.ammo = {}
  338.    
  339.     --        Multiplier:          Message:
  340.     messages.ammo[1] =              nil
  341.     messages.ammo[2] =             "Double Ammo"
  342.     messages.ammo[3] =             "Triple Ammo"
  343.     messages.ammo[4] =             "Ammotacular!"
  344.     messages.ammo[math.inf] =      "Infinite Ammo!!"
  345.    
  346.     messages.special = {}
  347.    
  348.     --        Function:                            Message:
  349.     messages.special[{"setspeed", 1}] =             nil
  350.     messages.special[{"applycamo", 0}] =           "Invisibility!"
  351.     messages.special[{"applyos"}] =                "Overshield!"
  352.     messages.special[{"setspeed", 2}] =            "Double Speed!"
  353.     messages.special[{"oscamo", 0}] =              "Invisibility and Overshield!"
  354.     messages.special[{"camospeed", 0, 2}] =        "Invisibility and Double Speed!"
  355.     messages.special[{"speedos", 2}] =             "Double Speed and Overshield!"
  356.     messages.special[{"speedoscamo", 0, 2}] =      "Invisibility, Overshield and Double Speed!!"
  357.     messages.special[{"damagemultiply", 2}] =      "Double Damage!"
  358.     messages.special[{"healthmultiply", 2}] =      "Double Health and Shields!"
  359.    
  360.    
  361.     -- Attribute Recurrence Multipliers --
  362.    
  363.     recurrence = {}                            -- Multiplier used to change a player's probability of receiving the same attribute twice.
  364.                                                -- For example, if the recurrence multiplier of an Assault Rifle is 0.5 and a player spawns with an Assault Rifle, they will be half as likely to spawn with one next time.
  365.                                                -- The attribute recurrence multiplier is reversed when a player does not spawn with any given attribute twice in a row.
  366.                                                -- Set to 0 if you want it to be impossible to have the same exact attribute twice in a row; set it to 1 for attribute recurrence to have no effect.
  367.                                                -- These values should probably be below 1 unless you want to make it more likely to spawn with an attribute the more you spawn with it.
  368.    
  369.     recurrence.primary = {}    -- Attribute Recurrence Multipliers for Primary Weapons
  370.    
  371.     --                                Tag:                                Multiplier:       Description:
  372.     recurrence.primary[false] =                                             1.00            -- No Weapon
  373.     recurrence.primary["weapons\\assault rifle\\assault rifle"] =           0.60            -- Assault Rifle
  374.     recurrence.primary["weapons\\plasma pistol\\plasma pistol"] =           0.60            -- Plasma Pistol
  375.     recurrence.primary["weapons\\needler\\mp_needler"] =                    0.60            -- Needler
  376.     recurrence.primary["weapons\\plasma rifle\\plasma rifle"] =             0.65            -- Plasma Rifle
  377.     recurrence.primary["weapons\\shotgun\\shotgun"] =                       0.65            -- Shotgun
  378.     recurrence.primary["weapons\\pistol\\pistol"] =                         0.60            -- Pistol
  379.     recurrence.primary["weapons\\sniper rifle\\sniper rifle"] =             0.55            -- Sniper Rifle
  380.     recurrence.primary["weapons\\flamethrower\\flamethrower"] =             0.40            -- Flamethrower
  381.     recurrence.primary["weapons\\rocket launcher\\rocket launcher"] =       0.30            -- Rocket Launcher
  382.     recurrence.primary["weapons\\plasma_cannon\\plasma_cannon"] =           0.15            -- Fuel Rod
  383.    
  384.     recurrence.secondary = {}    -- Attribute Recurrence Multipliers for Secondary Weapons
  385.    
  386.         --                                Tag:                            Multiplier:       Description:
  387.     recurrence.secondary[false] =                                           1.00            -- No Weapon
  388.     recurrence.secondary["weapons\\assault rifle\\assault rifle"] =         0.60            -- Assault Rifle
  389.     recurrence.secondary["weapons\\plasma pistol\\plasma pistol"] =         0.60            -- Plasma Pistol
  390.     recurrence.secondary["weapons\\needler\\mp_needler"] =                  0.60            -- Needler
  391.     recurrence.secondary["weapons\\plasma rifle\\plasma rifle"] =           0.65            -- Plasma Rifle
  392.     recurrence.secondary["weapons\\shotgun\\shotgun"] =                     0.65            -- Shotgun
  393.     recurrence.secondary["weapons\\pistol\\pistol"] =                       0.60            -- Pistol
  394.     recurrence.secondary["weapons\\sniper rifle\\sniper rifle"] =           0.55            -- Sniper Rifle
  395.     recurrence.secondary["weapons\\flamethrower\\flamethrower"] =           0.40            -- Flamethrower
  396.     recurrence.secondary["weapons\\rocket launcher\\rocket launcher"] =     0.30            -- Rocket Launcher
  397.     recurrence.secondary["weapons\\plasma_cannon\\plasma_cannon"] =         0.15            -- Fuel Rod
  398.    
  399.     recurrence.tertiary = {}    -- Attribute Recurrence Multipliers for Tertiary Weapons
  400.                                 -- I've set this script up to not include Tertiary Weapon probabilities (other than No Weapon), therefore I have made all of these recurrences 1.0000.
  401.                                 -- Use Primary and Secondary Weapon Attribute Recurrence Multipliers for reference if you wish to change these values.
  402.    
  403.     --                                Tag:                                Multiplier:       Description:
  404.     recurrence.tertiary[false] =                                             1.00           -- No Weapon
  405.     recurrence.tertiary["weapons\\assault rifle\\assault rifle"] =           1.00           -- Assault Rifle
  406.     recurrence.tertiary["weapons\\plasma pistol\\plasma pistol"] =           1.00           -- Plasma Pistol
  407.     recurrence.tertiary["weapons\\needler\\mp_needler"] =                    1.00           -- Needler
  408.     recurrence.tertiary["weapons\\plasma rifle\\plasma rifle"] =             1.00           -- Plasma Rifle
  409.     recurrence.tertiary["weapons\\shotgun\\shotgun"] =                       1.00           -- Shotgun
  410.     recurrence.tertiary["weapons\\pistol\\pistol"] =                         1.00           -- Pistol
  411.     recurrence.tertiary["weapons\\sniper rifle\\sniper rifle"] =             1.00           -- Sniper Rifle
  412.     recurrence.tertiary["weapons\\flamethrower\\flamethrower"] =             1.00           -- Flamethrower
  413.     recurrence.tertiary["weapons\\rocket launcher\\rocket launcher"] =       1.00           -- Rocket Launcher
  414.     recurrence.tertiary["weapons\\plasma_cannon\\plasma_cannon"] =           1.00           -- Fuel Rod
  415.    
  416.     recurrence.quartenary = {}    -- Attribute Recurrence Multipliers for Quartenary Weapons
  417.                                   -- See Tertiary Weapon Attribute Recurrence Multipliers if you wish to change these values.
  418.    
  419.     --                                Tag:                                Multiplier:       Description:
  420.     recurrence.quartenary[false] =                                           1.00           -- No Weapon
  421.     recurrence.quartenary["weapons\\assault rifle\\assault rifle"] =         1.00           -- Assault Rifle
  422.     recurrence.quartenary["weapons\\plasma pistol\\plasma pistol"] =         1.00           -- Plasma Pistol
  423.     recurrence.quartenary["weapons\\needler\\mp_needler"] =                  1.00           -- Needler
  424.     recurrence.quartenary["weapons\\plasma rifle\\plasma rifle"] =           1.00           -- Plasma Rifle
  425.     recurrence.quartenary["weapons\\shotgun\\shotgun"] =                     1.00           -- Shotgun
  426.     recurrence.quartenary["weapons\\pistol\\pistol"] =                       1.00           -- Pistol
  427.     recurrence.quartenary["weapons\\sniper rifle\\sniper rifle"] =           1.00           -- Sniper Rifle
  428.     recurrence.quartenary["weapons\\flamethrower\\flamethrower"] =           1.00           -- Flamethrower
  429.     recurrence.quartenary["weapons\\rocket launcher\\rocket launcher"] =     1.00           -- Rocket Launcher
  430.     recurrence.quartenary["weapons\\plasma_cannon\\plasma_cannon"] =         1.00           -- Fuel Rod
  431.    
  432.     recurrence.grenades = {}    -- Attribute Recurrence Multipliers for Grenades
  433.    
  434.     --                 Frag,Plasma:    Multiplier:        Description:
  435.     recurrence.grenades[{0, 0}] =         1.00            -- No Grenades
  436.     recurrence.grenades[{1, 0}] =         0.95            -- One Frag
  437.     recurrence.grenades[{2, 0}] =         0.95            -- Two Frags
  438.     recurrence.grenades[{0, 1}] =         0.95            -- One Plasma
  439.     recurrence.grenades[{0, 2}] =         0.95            -- Two Plasmas
  440.     recurrence.grenades[{2, 2}] =         0.90            -- Two of Each
  441.     recurrence.grenades[{4, 4}] =         0.85            -- Four of Each
  442.    
  443.     recurrence.ammo = {}        -- Attribute Recurrence Multipliers for Ammo
  444.    
  445.     --    Ammo Multiplier:    Probability Multiplier:        Description:
  446.     recurrence.ammo[1] =                 1.00                -- Normal Ammo
  447.     recurrence.ammo[2] =                 0.90                -- Double Ammo
  448.     recurrence.ammo[3] =                 0.90                -- Triple Ammo
  449.     recurrence.ammo[4] =                 0.90                -- Ammotacular
  450.     recurrence.ammo[math.inf] =          0.05                -- Infinite Ammo
  451.    
  452.     recurrence.special = {}        -- Attribute Recurrence Multipliers for Special Attributes
  453.    
  454.     --                     Function:                Multiplier:       Description:
  455.     recurrence.special[{"setspeed", 1}] =             1.00            -- No Special
  456.     recurrence.special[{"applycamo", 0}] =            0.25            -- Camo
  457.     recurrence.special[{"applyos"}] =                 0.60            -- Overshield
  458.     recurrence.special[{"setspeed", 2}] =             0.25            -- Double Speed
  459.     recurrence.special[{"oscamo", 0}] =               0.20            -- Overshield and Camo
  460.     recurrence.special[{"camospeed", 0, 2}] =         0.10            -- Double Speed and Camo
  461.     recurrence.special[{"speedos", 2}] =              0.40            -- Double Speed and Overshield
  462.     recurrence.special[{"speedoscamo", 0, 2}] =       0.05            -- Double Speed, Overshield and Camo
  463.     recurrence.special[{"damagemultiply", 2}] =       0.10            -- Double Damage
  464.     recurrence.special[{"healthmultiply", 2}] =       0.05            -- Double Health and Shields
  465.    
  466.    
  467.     -- Ammo for Kills --
  468.    
  469.     ammo_for_kills =             true          -- Determines if a player receives an ammo prize for killing a player.  If this is false, all values in the bonus_ammo table are treated as 0.
  470.    
  471.     bonus_ammo = {}                            -- Bonus ammo for kills
  472.                                                -- Determines the amount of bonus ammo a player will receive for a kill depending on what weapon they are carrying.
  473.    
  474.     --       Tag:                                              Bonus Ammo:
  475.     bonus_ammo["weapons\\assault rifle\\assault rifle"] =          45
  476.     bonus_ammo["weapons\\needler\\mp_needler"] =                   15
  477.     bonus_ammo["weapons\\shotgun\\shotgun"] =                      8
  478.     bonus_ammo["weapons\\pistol\\pistol"] =                        8
  479.     bonus_ammo["weapons\\sniper rifle\\sniper rifle"] =            4
  480.     bonus_ammo["weapons\\flamethrower\\flamethrower"] =            25
  481.     bonus_ammo["weapons\\rocket launcher\\rocket launcher"] =      1
  482.    
  483.     -- Grenade Pickup Booleans --
  484.    
  485.     grenade_pickup =             false         -- Determines if players are able to pick up grenades found around the map.  If this is false, grenade_spawnmax is also treated as false.
  486.     grenade_spawnmax =           false         -- If true, players may only pick up grenades up to the amount they spawned with.  If false, players are not restricted to how many grenades they may pick up.
  487.    
  488.    
  489.     -- Jackpot Percentage --
  490.    
  491.     jackpot_percentage =         0.01          -- If the percentage probability of this attribute is less than or equal to the value specified, the word "Jackpot" will be printed before the default message (use 0 to disable).
  492.    
  493.    
  494.     -- Vehicle Weapon Operable Boolean --
  495.    
  496.     vehicle_weapon_operabale =   false         -- Determines if vehicle weapons are able to be used.  Return true if they should be, return false if they shouldn't be.
  497.    
  498.    
  499.     -- Vehicle Entry Booleans --
  500.    
  501.     enter_vehicle =              true         -- Determines if players should be able to enter vehicles.  If this is false, all other vehicle booleans are treated as false.
  502.     enter_vehicle_driver =       true         -- Determines if players should be able to enter vehicle driver's seats.
  503.     enter_vehicle_passenger =    true         -- Determines if players should be able to enter vehicle passenger's seats.
  504.     enter_vehicle_gunner =       true         -- Determines if players should be able to enter vehicle gunner's seats.
  505.    
  506.    
  507.     -- Object Spawn Booleans --
  508.    
  509.     objects = {}                               -- Determines if the specified tag will be spawned in the map.  Use true if you want the object to spawn normally, false if you don't want it to appear.
  510.                                                -- Note that these values are always treated as true when using createobject.
  511.    
  512.     -- Equipment --
  513.    
  514.     objects.eqip = {}
  515.    
  516.     --         Tag:                                              Boolean:         Description:
  517.     objects.eqip["powerups\\active camouflage"] =                true             -- Active Camouflage
  518.     objects.eqip["powerups\\over shield"] =                      true             -- Overshield
  519.     objects.eqip["powerups\\health pack"] =                      true             -- Health Pack
  520.     objects.eqip["weapons\\frag grenade\\frag grenade"] =        false            -- Frag Grenade
  521.     objects.eqip["weapons\\plasma grenade\\plasma grenade"] =    false            -- Plasma Grenade
  522.    
  523.     -- Projectiles --
  524.    
  525.     objects.proj = {}
  526.    
  527.     --         Tag:                                              Boolean:         Description:
  528.     objects.proj["weapons\\frag grenade\\frag grenade"] =        true             -- Frag Grenade
  529.     objects.proj["weapons\\plasma grenade\\plasma grenade"] =    true             -- Plasma Grenade
  530.     objects.proj["vehicles\\banshee\\banshee bolt"] =            true             -- Banshee Bolt
  531.     objects.proj["vehicles\\banshee\\mp_banshee fuel rod"] =     true             -- Banshee Fuel Rod
  532.     objects.proj["vehicles\\c gun turret\\mp gun turret"] =      true             -- Covenant Turret Bolt
  533.     objects.proj["vehicles\\ghost\\ghost bolt"] =                true             -- Ghost Bolt
  534.     objects.proj["vehicles\\scorpion\\bullet"] =                 true             -- Scorpion Bullet
  535.     objects.proj["vehicles\\scorpion\\tank shell"] =             true             -- Scorpion Shell
  536.     objects.proj["vehicles\\warthog\\bullet"] =                  true             -- Warthog Bullet
  537.     objects.proj["weapons\\assault rifle\\bullet"] =             true             -- Assault Rifle Bullet
  538.     objects.proj["weapons\\flamethrower\\flame"] =               true             -- Flamethrower Flame
  539.     objects.proj["weapons\\needler\\mp_needle"] =                true             -- Needler Needle
  540.     objects.proj["weapons\\pistol\\bullet"] =                    true             -- Pistol Bullet
  541.     objects.proj["weapons\\plasma pistol\\bolt"] =               true             -- Plasma Pistol Bolt
  542.     objects.proj["weapons\\plasma rifle\\bolt"] =                true             -- Plasma Rifle Bolt
  543.     objects.proj["weapons\\plasma rifle\\charged bolt"] =        true             -- Plasma Pistol Charged Bolt
  544.     objects.proj["weapons\\plasma_cannon\\plasma_cannon"] =      true             -- Fuel Rod Projectile
  545.     objects.proj["weapons\\rocket launcher\\rocket"] =           true             -- Rocket Launcher Rocket
  546.     objects.proj["weapons\\shotgun\\pellet"] =                   true             -- Shotgun Pellet
  547.     objects.proj["weapons\\sniper rifle\\sniper bullet"] =       true             -- Sniper Rifle Bullet
  548.    
  549.     -- Weapons --
  550.    
  551.     objects.weap = {}
  552.    
  553.     --         Tag:                                              Boolean:         Description:
  554.     objects.weap["vehicles\\banshee\\mp_banshee gun"] =          true             -- Banshee Gun
  555.     objects.weap["vehicles\\c gun turret\\mp gun turret gun"] =  true             -- Covenant Turret Gun
  556.     objects.weap["vehicles\\ghost\\mp_ghost gun"] =              true             -- Ghost Gun
  557.     objects.weap["vehicles\\rwarthog\\rwarthog_gun"] =           true             -- Rocket Warthog Gun
  558.     objects.weap["vehicles\\scorpion\\scorpion cannon"] =        true             -- Scorpion Cannon
  559.     objects.weap["vehicles\\warthog\\warthog gun"] =             true             -- Warthog Gun
  560.     objects.weap["weapons\\assault rifle\\assault rifle"] =      true             -- Assault Rifle
  561.     objects.weap["weapons\\ball\\ball"] =                        true             -- Oddball
  562.     objects.weap["weapons\\flag\\flag"] =                        true             -- Flag
  563.     objects.weap["weapons\\flamethrower\\flamethrower"] =        true             -- Flamethrower
  564.     objects.weap["weapons\\gravity rifle\\gravity rifle"] =      true             -- Gravity Rifle
  565.     objects.weap["weapons\\needler\\mp_needler"] =               true             -- Needler
  566.     objects.weap["weapons\\needler\\needler"] =                  true             -- Campaign Needler
  567.     objects.weap["weapons\\pistol\\pistol"] =                    true             -- Pistol
  568.     objects.weap["weapons\\plasma pistol\\plasma pistol"] =      true             -- Plasma Pistol
  569.     objects.weap["weapons\\plasma rifle\\plasma rifle"] =        true             -- Plasma Rifle
  570.     objects.weap["weapons\\plasma_cannon\\plasma_cannon"] =      true             -- Fuel Rod
  571.     objects.weap["weapons\\rocket launcher\\rocket launcher"] =  true             -- Rocket Launcher
  572.     objects.weap["weapons\\shotgun\\shotgun"] =                  true             -- Shotgun
  573.     objects.weap["weapons\\sniper rifle\\sniper rifle"] =        true             -- Sniper Rifle
  574.    
  575.     -- Vehicles by Map --
  576.    
  577.     vehicles = {}          -- Specifies if any vehicles spawn on the map.
  578.                            -- If this is false, all values in the objects.vehi table are ignored.
  579.    
  580.     --       Map:                  Boolean:      Description:
  581.     vehicles.beavercreek =          false        -- Battle Creek
  582.     vehicles.bloodgulch =           false        -- Bloodgulch
  583.     vehicles.boardingaction =       false        -- Boarding Action
  584.     vehicles.carousel =             false        -- Derelict
  585.     vehicles.chillout =             false        -- Chillout
  586.     vehicles.damnation =            false        -- Damnation
  587.     vehicles.dangercanyon =         true         -- Danger Canyon
  588.     vehicles.deathisland =          true         -- Death Island
  589.     vehicles.gephyrophobia =        true         -- Gephyrophobia
  590.     vehicles.hangemhigh =           false        -- Hang 'em High
  591.     vehicles.icefields =            true         -- Ice Fields
  592.     vehicles.infinity =             true         -- Infinity
  593.     vehicles.longest =              false        -- Longest
  594.     vehicles.prisoner =             false        -- Prisoner
  595.     vehicles.putput =               false        -- Chiron TL34
  596.     vehicles.ratrace =              false        -- Rat Race
  597.     vehicles.sidewinder =           true         -- Sidewinder
  598.     vehicles.timberland =           true         -- Timberland
  599.     vehicles.wizard =               false        -- Wizard
  600.    
  601.     -- Vehicles --
  602.    
  603.     objects.vehi = {}
  604.    
  605.     --         Tag:                                              Boolean:         Description:
  606.     objects.vehi["vehicles\\banshee\\banshee_mp"] =              true             -- Banshee
  607.     objects.vehi["vehicles\\c gun turret\\c gun turret_mp"] =    true             -- Covenant Turret
  608.     objects.vehi["vehicles\\ghost\\ghost_mp"] =                  true             -- Ghost
  609.     objects.vehi["vehicles\\rwarthog\\rwarthog"] =               true             -- Rocket Warthog
  610.     objects.vehi["vehicles\\scorpion\\scorpion_mp"] =            true             -- Scorpion
  611.     objects.vehi["vehicles\\warthog\\mp_warthog"] =              true             -- Warthog
  612.    
  613.    
  614. -- **Don't mess with anything below this line unless you know what you're doing** --
  615.  
  616.     Game = game
  617.    
  618.     -- Individual Probabilities --
  619.    
  620.     players = {}
  621.     attributes = {}
  622.    
  623.     -- Gametype Information --
  624.    
  625.     gametypeinfo()
  626. end
  627.  
  628. --[[
  629. function OnScriptUnload()
  630.  
  631.  
  632. end
  633. --]]
  634.  
  635. function OnNewGame(map)
  636.  
  637.     this_map = map
  638. end
  639.  
  640. --[[
  641. function OnGameEnd(stage)
  642.  
  643.     -- stage 1: F1 Screen
  644.     -- stage 2: PGCR Appears
  645.     -- stage 3: Players may quit
  646. end
  647. --]]
  648.  
  649. --[[
  650. function OnServerChat(player, type, message)
  651.    
  652.     --return true, message, type
  653. end
  654. --]]
  655.  
  656. --[[
  657. function OnServerCommandAttempt(player, command, password)
  658.  
  659.     --return true
  660. end
  661. --]]
  662.  
  663. --[[
  664. function OnServerCommand(admin, command)
  665.  
  666.     --return true
  667. end
  668. --]]
  669.  
  670. --[[
  671. function OnNameRequest(hash, name)
  672.  
  673.     --return true, name
  674. end
  675. --]]
  676.  
  677. --[[
  678. function OnBanCheck(hash, ip)
  679.    
  680.     --return true
  681. end
  682. --]]
  683.  
  684. function OnPlayerJoin(player)
  685.  
  686.     local hash = gethash(player)
  687.     newplayer(hash)
  688.     generate(player)
  689. end
  690.  
  691. function OnPlayerLeave(player)
  692.  
  693.     local hash = gethash(player)
  694.     playerleave(hash)
  695. end
  696.  
  697. function OnPlayerKill(killer, victim, mode)
  698.  
  699.     setspeed(victim, 1)
  700.     damagemultiply(victim, 1)
  701.     healthmultiply(victim, 1)
  702.     generate(victim)
  703.    
  704.     if killer then
  705.         if ammo_for_kills then
  706.             local hash = gethash(killer)
  707.             for type,key in pairs(attributes[hash]) do
  708.                 if bonus_ammo[key] then
  709.                     if type == "primary" or type == "secondary" or type == "tertiary" or type == "quartenary" then
  710.                         local slot = 0x2F8
  711.                         if type == "secondary" then
  712.                             slot = 0x2F8 + 4
  713.                         elseif type == "tertiary" then
  714.                             slot = 0x2F8 + 8
  715.                         elseif type == "quartenary" then
  716.                             slot = 0x2F8 + 12
  717.                         end
  718.                         local m_player = getplayer(killer)
  719.                         if m_player then
  720.                             local objId = readdword(m_player, 0x34)
  721.                             local m_object = getobject(objId)
  722.                             if m_object then
  723.                                 local weapId = readdword(m_object, slot)
  724.                                 local m_weapon = getobject(weapId)
  725.                                 if m_weapon then
  726.                                     local cur_ammo = readword(m_weapon, 0x2B6)
  727.                                     writeword(m_weapon, 0x2B6, cur_ammo + bonus_ammo[key])
  728.                                     updateammo(weapId)
  729.                                 end
  730.                             end
  731.                         end
  732.                     end
  733.                 end
  734.             end
  735.         end
  736.     end
  737. end
  738.  
  739. --[[
  740. function OnKillMultiplier(player, multiplier)
  741.  
  742.     -- Multipliers:
  743.     -- 7: Double Kill
  744.     -- 9: Triple Kill
  745.     -- 10: Killtacular
  746.     -- 11: Killing Spree
  747.     -- 12: Running Riot
  748.     -- 16: Double Kill w/ Score
  749.     -- 17: Triple Kill w/ Score
  750.     -- 14: Killtacular w/ Score
  751.     -- 18: Killing Spree w/ Score
  752.     -- 17: Running Riot w/ Score
  753. end
  754. --]]
  755.  
  756. function OnPlayerSpawn(player)
  757.    
  758.     local hash = gethash(player)
  759.    
  760.     local frags = attributes[hash].grenades[1]
  761.     local plasmas = attributes[hash].grenades[2]
  762.    
  763.     local m_player = getplayer(player)
  764.     local objId = readdword(m_player, 0x34)
  765.     local m_object = getobject(objId)
  766.    
  767.     writebyte(m_object, 0x31E, frags)
  768.     writebyte(m_object, 0x31F, plasmas)
  769. end
  770.  
  771. function OnPlayerSpawnEnd(player)
  772.  
  773.     local hash = gethash(player)
  774.    
  775.     -- Additional Weapon Assignments --
  776.    
  777.     if attributes[hash].tertiary and attributes[hash].quartenary then
  778.         local weapId1 = createobject(gettagid("weap", attributes[hash].quartenary), 0, 0, false, 0, 0, -100)
  779.         local m_weapon1 = getobject(weapId1)
  780.         if m_weapon1 then
  781.             assignweapon(player, weapId1)
  782.         end
  783.         local weapId2 = createobject(gettagid("weap", attributes[hash].primary), 0, 0, false, 0, 0, -100)
  784.         local m_weapon2 = getobject(weapId2)
  785.         if m_weapon2 then
  786.             assignweapon(player, weapId2)
  787.         end
  788.     elseif attributes[hash].tertiary then
  789.         local weapId = createobject(gettagid("weap", attributes[hash].primary), 0, 0, false, 0, 0, -100)
  790.         local m_weapon = getobject(weapId)
  791.         if m_weapon then
  792.             assignweapon(player, weapId)
  793.         end
  794.     end
  795.    
  796.     attributeprint(player, "primary", attributes[hash].primary)
  797.    
  798.     if attributes[hash].primary ~= attributes[hash].secondary then
  799.         attributeprint(player, "secondary", attributes[hash].secondary)
  800.     end
  801.    
  802.     if attributes[hash].primary ~= attributes[hash].tertiary and attributes[hash].secondary ~= attributes[hash].tertiary then
  803.         attributeprint(player, "tertiary", attributes[hash].tertiary)
  804.     end
  805.    
  806.     if attributes[hash].primary ~= attributes[hash].quartenary and attributes[hash].secondary ~= attributes[hash].quartenary and attributes[hash].tertiary ~= attributes[hash].quartenary then
  807.         attributeprint(player, "quartenary", attributes[hash].quartenary)
  808.     end
  809.    
  810.     -- Ammo Assignments --
  811.    
  812.     local m_player = getplayer(player)
  813.     local objId = readdword(m_player, 0x34)
  814.     local m_object = getobject(objId)
  815.    
  816.     -- Plasma weapon check
  817.    
  818.     local plasma = false
  819.    
  820.     for i = 0,3 do
  821.         local weapId = readdword(m_object, 0x2F8 + (i * 4))
  822.         local m_weapon = getobject(weapId)
  823.         if m_weapon then
  824.             local mapId = readdword(m_weapon)
  825.             local tagname = gettaginfo(mapId)
  826.             if string.find(tagname, "plasma") then
  827.                 plasma = true
  828.                 break
  829.             end
  830.         end
  831.     end
  832.    
  833.     for i = 0,3 do
  834.         local weapId = readdword(m_object, 0x2F8 + (i * 4))
  835.         local m_weapon = getobject(weapId)
  836.         if m_weapon then
  837.             if attributes[hash].ammo == 0 then
  838.                 writefloat(m_weapon, 0x240, 1)
  839.                 writeword(m_weapon, 0x2B6, 0)
  840.                 writeword(m_weapon, 0x2B8, 0)
  841.             end
  842.            
  843.             if not plasma then
  844.                 if attributes[hash].ammo == math.inf then
  845.                     writeword(m_weapon, 0x2B6, 9999)
  846.                     writeword(m_weapon, 0x2B8, 9999)
  847.                     infiniteammo(player)
  848.                 else
  849.                     local ammo = readword(m_weapon, 0x2B6)
  850.                     writeword(m_weapon, 0x2B6, ammo * attributes[hash].ammo)
  851.                 end
  852.             end
  853.            
  854.             updateammo(weapId)
  855.         end
  856.     end
  857.    
  858.     if not plasma or attributes[hash].ammo == 0 then
  859.         attributeprint(player, "ammo", attributes[hash].ammo)
  860.     end
  861.    
  862.     -- Grenade Message --
  863.    
  864.     attributeprint(player, "grenades", attributes[hash].grenades)
  865.    
  866.     -- Special Assignments --
  867.    
  868.     local foo = _G[attributes[hash].special[1]]
  869.     local executed = foo(player, table.unpack(attributes[hash].special, 2, #attributes[hash].special))
  870.    
  871.     if executed then
  872.         attributeprint(player, "special", attributes[hash].special)
  873.     end
  874. end
  875.  
  876. function OnWeaponAssignment(player, objId, slot, weapId)
  877.    
  878.     if player then
  879.         local hash = gethash(player)
  880.        
  881.         if slot == 0 then
  882.             if attributes[hash].tertiary then
  883.                 return gettagid("weap", attributes[hash].secondary)
  884.             else
  885.                 return gettagid("weap", attributes[hash].primary)
  886.             end
  887.         elseif slot == 1 then
  888.             if attributes[hash].tertiary then
  889.                 return gettagid("weap", attributes[hash].tertiary)
  890.             else
  891.                 if attributes[hash].secondary then
  892.                     return gettagid("weap", attributes[hash].secondary)
  893.                 end
  894.             end
  895.         end
  896.        
  897.         return -1
  898.     else
  899.         if not vehicle_weapon_operable then
  900.             return -1
  901.         end
  902.     end
  903. end
  904.  
  905. --[[
  906. function OnWeaponReload(player, weapId)
  907.  
  908.     --return true
  909. end
  910. --]]
  911.  
  912. function OnObjectCreationAttempt(mapId, parentId, player)
  913.    
  914.     local tagname, tagtype = gettaginfo(mapId)
  915.     if tagtype == "vehi" then
  916.         return vehicles[this_map]
  917.     end
  918.    
  919.     if objects[tagtype] then
  920.         return objects[tagtype][tagname]
  921.     end
  922. end
  923.  
  924. --[[
  925. function OnObjectCreation(objId)
  926.  
  927.    
  928. end
  929. --]]
  930.  
  931. function OnObjectInteraction(player, objId, mapId)
  932.  
  933.  
  934.     local hash = gethash(player)
  935.    
  936.     local tagname, tagtype = gettaginfo(mapId)
  937.     if tagtype == "weap" then
  938.         if tagname == attributes[hash].primary or tagname == attributes[hash].secondary or tagname == attributes[hash].tertiary or tagname == attributes[hash].quartenary or tagname == "weapons\\flag\\flag" or tagname == "weapons\\ball\\ball" then
  939.             return true
  940.         else
  941.             return false
  942.         end
  943.     elseif tagtype == "eqip" then
  944.         if string.find(tagname, "grenade") then
  945.             if grenade_pickup then
  946.                 if grenade_spawnmax then
  947.                     local max_frags = attributes[hash].grenades[1]
  948.                     local max_plasmas = attributes[hash].grenades[2]
  949.                     local m_player = getplayer(player)
  950.                     if m_player then
  951.                         local objId = readdword(m_player, 0x34)
  952.                         local m_object = getobject(objId)
  953.                         if m_object then
  954.                             local frags = readbyte(m_object, 0x31E)
  955.                             local plasmas = readbyte(m_object, 0x31F)
  956.                             if tagname == "weapons\\frag grenade\\frag grenade" then
  957.                                 if frags < max_frags then
  958.                                     return true
  959.                                 else
  960.                                     return false
  961.                                 end
  962.                             elseif tagname == "weapons\\plasma grenade\\plasma grenade" then
  963.                                 if plasmas < max_plasmas then
  964.                                     return true
  965.                                 else
  966.                                     return false
  967.                                 end
  968.                             end
  969.                         end
  970.                     end
  971.                    
  972.                     return true
  973.                 end
  974.                
  975.                 return true
  976.             else
  977.                 return false
  978.             end
  979.         end
  980.     end
  981. end
  982.  
  983. --[[
  984. function OnTeamDecision(team)
  985.    
  986.     --return team
  987. end
  988. --]]
  989.  
  990. --[[
  991. function OnTeamChange(player, old_team, new_team, voluntary)
  992.    
  993.     --return true
  994. end
  995. --]]
  996.  
  997. damage_multiplier = {}
  998. health_multiplier = {}
  999.  
  1000. function OnDamageLookup(receiver, causer, mapId)
  1001.    
  1002.     if causer then
  1003.         local c_player = objectidtoplayer(causer)
  1004.         if c_player then
  1005.             local m_player = getplayer(c_player)
  1006.             if m_player then
  1007.                 local hash = gethash(c_player)
  1008.                 if hash then
  1009.                     for k,v in pairs(damage_multiplier) do
  1010.                         if k == hash then
  1011.                             odl_multiplier(2)
  1012.                             return true
  1013.                         end
  1014.                     end
  1015.                 end
  1016.             end
  1017.         end
  1018.     end
  1019.    
  1020.     if receiver then
  1021.         local r_player = objectidtoplayer(receiver)
  1022.         if r_player then
  1023.             local m_player = getplayer(r_player)
  1024.             if m_player then
  1025.                 local hash = gethash(r_player)
  1026.                 if hash then
  1027.                     for k,v in pairs(health_multiplier) do
  1028.                         if k == hash then
  1029.                             odl_multiplier(0.5)
  1030.                             return true
  1031.                         end
  1032.                     end
  1033.                 end
  1034.             end
  1035.         end
  1036.     end
  1037. end
  1038.  
  1039. --[[
  1040. function OnDamageApplication(receiver, causer, mapId, location, backtap)
  1041.    
  1042.     --return true
  1043. end
  1044. --]]
  1045.  
  1046. function OnVehicleEntry(player, vehiId, seat, mapId, voluntary)
  1047.    
  1048.     if enter_vehicle then
  1049.         if seat == 0 then
  1050.             return enter_vehicle_driver
  1051.         elseif seat == 2 then
  1052.             local tagname = gettaginfo(mapId)
  1053.             if tagname == "vehicles\\warthog\\mp_warthog" or tagname == "vehicles\\rwarthog\\rwarthog" then
  1054.                 return enter_vehicle_gunner
  1055.             else
  1056.                 return enter_vehicle_passenger
  1057.             end
  1058.         else
  1059.             return enter_vehicle_passenger
  1060.         end
  1061.     else
  1062.         return false
  1063.     end
  1064. end
  1065.  
  1066. --[[
  1067. function OnVehicleEject(player, voluntary)
  1068.  
  1069.     --return true
  1070. end
  1071. --]]
  1072.  
  1073. --[[
  1074. function OnClientUpdate(player)
  1075.  
  1076.  
  1077. end
  1078. --]]
  1079.  
  1080. -- Global Variables --
  1081.  
  1082. cur_players = 0
  1083. math.inf = 1 / 0
  1084. math.randomseed(os.time())
  1085.  
  1086. function gametypeinfo()
  1087.  
  1088.     local gametype_base
  1089.     if Game == "PC" then
  1090.         gametype_base = 0x671340
  1091.     else
  1092.         gametype_base = 0x5F5498
  1093.     end
  1094.    
  1095.     local gametype_game = readbyte(gametype_base, 0x30)
  1096.     local gametype_parameters = readbyte(gametype_base, 0x38)
  1097.     local binary = convertbase(gametype_parameters, 2)
  1098.     gametype_shields = false
  1099.     gametype_speed = false
  1100.     gametype_phantom = false
  1101.  
  1102.     if string.sub(binary, -4, -4) == "0" then
  1103.         gametype_shields = true
  1104.     end
  1105.    
  1106.     if string.sub(binary, -5, -5) == "1" then
  1107.         gametype_phantom = true
  1108.     end
  1109.    
  1110.     if gametype_game == 1 or gametype_game == 2 or gametype_game == 4 then
  1111.         gametype_speed = true
  1112.     end
  1113. end
  1114.  
  1115. -- General Functions --
  1116.  
  1117. phasor_createobject = createobject
  1118.  
  1119. function createobject(mapId, parentId, respawn_time, respawn_bool, x, y, z)
  1120.  
  1121.     local tagname, tagtype = gettaginfo(mapId)
  1122.     if tagname then
  1123.         local orig = objects[tagtype][tagname]
  1124.         objects[tagtype][tagname] = true
  1125.         local objId = phasor_createobject(mapId, parentId, respawn_time, respawn_bool, x, y, z)
  1126.         objects[tagtype][tagname] = orig
  1127.         return objId
  1128.     end
  1129. end
  1130.  
  1131. function newplayer(hash)
  1132.  
  1133.     players[hash] = {}
  1134.     players[hash].probability = probability
  1135.     players[hash].messages = messages
  1136.     players[hash].multiplier = multiplier
  1137.     players[hash].recurrence = recurrence
  1138.    
  1139.     for type,_ in pairs(players[hash].probability) do
  1140.         for key,v in pairs(players[hash].probability[type]) do
  1141.             local mult = getinfo(nil, "multiplier", type, key)
  1142.             local prob = getinfo(hash, "probability", type, key)
  1143.             setinfo(hash, "probability", type, key, prob * (mult ^ cur_players))
  1144.         end
  1145.     end
  1146.    
  1147.     cur_players = cur_players + 1
  1148.    
  1149.     for i = 0,15 do
  1150.         if getplayer(i) then
  1151.             local hash = gethash(i)
  1152.             for type,_ in pairs(players[hash].probability) do
  1153.                 for key,v in pairs(players[hash].probability[type]) do
  1154.                     local mult = getinfo(nil, "multiplier", type, key)
  1155.                     local prob = getinfo(hash, "probability", type, key)
  1156.                     setinfo(hash, "probability", type, key, prob * mult)
  1157.                 end
  1158.             end
  1159.         end
  1160.     end
  1161. end
  1162.  
  1163. function playerleave(hash)
  1164.  
  1165.     for i = 0,15 do
  1166.         if getplayer(i) then
  1167.             local hash = gethash(i)
  1168.             for type,_ in pairs(players[hash].probability) do
  1169.                 for key,v in pairs(players[hash].probability[type]) do
  1170.                     local mult = getinfo(nil, "multiplier", type, key)
  1171.                     local prob = getinfo(hash, "probability", type, key)
  1172.                     setinfo(hash, "probability", type, key, prob / mult)
  1173.                 end
  1174.             end
  1175.         end
  1176.     end
  1177.    
  1178.     players[hash] = nil
  1179.     cur_players = cur_players - 1
  1180. end
  1181.  
  1182. function getinfo(hash, table, type, key)
  1183.  
  1184.     if hash then
  1185.         if players[hash] then
  1186.             if players[hash][table] then
  1187.                 if players[hash][table][type] then
  1188.                     for k,v in pairs(players[hash][table][type]) do
  1189.                         if equals(k, key) then
  1190.                             return players[hash][table][type][k]
  1191.                         end
  1192.                     end
  1193.                 end
  1194.             end
  1195.         end
  1196.     else
  1197.         for k,v in pairs(_G[table][type]) do
  1198.             if equals(k, key) then
  1199.                 return _G[table][type][k]
  1200.             end
  1201.         end
  1202.     end
  1203. end
  1204.  
  1205. function setinfo(hash, table, type, key, val)
  1206.  
  1207.     if hash then
  1208.         if players[hash] then
  1209.             if players[hash][table] then
  1210.                 if players[hash][table][type] then
  1211.                     for k,v in pairs(players[hash][table][type]) do
  1212.                         if equals(k, key) then
  1213.                             players[hash][table][type][k] = val
  1214.                         end
  1215.                     end
  1216.                 end
  1217.             end
  1218.         end
  1219.     else
  1220.         for k,v in pairs(_G[table][type]) do
  1221.             if equals(k, key) then
  1222.                 _G[table][type][k] = val
  1223.             end
  1224.         end
  1225.     end
  1226. end
  1227.  
  1228. function equals(val1, val2)
  1229.  
  1230.     if type(val1) == type(val2) then
  1231.         if type(val1) == "number" or type(val1) == "string" or type(val1) == "boolean" then
  1232.             return val1 == val2
  1233.         elseif type(val1) == "table" then
  1234.             for k,v in pairs(val1) do
  1235.                 local found = false
  1236.                 for k2,v2 in pairs(val2) do
  1237.                     if equals(k, k2) then
  1238.                         found = true
  1239.                         if not equals(v, v2) then
  1240.                             return false
  1241.                         end
  1242.                         break
  1243.                     end
  1244.                 end
  1245.  
  1246.                 if not found then
  1247.                     return false
  1248.                 end
  1249.             end
  1250.  
  1251.             return true
  1252.         end
  1253.     end
  1254. end
  1255.  
  1256. function generate(player)
  1257.  
  1258.     local hash = gethash(player)
  1259.    
  1260.     attributes[hash] = attributes[hash] or {}
  1261.    
  1262.     local temp = {}
  1263.     local override = {}
  1264.    
  1265.     temp.primary = {}
  1266.     temp.secondary = {}
  1267.     temp.tertiary = {}
  1268.     temp.quartenary = {}
  1269.     temp.grenades = {}
  1270.     temp.ammo = {}
  1271.     temp.special = {}
  1272.    
  1273.     for type,_ in pairs(players[hash].probability) do
  1274.        
  1275.         if attributes[hash][type] then
  1276.             -- Attribute Recurrence Multiplier
  1277.             local prob = getinfo(hash, "probability", type, attributes[hash][type])
  1278.             local attribute_recurrence = getinfo(hash, "recurrence", type, attributes[hash][type])
  1279.             if attribute_recurrence == 0 then
  1280.                 temp[type][attributes[hash][type]] = getinfo(hash, "probability", type, attributes[hash][type])
  1281.             end
  1282.             setinfo(hash, "probability", type, attributes[hash][type], prob * attribute_recurrence)
  1283.         end
  1284.        
  1285.         local sum = table.sum(players[hash].probability[type])
  1286.         local rand = randomnumber(0, sum)      
  1287.         local max = 0
  1288.         local found = false
  1289.        
  1290.         for key,v in pairs(players[hash].probability[type]) do
  1291.             if v ~= 0 then
  1292.                 max = max + v
  1293.                 if rand < max then
  1294.                     if not found then
  1295.                         attributes[hash][type] = key
  1296.                         found = true
  1297.                     end
  1298.                 else
  1299.                     -- Attribute Recurrence Cooldown
  1300.                     local attribute_recurrence = getinfo(hash, "recurrence", type, key)
  1301.                     if attribute_recurrence < 1 then
  1302.                         setinfo(hash, "probability", type, key, math.min(getinfo(hash, "probability", type, key) / attribute_recurrence, getinfo(nil, "probability", type, key)))
  1303.                     elseif attribute_recurrence > 1 then
  1304.                         setinfo(hash, "probability", type, key, math.max(getinfo(hash, "probability", type, key) / attribute_recurrence, getinfo(nil, "probability", type, key)))
  1305.                     end
  1306.                 end
  1307.             end
  1308.         end
  1309.        
  1310.         if type == "primary" then
  1311.             if attributes[hash][type] == false then
  1312.                 override.secondary = false
  1313.                 override.tertiary = false
  1314.                 override.quartenary = false
  1315.             else
  1316.                 temp.secondary[attributes[hash][type]] = getinfo(hash, "probability", "secondary", attributes[hash][type])
  1317.                 temp.tertiary[attributes[hash][type]] = getinfo(hash, "probability", "tertiary", attributes[hash][type])
  1318.                 temp.quartenary[attributes[hash][type]] = getinfo(hash, "probability", "quartenary", attributes[hash][type])
  1319.                 setinfo(hash, "probability", "secondary", attributes[hash][type], 0)
  1320.                 setinfo(hash, "probability", "tertiary", attributes[hash][type], 0)
  1321.                 setinfo(hash, "probability", "quartenary", attributes[hash][type], 0)
  1322.             end
  1323.         elseif type == "secondary" then
  1324.             if attributes[hash][type] == false then
  1325.                 override.tertiary = false
  1326.                 override.quartenary = false
  1327.             else
  1328.                 temp.tertiary[attributes[hash][type]] = getinfo(hash, "probability", "tertiary", attributes[hash][type])
  1329.                 temp.quartenary[attributes[hash][type]] = getinfo(hash, "probability", "quartenary", attributes[hash][type])
  1330.                 setinfo(hash, "probability", "tertiary", attributes[hash][type], 0)
  1331.                 setinfo(hash, "probability", "quartenary", attributes[hash][type], 0)
  1332.             end
  1333.         elseif type == "tertiary" then
  1334.             if attributes[hash][type] == false then
  1335.                 override.quartenary = false
  1336.             else
  1337.                 temp.quartenary[attributes[hash][type]] = getinfo(hash, "probability", "quartenary", attributes[hash][type])
  1338.                 setinfo(hash, "probability", "quartenary", attributes[hash][type], 0)
  1339.             end
  1340.         end
  1341.     end
  1342.    
  1343.     for type,_ in pairs(temp) do
  1344.         for key,v in pairs(temp) do
  1345.             setinfo(hash, "probability", type, key, v)
  1346.         end
  1347.     end
  1348.    
  1349.     for type,v in pairs(override) do
  1350.         attributes[hash][type] = v
  1351.     end
  1352. end
  1353.  
  1354. function attributeprint(player, type, key)
  1355.  
  1356.     local hash = gethash(player)
  1357.    
  1358.     local message = getinfo(hash, "messages", type, key)
  1359.     if message then
  1360.         local percent = getinfo(hash, "probability", type, key) / table.sum(players[hash].probability[type])
  1361.         if percent < jackpot_percentage and percent > 0 then
  1362.             message = "JACKPOT: " .. message .. " [" .. math.round(percent * 100, 2) .. "%]"
  1363.         end
  1364.        
  1365.         sendconsoletext(player, message, 10, order[type], "center", isalive)
  1366.     end
  1367. end
  1368.  
  1369. order = {}
  1370. order.primary = 1
  1371. order.secondary = 2
  1372. order.tertiary = 3
  1373. order.quartenary = 4
  1374. order.grenades = 5
  1375. order.ammo = 6
  1376. order.special = 7
  1377.  
  1378. console = {}
  1379. console.__index = console
  1380. registertimer(100, "ConsoleTimer")
  1381. phasor_sendconsoletext = sendconsoletext
  1382. math.inf = 1 / 0
  1383.  
  1384. function sendconsoletext(player, message, time, order, align, func)
  1385.  
  1386.     if use_console then
  1387.  
  1388.         console[player] = console[player] or {}
  1389.        
  1390.         local temp = {}
  1391.         temp.player = player
  1392.         temp.id = nextid(player, order)
  1393.         temp.message = message or ""
  1394.         temp.time = time or 5
  1395.         temp.remain = temp.time
  1396.         temp.align = align or "left"
  1397.        
  1398.         if type(func) == "function" then
  1399.             temp.func = func
  1400.         elseif type(func) == "string" then
  1401.             temp.func = _G[func]
  1402.         end
  1403.        
  1404.         console[player][temp.id] = temp
  1405.         setmetatable(console[player][temp.id], console)
  1406.         return console[player][temp.id]
  1407.        
  1408.     else
  1409.         privatesay(player, message, false)
  1410.     end
  1411. end
  1412.  
  1413. function nextid(player, order)
  1414.  
  1415.     if not order then
  1416.         local x = 0
  1417.         for k,v in pairs(console[player]) do
  1418.             if k > x + 1 then
  1419.                 return x + 1
  1420.             end
  1421.            
  1422.             x = x + 1
  1423.         end
  1424.        
  1425.         return x + 1
  1426.     else
  1427.         local original = order
  1428.         while console[player][order] do
  1429.             order = order + 0.001
  1430.             if order == original + 0.999 then break end
  1431.         end
  1432.        
  1433.         return order
  1434.     end
  1435. end
  1436.  
  1437. function getmessage(player, order)
  1438.  
  1439.     if console[player] then
  1440.         if order then
  1441.             return console[player][order]
  1442.         end
  1443.     end
  1444. end
  1445.  
  1446. function getmessages(player)
  1447.  
  1448.     return console[player]
  1449. end
  1450.  
  1451. function getmessageblock(player, order)
  1452.  
  1453.     local temp = {}
  1454.    
  1455.     for k,v in pairs(console[player]) do
  1456.         if k >= order and k < order + 1 then
  1457.             table.insert(temp, console[player][k])
  1458.         end
  1459.     end
  1460.    
  1461.     return temp
  1462. end
  1463.  
  1464. function console:getmessage()
  1465.  
  1466.     return self.message
  1467. end
  1468.  
  1469. function console:append(message, reset)
  1470.  
  1471.     if console[self.player] then
  1472.         if console[self.player][self.id] then
  1473.             if getplayer(self.player) then
  1474.                 if reset then
  1475.                     if reset == true then
  1476.                         console[self.player][self.id].remain = console[self.player][self.id].time
  1477.                     elseif tonumber(reset) then
  1478.                         console[self.player][self.id].time = tonumber(reset)
  1479.                         console[self.player][self.id].remain = tonumber(reset)
  1480.                     end
  1481.                 end
  1482.                
  1483.                 console[self.player][self.id].message = message or ""
  1484.                 return true
  1485.             end
  1486.         end
  1487.     end
  1488. end
  1489.  
  1490. function console:shift(order)
  1491.  
  1492.     local temp = console[self.player][self.id]
  1493.     console[self.player][self.id] = console[self.player][order]
  1494.     console[self.player][order] = temp
  1495. end
  1496.  
  1497. function console:pause(time)
  1498.  
  1499.     console[self.player][self.id].pausetime = time or 5
  1500. end
  1501.  
  1502. function console:delete()
  1503.  
  1504.     console[self.player][self.id] = nil
  1505. end
  1506.  
  1507. function ConsoleTimer(id, count)
  1508.  
  1509.     for i,_ in opairs(console) do
  1510.         if tonumber(i) then
  1511.             if getplayer(i) then
  1512.                 for k,v in opairs(console[i]) do
  1513.                     if console[i][k].pausetime then
  1514.                         console[i][k].pausetime = console[i][k].pausetime - 0.1
  1515.                         if console[i][k].pausetime <= 0 then
  1516.                             console[i][k].pausetime = nil
  1517.                         end
  1518.                     else
  1519.                         if console[i][k].func then
  1520.                             if not console[i][k].func(i) then
  1521.                                 console[i][k] = nil
  1522.                             end
  1523.                         end
  1524.                        
  1525.                         if console[i][k] then
  1526.                             console[i][k].remain = console[i][k].remain - 0.1
  1527.                             if console[i][k].remain <= 0 then
  1528.                                 console[i][k] = nil
  1529.                             end
  1530.                         end
  1531.                     end
  1532.                 end
  1533.                
  1534.                 if table.len(console[i]) > 0 then
  1535.                    
  1536.                     local paused = 0
  1537.                     for k,v in pairs(console[i]) do
  1538.                         if console[i][k].pausetime then
  1539.                             paused = paused + 1
  1540.                         end
  1541.                     end
  1542.                    
  1543.                     if paused < table.len(console[i]) then
  1544.                         local str = ""
  1545.                         for i = 0,30 do
  1546.                             str = str .. " \n"
  1547.                         end
  1548.                        
  1549.                         --phasor_sendconsoletext(i, str)
  1550.                        
  1551.                         for k,v in opairs(console[i]) do
  1552.                             if not console[i][k].pausetime then
  1553.                                 if console[i][k].align == "right" or console[i][k].align == "center" then
  1554.                                     str = str .. consolecenter(string.sub(console[i][k].message, 1, 78)) .. "\n"
  1555.                                     --phasor_sendconsoletext(i, consolecenter(string.sub(console[i][k].message, 1, 78)))
  1556.                                 else
  1557.                                     str = str .. string.sub(console[i][k].message, 1, 78) .. "\n"
  1558.                                     --phasor_sendconsoletext(i, string.sub(console[i][k].message, 1, 78))
  1559.                                 end
  1560.                             end
  1561.                         end
  1562.                        
  1563.                         phasor_sendconsoletext(i, str)
  1564.                     end
  1565.                 end
  1566.             else
  1567.                 console[i] = nil
  1568.             end
  1569.         end
  1570.     end
  1571.    
  1572.     return true
  1573. end
  1574.  
  1575. function consolecenter(text)
  1576.  
  1577.     if text then
  1578.         local len = string.len(text)
  1579.         for i = len + 1, 78 do
  1580.             text = " " .. text
  1581.         end
  1582.        
  1583.         return text
  1584.     end
  1585. end
  1586.  
  1587. function isalive(player)
  1588.  
  1589.     local m_player = getplayer(player)
  1590.     if m_player then
  1591.         local objId = readdword(m_player, 0x34)
  1592.         local m_object = getobject(objId)
  1593.         if m_object then
  1594.             return true
  1595.         end
  1596.     end
  1597. end
  1598.  
  1599. function infiniteammo(player)
  1600.  
  1601.     registertimer(1000, "InfiniteAmmo", player)
  1602. end
  1603.  
  1604. function InfiniteAmmo(id, count, player)
  1605.  
  1606.     local m_player = getplayer(player)
  1607.     if m_player then
  1608.         local objId = readdword(m_player, 0x34)
  1609.         local m_object = getobject(objId)
  1610.         if m_object then
  1611.             for i = 0,3 do
  1612.                 local weapId = readdword(m_object, 0x2F8 + (i * 4))
  1613.                 local m_weapon = getobject(weapId)
  1614.                 if m_weapon then
  1615.                     writeword(m_weapon, 0x2B6, 9999)
  1616.                     writeword(m_weapon, 0x2B8, 9999)
  1617.                     updateammo(weapId)
  1618.                 end
  1619.             end
  1620.            
  1621.             return true
  1622.         end
  1623.     end
  1624.    
  1625.     return false
  1626. end
  1627.  
  1628. function convertbase(input, base)
  1629.  
  1630.     if not base or base == 10 then return tostring(input) end
  1631.  
  1632.     local digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  1633.     local answer = {}
  1634.  
  1635.     repeat
  1636.         local digit = (input % base) + 1
  1637.         input = math.floor(input / base)
  1638.         table.insert(answer, 1, string.sub(digits, digit, digit))
  1639.     until input == 0
  1640.  
  1641.     return table.concat(answer, "")
  1642. end
  1643.  
  1644. function math.round(input, precision)
  1645.  
  1646.     return math.floor(input * (10 ^ precision) + 0.5) / (10 ^ precision)
  1647. end
  1648.  
  1649. function table.len(t)
  1650.  
  1651.     local count = 0
  1652.    
  1653.     for k,v in pairs(t) do
  1654.         count = count + 1
  1655.     end
  1656.    
  1657.     return count
  1658. end
  1659.  
  1660. function table.sum(t)
  1661.  
  1662.     local sum = 0
  1663.     for k,v in pairs(t) do
  1664.         if type(v) == "number" then
  1665.             sum = sum + v
  1666.         end
  1667.     end
  1668.    
  1669.     return sum
  1670. end
  1671.  
  1672. function randomnumber(min, max)
  1673.  
  1674.     local diff = max - min
  1675.     local rand = math.random()
  1676.     local weighted = rand * diff
  1677.     return weighted + min
  1678. end
  1679.  
  1680. function opairs(t)
  1681.    
  1682.     local keys = {}
  1683.     for k,v in pairs(t) do
  1684.         table.insert(keys, k)
  1685.     end    
  1686.     table.sort(keys,
  1687.     function(a,b)
  1688.         if type(a) == "number" and type(b) == "number" then
  1689.             return a < b
  1690.         end
  1691.         an = string.lower(tostring(a))
  1692.         bn = string.lower(tostring(b))
  1693.         if an ~= bn then
  1694.             return an < bn
  1695.         else
  1696.             return tostring(a) < tostring(b)
  1697.         end
  1698.     end)
  1699.     local count = 1
  1700.     return function()
  1701.         if table.unpack(keys) then
  1702.             local key = keys[count]
  1703.             local value = t[key]
  1704.             count = count + 1
  1705.             return key,value
  1706.         end
  1707.     end
  1708. end
  1709.  
  1710. function attpairs(t)
  1711.  
  1712.     local count = 0
  1713.     local temp = {"primary", "secondary", "tertiary", "quartenary", "ammo", "grenades", "special"}
  1714.     return function()
  1715.         count = count + 1
  1716.         return temp[count]
  1717.     end
  1718. end
  1719.  
  1720. -- Special Attributes Functions --
  1721.  
  1722. phasor_setspeed = setspeed
  1723. phasor_applycamo = applycamo
  1724.  
  1725. function applycamo(player, duration)
  1726.  
  1727.     duration = tonumber(duration or 0) or 0
  1728.    
  1729.     if not gametype_phantom then
  1730.         local m_player = getplayer(player)
  1731.         if m_player then
  1732.             local objId = readdword(m_player, 0x34)
  1733.             local m_object = getobject(objId)
  1734.             if m_object then
  1735.                 phasor_applycamo(player, duration)
  1736.                 return true
  1737.             end
  1738.         end
  1739.     end
  1740.    
  1741.     return false
  1742. end
  1743.  
  1744. function setspeed(player, speed)
  1745.  
  1746.     speed = tonumber(speed or 1) or 1
  1747.    
  1748.     if gametype_speed then
  1749.         local m_player = getplayer(player)
  1750.         if m_player then
  1751.             local objId = readdword(m_player, 0x34)
  1752.             local m_object = getobject(objId)
  1753.             if m_object then
  1754.                 phasor_setspeed(player, speed)
  1755.                 return true
  1756.             end
  1757.         end
  1758.     end
  1759.    
  1760.     return false
  1761. end
  1762.  
  1763. function applyos(player)
  1764.  
  1765.     if gametype_shields then
  1766.         local m_player = getplayer(player)
  1767.         if m_player then
  1768.             local objId = readdword(m_player, 0x34)
  1769.             local m_object = getobject(objId)
  1770.             if m_object then
  1771.                 local x, y, z = getobjectcoords(objId)
  1772.                 local mapId = gettagid("eqip", "powerups\\over shield")
  1773.                 local eqipId = createobject(mapId, 0, 0, false, x, y, z)
  1774.                 if eqipId then
  1775.                     return true
  1776.                 end
  1777.             end
  1778.         end
  1779.     end
  1780.    
  1781.     return false
  1782. end
  1783.  
  1784. function oscamo(player, duration)
  1785.    
  1786.     if gametype_shields and not gametype_phantom then
  1787.         local bool = applyos(player)
  1788.         if bool then
  1789.             applycamo(player, duration)
  1790.             return true
  1791.         end
  1792.     end
  1793.    
  1794.     return false
  1795. end
  1796.  
  1797. function camospeed(player, duration, speed)
  1798.  
  1799.     if not gametype_phantom then
  1800.         local bool = setspeed(player, speed)
  1801.         if bool then
  1802.             applycamo(player, duration)
  1803.             return true
  1804.         end
  1805.     end
  1806.    
  1807.     return false
  1808. end
  1809.  
  1810. function speedos(player, speed)
  1811.  
  1812.     if gametype_speed and gametype_shields then
  1813.         local bool = setspeed(player, speed)
  1814.         if bool then
  1815.             applyos(player)
  1816.             return true
  1817.         end
  1818.     end
  1819.    
  1820.     return false
  1821. end
  1822.  
  1823. function speedoscamo(player, duration, speed)
  1824.  
  1825.     if gametype_speed and gametype_shields and not gametype_phantom then
  1826.         local bool = setspeed(player, speed)
  1827.         if bool then
  1828.             local bool2 = oscamo(player, duration)
  1829.             if bool2 then
  1830.                 return true
  1831.             end
  1832.         end
  1833.     end
  1834.    
  1835.     return false
  1836. end
  1837.  
  1838. function damagemultiply(player, multiplier)
  1839.  
  1840.     if getplayer(player) then
  1841.         local hash = gethash(player)
  1842.         if hash then
  1843.             damage_multiplier[hash] = tonumber(multiplier)
  1844.             return true
  1845.         end
  1846.     end
  1847.    
  1848.     return false
  1849. end
  1850.  
  1851. function healthmultiply(player, multiplier)
  1852.  
  1853.     if getplayer(player) then
  1854.         local hash = gethash(player)
  1855.         if hash then
  1856.             health_multiplier[hash] = tonumber(multiplier)
  1857.             return true
  1858.         end
  1859.     end
  1860.    
  1861.     return false
  1862. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement