-- Test 4 weapons ·¿· inspired from Wizard's awsomifique work on Phasor --
-- It uses a Generic Weapon type also set to Normal --
-- Tested only on a Slayer gametype --
weapon = {}
weapon[1] = "weapons\\pistol\\pistol"
weapon[2] = "weapons\\shotgun\\shotgun"
weapon[3] = "weapons\\sniper rifle\\sniper rifle"
weapon[4] = "weapons\\rocket launcher\\rocket launcher" -- a fourth weapon can brings issue if you're holding the flag or the skull
frag_count = 3
plasma_count = 3
clipcount = 9999
ammocount = 9999
batterycount = 1 -- 0 to 1
function GetRequiredVersion()
return 200
end
function OnPlayerSpawnEnd(player)
local m_objectId = getplayerobjectid(player)
if m_objectId then
local m_object = getobject(m_objectId)
if m_object then
writebyte(m_object + 0x31E, frag_count)
writebyte(m_object + 0x31F, plasma_count)
for i = 0,3 do
local m_weaponId = readdword(m_object + 0x2F8 + i*4)
if m_weaponId then
local m_weapon = getobject(m_weaponId)
if m_weapon then
destroyobject(m_weaponId)
end
end
end
if (weapon[1] and weapon[1] ~= "") then -- make sure the script user isn't retarded
if getplayer(player) then
table = {player, clipcount, ammocount, batterycount}
registertimer(0, "AssignLeftoverWeapons", table)
end
end
end
end
end
function AssignLeftoverWeapons(id, count, table)
local player = table[1]
local clipcount = table[2]
local ammocount = table[3]
local batterycount = table[4]
if getplayer(player) == nil then
return
end
local m_objectId = getplayerobjectid(player)
if m_objectId then
local m_object = getobject(m_objectId)
if m_object then
local m_weaponId = createobject(gettagid("weap", weapon[1]), 0, 0, false, 5, 5, 2)
if m_weaponId then
assignweapon(player, m_weaponId)
local m_weapon = getobject(m_weaponId)
if m_weapon then
writeword(m_weapon, 0x2B6, ammocount)
writeword(m_weapon, 0x2B8, clipcount)
writefloat(m_weapon, 0x240, math.abs(batterycount - 1))
updateammo(m_weaponId)
end
end
if weapon[2] and weapon[2] ~= "" then
local m_weaponId = createobject(gettagid("weap", weapon[2]), 0, 0, false, 5, 5, 2)
if m_weaponId then
assignweapon(player, m_weaponId)
local m_weapon = getobject(m_weaponId)
if m_weapon then
writeword(m_weapon, 0x2B6, ammocount)
writeword(m_weapon, 0x2B8, clipcount)
writefloat(m_weapon, 0x240, math.abs(batterycount - 1))
updateammo(m_weaponId)
end
end
end
if weapon[3] and weapon[3] ~= "" then
local m_weaponId = createobject(gettagid("weap", weapon[3]), 0, 0, false, 5, 5, 2)
if m_weaponId then
assignweapon(player, m_weaponId)
local m_weapon = getobject(m_weaponId)
if m_weapon then
writeword(m_weapon, 0x2B6, ammocount)
writeword(m_weapon, 0x2B8, clipcount)
writefloat(m_weapon, 0x240, math.abs(batterycount - 1))
updateammo(m_weaponId)
end
end
end
if weapon[4] and weapon[4] ~= "" then
local m_weaponId = createobject(gettagid("weap", weapon[4]), 0, 0, false, 5, 5, 2)
if m_weaponId then
assignweapon(player, m_weaponId)
local m_weapon = getobject(m_weaponId)
if m_weapon then
writeword(m_weapon, 0x2B6, ammocount)
writeword(m_weapon, 0x2B8, clipcount)
writefloat(m_weapon, 0x240, math.abs(batterycount - 1))
updateammo(m_weaponId)
end
end
end
end
end
return false
end
function OnDamageLookup(receiving, causing, mapId, tagdata)
local tagname, tagtype = gettaginfo(mapId)
if nofalldamage == 1 then
if tagname == "globals\\falling" then
return false
end
end
return true
end
function OnObjectInteraction(player, objId, mapId)
local tag_name, tag_type = gettaginfo(mapId)
if tag_type == "weap" then
return false
end
return true
end
Comments
0 B
|👍
/👎