- -- OneintheChamber 1.02
- --[[ Autokill on rejoin ]]--
- kill_on_rejoin = false
- -- If you don't want players to be killed when they rejoin, even if the game has limited lives, delete this block of code.
- local gametype_base = 0x671340
- local lives = readbyte(gametype_base, 0x50)
- if lives > 0 then
- kill_on_rejoin = true
- end
- --[[ Welcome Message ]]--
- welcome_message = "One in the Chamber"
- --[[ Functions ]]--
- function GetRequiredVersion()
- return 10057
- end
- function OnScriptLoad(process)
- end
- function OnScriptUnload()
- end
- function OnNewGame(map)
- end
- function OnGameEnd(mode)
- end
- function OnServerChat(player, chattype, message)
- return 1
- end
- function OnServerCommand(player, command)
- return 1
- end
- function OnTeamDecision(team)
- return team
- end
- --[[ Rejoining Tables ]]--
- hashes = {}
- dq = {}
- function OnPlayerJoin(player, team)
- if kill_on_rejoin then
- local hash = gethash(player)
- if hashes[hash] then
- say(getname(player) .. " has been disqualified for rejoining this round!")
- dq[hash] = true
- else
- privatesay(player, welcome_message)
- hashes[hash] = true
- end
- end
- end
- function OnPlayerLeave(player, team)
- end
- function OnPlayerKill(killer, victim, mode)
- if mode == 4 then
- addOneBullet(killer)
- end
- end
- function addOneBullet(player)
- local m_player = getplayer(player)
- if m_player then
- local m_objId = readdword(m_player, 0x34)
- local m_object = getobject(m_objId)
- if m_object then
- local m_weapId = readdword(m_object, 0x118)
- local m_weapon = getobject(m_weapId)
- if m_weapon then
- local ammo = readdword(m_weapon, 0x2B6)
- writedword(m_weapon, 0x2B6, ammo + 1)
- updateammo(m_weapId)
- end
- end
- end
- end
- function OnKillMultiplier(player, multiplier)
- end
- function OnPlayerSpawn(player, m_objId)
- local m_object = getobject(m_objId)
- if m_object then
- writebyte(m_object, 0x31E, 0)
- writebyte(m_object, 0x31F, 0)
- end
- end
- function OnPlayerSpawnEnd(player, m_objId)
- local hash = gethash(player)
- if dq[hash] then
- kill(player)
- end
- local m_object = getobject(m_objId)
- if m_object then
- registertimer(10, "WeaponTimer", player, m_object)
- end
- end
- function WeaponTimer(id, count, player, m_object)
- local weap
- local gametype_base = 0x671340
- local weapons = readbyte(gametype_base, 0x5C) -- Confirmed. (Normal = 0) (Pistols = 1) (Rifles = 2) (Plasma Weapons = 3) (Sniper = 4) (No Sniping = 5) (Rocket Launchers = 6) (Shotguns = 7) (Short Range = 8) (Human = 9) (Convenant = 10) (Classic = 11) (Heavy Weapons = 12)
- if weapons == 0 or weapons == 11 then
- weap = "weapons\\pistol\\pistol"
- else
- weap = "weapons\\sniper rifle\\sniper rifle"
- end
- for i = 0, 3 do
- local m_weapId = readdword(m_object, 0x2F8 + i * 4)
- if getobject(m_weapId) then
- destroyobject(m_weapId)
- end
- end
- local weapon = createobject("weap", weap, 0, 30, false, 0, 0, 0)
- local m_weapon = getobject(weapon)
- assignweapon(player, weapon)
- writedword(m_weapon, 0x2B6, 0)
- writedword(m_weapon, 0x2B8, 1)
- writefloat(m_weapon, 0x240, 0.99)
- updateammo(weapon)
- return 0
- end
- function OnTeamChange(relevant, player, cur_team, dest_team)
- return 1
- end
- function OnObjectCreation(m_objId, player, tagName)
- end
- function OnObjectInteraction(player, m_objId, tagType, tagName)
- if tagType == "weap" then
- return 0
- elseif tagType == "eqip" then
- if string.find(tagName, "grenade") then
- return 0
- end
- end
- return 1
- end
- function OnWeaponAssignment(player, m_objId, slot, tagName)
- return 0
- end
- function OnWeaponReload(player, m_weapId)
- return 1
- end
- function OnDamageLookup(receiver, causer, tagData, tagName)
- if string.find(tagName, "bullet") then
- writefloat(tagData, 0x1D0, 500)
- writefloat(tagData, 0x1D4, 500)
- writefloat(tagData, 0x1D8, 500)
- end
- end
- function OnVehicleEntry(relevant, player, m_vehicleId, tagName, seat)
- return 1
- end
- function OnVehicleEject(player, forced)
- return 1
- end
- function OnClientUpdate(player, m_objId)
- end
Recent Pastes