local font = surface.SetupFont("PizzaDude Pointers", 80, 400, 0, 0, 0x010)
local m_iHealth = client.GetNetvar("DT_BasePlayer", "m_iHealth")
local m_bPinPulled = client.GetNetvar("DT_BaseCSGrenade", "m_bPinPulled")
local m_fThrowTime = client.GetNetvar("DT_BaseCSGrenade", "m_fThrowTime")
local m_fFlags = client.GetNetvar("DT_BasePlayer", "m_fFlags")
local m_vecVelocity = client.GetNetvar("DT_BasePlayer", "m_vecVelocity[0]")
function hasbit(x, p)
return x % (p + p) >= p
end
local m_iSide = 0
local screenW, screenH = engine.GetScreenSize()
local iAlpha = 225
local iBoolAlpha = false
local function oCreateMove(pCmd)
local LocalPlayer = entitylist.GetLocalPlayer()
if not LocalPlayer:IsValidPtr() then return end
if LocalPlayer:GetPropInt(m_iHealth) < 1 then return end
local iWeapon = LocalPlayer:GetWeapon()
if not iWeapon:IsValidPtr() then return end
if iWeapon:IsGrenade() then
local throwTime = iWeapon:GetPropFloat(m_fThrowTime)
if not iWeapon:GetPropBool(m_bPinPulled) then
if throwTime > 0 then
return
end
end
if hasbit(pCmd.buttons, 1) or hasbit(pCmd.buttons, 2048) then
if throwTime > 0 then
return
end
end
end
if hasbit(pCmd.buttons, 32) then return end
if hasbit(pCmd.buttons, 1) then return end
--CHECKOUT
--Z BUTTON
if client.IsKeyPressed(0x5A) then
m_iSide = 1
end
--C BUTTON
if client.IsKeyPressed(0x43) then
m_iSide = 2
end
--X BUTTON
if client.IsKeyPressed(0x58) then
m_iSide = 3
end
--BEGIN
--LEFT
if m_iSide == 1 then
pCmd.viewangles.yaw = pCmd.viewangles.yaw - 90
end
--RIGHT
if m_iSide == 2 then
pCmd.viewangles.yaw = pCmd.viewangles.yaw + 90
end
--BACKWARDS
if m_iSide == 3 then
pCmd.viewangles.yaw = pCmd.viewangles.yaw - 360
end
end
local function onPaint()
local LocalPlayer = engine.GetLocalPlayer()
local ThisPlayer = entitylist.GetPlayerByIndex(LocalPlayer)
if ThisPlayer:GetPropInt(m_iHealth) < 0 then
local iAlpha = 225
local iBoolAlpha = false
return end
surface.DrawSetTextFont(font)
if iBoolAlpha == false then iAlpha = iAlpha - 1
end
if iAlpha == 1 then iBoolAlpha = true
end
if iBoolAlpha == true then iAlpha = iAlpha + 1
end
if iAlpha == 255 then iBoolAlpha = false
end
if ThisPlayer:GetPropInt(m_iHealth) > 0 then
if m_iSide == 1 then
surface.DrawSetTextColor(127, 255, 0, iAlpha)
surface.DrawSetTextPos(screenW/2+100, screenH/2+220)
surface.DrawPrintText("Q")
end
if m_iSide == 2 then
surface.DrawSetTextColor(127, 255, 0, iAlpha)
surface.DrawSetTextPos(screenW/2+100, screenH/2+220)
surface.DrawPrintText("U")
end
if m_iSide == 3 then
surface.DrawSetTextColor(127, 255, 0, iAlpha)
surface.DrawSetTextPos(screenW/2+100, screenH/2+223)
surface.DrawPrintText("W")
end
end
end
client.RegisterCallback("CreateMovement", oCreateMove)
client.RegisterCallback("Paint", onPaint)