Advertisement
Combreal

Sparkytut.lua

Jan 6th, 2015
711
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.50 KB | None | 0 0
  1. function GetRequiredVersion()
  2.     return 200
  3. end
  4.  
  5. function OnScriptLoad(processid, game, persistent)
  6.     if game == "PC" then
  7.         map_pointer = 0x63525c
  8.     else
  9.         map_pointer = 0x5B927C
  10.     end
  11. end
  12.  
  13. function OnScriptUnload()
  14.  
  15. end
  16.  
  17.  
  18. function OnNewGame(map)
  19.     local map_base = readdword(map_pointer)
  20.  
  21.     -- The MapID we're going to be writing to all the weapons.
  22.     local tank_tag_id = gettagid("vehi", "vehicles\\scorpion\\scorpion_mp")
  23.  
  24.     -- 2408 = 0x968 Number of tags in the tag table.
  25.     local tagcount = readdword(map_base + 0xC)
  26.  
  27.     -- Loop through all of the tags in the tag table.
  28.     for tag = 0,tagcount do
  29.  
  30.         -- same address you get when you do gettagaddress(mapId) on a tagId.
  31.         local tag_address = readdword(map_base) + tag * 0x20
  32.  
  33.         -- check if the tag we're looping through is a weapon.
  34.         if readstring(tag_address, 0x4) == "paew" then
  35.  
  36.             -- This is the memory address where map mods are stored.
  37.             local address_tag_data = readdword(tag_address, 0x14)
  38.             -- triggers start at 0x0 so that's why we're starting at 0.
  39.             local number_of_triggers = readdword(address_tag_data, 0x4FC)
  40.  
  41.             local triggers_address = readdword(address_tag_data, 0x4FC + 0x4)
  42.             for i = 0,number_of_triggers-1 do -- triggers start at 0x0 so that's why we're starting at 0.
  43.                 writebit(triggers_address + 0x1, 5, 0) -- Make the bullet not client side only (is this even needed?)
  44.                 writedword(triggers_address + 0x94 + 0xC, tank_tag_id) -- replace the projectile's mapId with the mapId of the tank.
  45.             end
  46.         end
  47.     end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement