LUA 222
V2+ Tea-bag Loving 1.0 By xdedeone on 26th February 2019 04:47:32 PM
  1. --[[ ###      Tea-Bag Lovin v1      ###]]--
  2. --[[ ### for Phasor v2 by H® Shaft  ###]]--
  3.  
  4. -- Detects victim location. You must be near the victims death to be able to tea-bag them.
  5. -- derived from AelitePrime's t-bag script, but with fixes, he had errors on lines 52 and 56 (receiver_id) which caused it not to work.
  6. -- added some stanky lovin to it: When a player tea-bags their victim, it announces various phrases:
  7. -- "H® Shaft is makin sweet love with Oxide's corpse!" or "H® Shaft is doin the funky chicken with Oxide's corpse!"
  8. -- 10 Different variations, add your own! (add a quoted sex act to the sexsayin table at the bottom, separated by a comma)
  9. -- yes, you can now tea-bag your own corpse, you sick self-lovin bastard.
  10.  
  11. -- don't edit --
  12. crouch = {}
  13. victim_coords = {}
  14. tbag = {}
  15.  
  16. function GetRequiredVersion()
  17.         return 200
  18. end
  19.  
  20. function OnScriptLoad(process, game, persistent)
  21.  
  22. end
  23.  
  24. function OnClientUpdate(player)
  25.         local m_player = getplayer(player)
  26.         local id = resolveplayer(player)
  27.         local m_objectId = getplayerobjectid(player)
  28.         local m_object = getobject(m_objectId)
  29.         if tbag[player] == nil then
  30.                 tbag[player] = {}
  31.         end
  32.         if m_objectId then
  33.                 if tbag[player].name and tbag[player].x then
  34.                         if check_sphere(m_objectId, tbag[player].x, tbag[player].y, tbag[player].z, 10) then
  35.                                 if m_object then
  36.                                         if getobject(readdword(m_object + 0x11C)) == nil then
  37.                                                 local obj_crouch = readbyte(m_object + 0x2A0)
  38.                                                 if obj_crouch == 3 and crouch[id] == nil then
  39.                                                         crouch[id] = OnPlayerCrouch(player)
  40.                                                 elseif obj_crouch ~= 3 then
  41.                                                         crouch[id] = nil
  42.                                                 end
  43.                                         end
  44.                                         if crouch[id] == false then
  45.                                                 writebit(m_object + 0x208, 7, 0)
  46.                                         end
  47.                                 end
  48.                         end
  49.                 end
  50.         end
  51. end
  52.  
  53. function OnPlayerKill(killer, victim, mode)
  54.         tbag[victim] = {}
  55.         if mode == 4 then
  56.                 tbag[killer].count = 0
  57.                 tbag[killer].name = getname(victim)
  58.                 if victim_coords[victim] == nil then victim_coords[victim] = {} end
  59.                 if victim_coords[victim].x then
  60.                         tbag[killer].x = victim_coords[victim].x
  61.                         tbag[killer].y = victim_coords[victim].y
  62.                         tbag[killer].z = victim_coords[victim].z
  63.                 end
  64.         elseif mode == 6 then
  65.                 tbag[victim].count = 0
  66.                 tbag[victim].name = getname(victim)
  67.                 if victim_coords[victim] == nil then victim_coords[victim] = {} end
  68.                 if victim_coords[victim].x then
  69.                         tbag[victim].x = victim_coords[victim].x
  70.                         tbag[victim].y = victim_coords[victim].y
  71.                         tbag[victim].z = victim_coords[victim].z
  72.                 end
  73.         end
  74. end
  75.  
  76. function OnDamageLookup(receiving, causing, tagid, tagdata)
  77.         if receiving then
  78.                 local r_object = getobject(receiving)
  79.                 if r_object then
  80.                         local player = objectaddrtoplayer(r_object)
  81.                         if player then
  82.                                 local x,y,z = getobjectcoords(receiving)
  83.                                 if victim_coords[player] == nil then
  84.                                         victim_coords[player] = {}
  85.                                 end
  86.                                 if victim_coords[player] then
  87.                                         victim_coords[player].x = x
  88.                                         victim_coords[player].y = y
  89.                                         victim_coords[player].z = z
  90.                                 end
  91.                         end
  92.                 end
  93.         end
  94.         return nil
  95. end
  96.  
  97. function OnPlayerCrouch(player)
  98.         if tbag[player].count == nil then
  99.                 tbag[player].count = 0
  100.         end
  101.         tbag[player].count = tbag[player].count + 1
  102.         if tbag[player].count == 4 then
  103.                 tbag[player].count = 0
  104.                 local sexact = generatesexact(sexslang)
  105.                 say(getname(player).. " is " .. sexact .. " with " .. tbag[player].name .. "'s corpse!")
  106.                 tbag[player].name = nil
  107.         end
  108.         return true
  109. end
  110.  
  111. function check_sphere(m_objectId, X, Y, Z, R)
  112.         local Pass = false
  113.         if getobject(m_objectId) then
  114.                 local x,y,z = getobjectcoords(m_objectId)
  115.                 if (X - x)^2 + (Y - y)^2 + (Z - z)^2 <= R then
  116.             Pass = true
  117.         end
  118.     end
  119.     return Pass
  120. end
  121.  
  122. function generatesexact(sexslang)
  123.         local sexcount = #sexsayin
  124.         local sex_verb = getrandomnumber(1, sexcount+1)
  125.         local sex_type = string.format("%s",  sexsayin[sex_verb])
  126.         if sex_type then
  127.                 return sex_type
  128.         else
  129.                 return nil
  130.         end
  131. end
  132.  
  133. sexsayin = {"makin' sweet love", "bumpin' uglies", "bumpin' fuzzies", "butterin' the muffin", "doin' the funky chicken",
  134. "ridin' the wild pony", "makin' bacon", "doggie-stylin'", "playin' hide the salami", "slappin' bellies", "humpin' the rump"}
  135.  
  136. -- Created by H® Shaft thank you to Oxide, AelitePrime, Nugget & Wizard.
  137. -- Visit http://halorace.org/forum/index.php?topic=514.0 or
  138. -- Visit http://pastebin.com/u/HR_Shaft for more phasor scripts

HaloNet.Net is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.