rockbandcheeseman

RandomWeapon3.0

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