et.MAX_WEAPONS = 50
pistolwar_flag = false
pistolwar = {
nil,
true,
false,
true,
false,
false,
true,
false,
true,
false,
true,
true,
false,
true,
true,
nil,
nil,
nil,
true,
true,
nil,
nil,
false,
false,
false,
true,
true,
true,
nil,
true,
false,
false,
false,
nil,
false,
nil,
false,
false,
nil,
nil,
true,
false,
false,
false,
false,
false,
false,
false
}
function et_RunFrame(levelTime)
if levelTime % 1000 ~= 0 then return end
if pistolwar_flag == true then
local gamestate = tonumber(et.trap_Cvar_Get("gamestate"))
if gamestate == 0 then
for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do
local team = tonumber(et.gentity_get(j, "sess.sessionTeam"))
if team == 1 or team == 2 then
local health = tonumber(et.gentity_get(j, "health"))
if health > 0 then
for i=1,(et.MAX_WEAPONS-1),1 do
if not pistolwar[i] then
et.gentity_set(j,"ps.ammoclip",i,0)
et.gentity_set(j,"ps.ammo",i,0)
end
end
end
end
end
end
end
end
function et_ClientSpawn(clientNum,revived)
if pistolwar_flag == true then
if revived ~= true then
for i=1,(et.MAX_WEAPONS-1),1 do
if not pistolwar[i] then
et.gentity_set(clientNum,"ps.ammoclip",i,0)
et.gentity_set(clientNum,"ps.ammo",i,0)
else
et.gentity_set(clientNum,"ps.ammo",i,104)
end
end
end
end
end
Vote:new("pistolwar")
:description("Pistols only")
:vote(function()
if pistolwar_flag == true then
return false, "Pistolwar mode is already enabled."
end
local playerCount = 0
for j=0, tonumber(et.trap_Cvar_Get("sv_maxclients"))-1 do
local team = tonumber(et.gentity_get(j, "sess.sessionTeam"))
if team == 1 or team == 2 then
playerCount = playerCount + 1
end
end
if playerCount < 22 then
return false, "This vote requires 22 players or more to cast."
end
return string.format("Enable pistols only mode?")
end)
:pass(function()
pistolwar_flag = true
end)
:percent(90)
Vote:new("allweapons")
:description("Enable all weapons")
:vote(function()
if pistolwar_flag == false then
return false, "All weapons are already enabled."
end
return string.format("Enable all weapons?")
end)
:pass(function()
pistolwar_flag = false
end)