- -- Gravity Rifle
- -- Pick up vehicles by shooting them with your plasma rifle. Shoot them again while they are suspended in front of you to fire them. Kill people.
- -- If you have any questions or comments, PM me (Nuggets) at phasor.proboards.com.
- gravity = {}
- vehicles = {}
- activetime = {}
- function GetRequiredVersion()
- return 200
- end
- function OnScriptLoad(processId, game, persistent)
- end
- --[[
- function OnScriptUnload()
- end
- --]]
- --[[
- function OnNewGame(map)
- end
- --]]
- --[[
- function OnGameEnd(stage)
- -- stage 1: F1 Screen
- -- stage 2: PGCR Appears
- -- stage 3: Players may quit
- end
- --]]
- --[[
- function OnServerChat(player, type, message)
- --return true, message, type
- end
- --]]
- --[[
- function OnServerCommandAttempt(player, command, password)
- --return true
- end
- --]]
- --[[
- function OnServerCommand(admin, command)
- --return true
- end
- --]]
- --[[
- function OnNameRequest(hash, name)
- --return true, name
- end
- --]]
- --[[
- function OnBanCheck(hash, ip)
- --return true
- end
- --]]
- --[[
- function OnPlayerJoin(player)
- end
- --]]
- function OnPlayerLeave(player)
- gravity[player] = nil
- end
- function OnPlayerKill(killer, victim, mode)
- gravity[victim] = nil
- end
- --[[
- function OnKillMultiplier(player, multiplier)
- -- Multipliers:
- -- 7: Double Kill
- -- 9: Triple Kill
- -- 10: Killtacular
- -- 11: Killing Spree
- -- 12: Running Riot
- -- 16: Double Kill w/ Score
- -- 17: Triple Kill w/ Score
- -- 14: Killtacular w/ Score
- -- 18: Killing Spree w/ Score
- -- 17: Running Riot w/ Score
- end
- --]]
- --[[
- function OnPlayerSpawn(player)
- end
- --]]
- --[[
- function OnPlayerSpawnEnd(player)
- end
- --]]
- function OnWeaponAssignment(player, objId, slot, weapId)
- return gettagid("weap", "weapons\\plasma rifle\\plasma rifle")
- end
- --[[
- function OnWeaponReload(player, weapId)
- --return true
- end
- --]]
- --[[
- function OnObjectCreationAttempt(mapId, parentId, player)
- --return mapId
- end
- --]]
- --[[
- function OnObjectCreation(objId)
- end
- --]]
- --[[
- function OnObjectInteraction(player, objId, mapId)
- end
- --]]
- --[[
- function OnTeamDecision(team)
- --return team
- end
- --]]
- --[[
- function OnTeamChange(player, old_team, new_team, voluntary)
- --return true
- end
- --]]
- function OnDamageLookup(receiver, causer, mapId)
- local tagname = gettaginfo(mapId)
- if tagname == "weapons\\plasma rifle\\bolt" then
- local player = objectidtoplayer(causer)
- if player then
- local m_causer = getobject(causer)
- local m_receiver = getobject(receiver)
- if m_receiver and m_causer then
- local mapId = readdword(m_receiver)
- local tagname, tagtype = gettaginfo(mapId)
- if tagtype == "vehi" then
- if gravity[player] then
- gravity[player] = nil
- writebit(m_receiver, 0x10, 5, 0)
- local x_aim = readfloat(m_causer, 0x230)
- local y_aim = readfloat(m_causer, 0x234)
- local z_aim = readfloat(m_causer, 0x238)
- local vel = 1
- writefloat(m_receiver, 0x68, vel * math.sin(x_aim))
- writefloat(m_receiver, 0x6C, vel * math.sin(y_aim))
- writefloat(m_receiver, 0x70, vel * math.sin(z_aim))
- registertimer(10, "ActiveVehicle", {receiver, player})
- else
- local bool
- for p,r in pairs(gravity) do
- if r == receiver then
- bool = true
- end
- end
- if not bool then
- gravity[player] = receiver
- vehicles[receiver] = player
- writebit(m_receiver, 0x10, 5, 0)
- local m_player = getplayer(player)
- local xy_aim = readfloat(m_player, 0x138)
- local z_aim = readfloat(m_player, 0x13C)
- local dist = 4
- local x = readfloat(m_causer, 0x5C)
- local y = readfloat(m_causer, 0x60)
- local z = readfloat(m_causer, 0x64)
- writefloat(m_receiver, 0x5C, x + dist * math.cos(xy_aim))
- writefloat(m_receiver, 0x60, y + dist * math.sin(xy_aim))
- writefloat(m_receiver, 0x64, z + dist * math.sin(z_aim) + 0.5)
- writefloat(m_receiver, 0x68, 0)
- writefloat(m_receiver, 0x6C, 0)
- writefloat(m_receiver, 0x70, 0)
- local angular_velocity_x = readfloat(m_receiver, 0x8C)
- local angular_velocity_y = readfloat(m_receiver, 0x90)
- local angular_velocity_z = readfloat(m_receiver, 0x94)
- writefloat(m_receiver, 0x8C, .2)
- writefloat(m_receiver, 0x90, .3)
- writefloat(m_receiver, 0x94, .05)
- end
- end
- end
- end
- end
- elseif tagname == "globals\\vehicle_collision" then
- if vehicles[causer] then
- local m_player = getplayer(vehicles[causer])
- if m_player then
- local objId = readdword(m_player, 0x34)
- applydmgtag(receiver, gettagid("jpt!", "weapons\\rocket launcher\\explosion"), 500, objId)
- return false
- end
- end
- end
- end
- --[[
- function OnDamageApplication(receiver, causer, mapId, location, backtap)
- --return true
- end
- --]]
- --[[
- function OnVehicleEntry(player, vehiId, seat, mapId, voluntary)
- --return true
- end
- --]]
- --[[
- function OnVehicleEject(player, voluntary)
- --return true
- end
- --]]
- function OnClientUpdate(player)
- local vehiId = gravity[player]
- if vehiId then
- local m_player = getplayer(player)
- local objId = readdword(m_player, 0x34)
- local m_object = getobject(objId)
- local m_vehicle = getobject(vehiId)
- local x_aim = readfloat(m_object, 0x230)
- local y_aim = readfloat(m_object, 0x234)
- local z_aim = readfloat(m_object, 0x238)
- local x = readfloat(m_object, 0x5C)
- local y = readfloat(m_object, 0x60)
- local z = readfloat(m_object, 0x64)
- local dist = 4
- writefloat(m_vehicle, 0x5C, x + dist * math.sin(x_aim))
- writefloat(m_vehicle, 0x60, y + dist * math.sin(y_aim))
- writefloat(m_vehicle, 0x64, z + dist * math.sin(z_aim) + 0.5)
- writefloat(m_vehicle, 0x68, 0)
- writefloat(m_vehicle, 0x6C, 0)
- writefloat(m_vehicle, 0x70, 0.01285)
- end
- end
- function ActiveVehicle(id, count, info)
- local vehiId = info[1]
- local player = info[2]
- local m_vehicle = getobject(vehiId)
- if m_vehicle then
- if vehicles[vehiId] == player then
- if getplayer(player) then
- local vx = readfloat(m_vehicle, 0x68)
- local vy = readfloat(m_vehicle, 0x6C)
- local vz = readfloat(m_vehicle, 0x70)
- local velocity = math.sqrt(vx ^ 2 + vy ^ 2 + vz ^ 2)
- if velocity == 0 then
- activetime[vehiId] = activetime[vehiId] or 100 - 1
- if activetime[vehiId] <= 0 then
- vehicles[vehiId] = nil
- return false
- end
- end
- end
- else
- return false
- end
- end
- return true
- end
Recent Pastes