Skip to content

Instantly share code, notes, and snippets.

@Elengar

Elengar/client.lua Secret

Last active Aug 29, 2015
Embed
What would you like to do?
Prevatniy resurs супир худ для servakov mta deyzet СЛИВ АТ ЕЛЕНКАРА СКОЖИТЕ СПОСИБА
--[[ === Очерёдность стрельбы == --]]
local tShotsModes = {
mode = "auto",
counter = 0,
weapons = {
[ 27 ] = true,
[ 28 ] = true,
[ 29 ] = true,
[ 30 ] = true,
[ 31 ] = true,
[ 32 ] = true
}
}
addEventHandler ( "onClientPlayerWeaponFire", localPlayer,
function ( weapon )
if getElementData ( localPlayer, "usingGrenadeThrower" ) then
return
else
if ( source == localPlayer ) and tShotsModes.weapons [ weapon ] == true then
if ( tShotsModes.mode == "single" ) then
if ( tShotsModes.counter == 0 ) then
toggleControl ( "fire", false )
end
end
tShotsModes.counter = tShotsModes.counter + 1
end
end
end
)
bindKey ( "n", "down",
function ( )
tShotsModes.mode = ( tShotsModes.mode ~= "auto" ) and "auto" or "single"
end
)
bindKey ( "fire", "up",
function ( )
if getElementData ( localPlayer, "usingGrenadeThrower" ) then
return
else
toggleControl ( "fire", true )
tShotsModes.counter = 0
end
end
)
toggleControl ( "fire", true )
--[[ === Конец очерёдности стрельбы == --]]
--[[ === Начало HUD'a === ]]
local x,y = guiGetScreenSize()
function speed ( )
addEventHandler ( "onClientRender", root, getspeed )
end
addEventHandler ("onClientVehicleEnter", root, speed)
function wylacz ( )
removeEventHandler ( "onClientRender", root, getspeed )
end
addEventHandler("onClientVehicleExit", root, wylacz)
function hud ( )
local screenWidth,screenHeight = guiGetScreenSize()
weapon = getElementData(getLocalPlayer(),"currentweapon_1")
weapon1 = getElementData(getLocalPlayer(),"currentweapon_2")
weapon2 = getElementData(getLocalPlayer(),"currentweapon_3")
arma = getPedWeapon( getLocalPlayer() )
clip = getPedAmmoInClip ( getLocalPlayer() )
bala = getPedTotalAmmo ( getLocalPlayer() )
showPlayerHudComponent ("weapon", false )
showPlayerHudComponent ("ammo", false)
showPlayerHudComponent ("clock", false)
local x, y = guiGetScreenSize ( ) posx2= x-55 posy2= 90 posx3= x-55 posy3= 81
dxDrawImage ( screenWidth/2 - -425, 3, 255, 80, 'hud4.png')
if ( arma==0 ) then
return
else
dxDrawText(" "..clip.."",posx2-260, posy2-50, x, y,tocolor(50,206,50,255),0.8,"bankgothic","left","top",false,false,false)
dxDrawText(" | "..bala.."",posx2-15, posy2-45, x, y,tocolor(50,206,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon== "M16A2 M203" and arma== 31 ) then element1 = dxDrawText(" M16A2 M203 5.56mm ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon== "AK-47" and arma==30 ) then element1 = dxDrawText("AK-47",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon== "SPAZ-12 Combat Shotgun" and arma==12 ) then element1 = dxDrawText(" SPAZ-12 Combat Shotgun ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon== "M136 Rocket Launcher" and arma==35 ) then element1 = dxDrawText(" M136 Rocket Launcher ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon== "Heat-Seeking RPG" and arma==36 ) then element1 = dxDrawText(" Heat-Seeking RPG ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon== "Sawn-Off Shotgun" and arma==26 ) then dxDrawText(" Sawn-Off Shotgun ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon== "Winchester 1866" and arma==25 ) then dxDrawText(" Winchester 1866 ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon1== "PDW" and arma==28 ) then dxDrawText(" PDW ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon1== "MP5A5" and arma==29 ) then dxDrawText(" MP5A5 9mm ",posx3-75, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon1== "Desert Eagle" and arma==24 ) then dxDrawText(" Desert Eagle ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon1== "M9 SD" and arma==23 ) then dxDrawText(" M9 SD ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon1== "M1911" and arma==22 ) then dxDrawText(" M1911 ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon2== "Бейсбольная бита" and arma==5 ) then dxDrawText(" Топор ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon2== "Лопата" and arma==6 ) then dxDrawText(" Лопата ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon2== "Боевой нож" and arma==4 ) then dxDrawText(" Боевой нож ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon2== "Бинокль" and arma==43 ) then dxDrawText(" Бинокль ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon2== "Бейсбольная бита" and arma==8 ) then dxDrawText(" Бейсбольная бита ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon2== "Лом-монтировка" and arma==2 ) then dxDrawText(" Лом-монтировка ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon2== "Парашют" and arma==46 ) then dxDrawText(" Парашют ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon== "Lee Enfield" and arma==33 ) then dxDrawText(" Lee Enfield ",posx3-170, posy3-75, x, y,tocolor(50,205,50,255),0.6,"bankgothic","left","top",false,false,false)
end
if ( weapon1== "M67 Grenade" and arma==16 ) then dxDrawText(" M67 Grenade ",posx3-170, posy3-75, x, y,tocolor(0,198,0,255),0.6,"bankgothic","left","top",false,false,false)
end
end
addEventHandler("onClientRender",getRootElement(),hud)
addEventHandler("onClientPlayerSpawn",getRootElement(),hud)
function hud2 ( ) -- Часы
local x, y = guiGetScreenSize ( ) posx2= x-55 posy2= 90 posx3= x-55 posy3= 81
if getElementData(getLocalPlayer(),"Часы") >= 1 then
local hour, minutes = getTime()
dxDrawText(" "..hour..":"..minutes, posx2-260, posy2-23, x, y,tocolor(50,205,50,255),0.50,"bankgothic","left","top",false,false,false)
else
return
end
end
addEventHandler("onClientRender",getRootElement(),hud2)
addEventHandler("onClientPlayerSpawn",getRootElement(),hud2)--]]
function hud3() -- Гранатомёт
local x,y = guiGetScreenSize()
local x, y = guiGetScreenSize ( ) posx2= x-55 posy2= 90 posx3= x-55 posy3= 81
weapon = getElementData(getLocalPlayer(),"currentweapon_1")
arma = getPedWeapon( getLocalPlayer() )
local grenade = getElementData(getLocalPlayer(),"M203 Grenade")
if ( weapon== "M16A2 M203" and arma==31 ) then
dxDrawText(" M203 Grenade x"..grenade.."",posx3-122, posy3-14, x, y,tocolor(50,205,50,255),0.50,"bankgothic","left","top",false,false,false)
end
end
addEventHandler("onClientRender",getRootElement(),hud3)
addEventHandler("onClientPlayerSpawn",getRootElement(),hud3)
function hud4() -- Очерёдность
local x,y = guiGetScreenSize()
local x, y = guiGetScreenSize ( ) posx2= x-55 posy2= 90 posx3= x-55 posy3= 81
local hudina = ( tShotsModes.mode == "single" )
local arma = getPedWeapon( getLocalPlayer() )
local screenWidth,screenHeight = guiGetScreenSize()
if ( arma == 0 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 1 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 2 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 3 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 4 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 5 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 6 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 7 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 8 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 9 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 15 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 16 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 17 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 22 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 23 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 24 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 25 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 26 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 33 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 34 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 43 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
elseif ( arma == 46 ) then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
else
if hudina then
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud2.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud1.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud2.png')
else
dxDrawImage ( screenWidth/2 - -630, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -580, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -530, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -480, 30, 45, 7, 'hud.png')
dxDrawImage ( screenWidth/2 - -430, 30, 45, 7, 'hud.png')
end
end
end
addEventHandler("onClientRender",getRootElement(),hud4)
addEventHandler("onClientPlayerSpawn",getRootElement(),hud4)
function quitar ( )
showPlayerHudComponent ( "weapon", false )
showPlayerHudComponent ( "ammo", false)
end
addEventHandler ( "onClientPlayerSpawn", localPlayer, quitar )
--[[ === Конец HUD'a == --]]
<meta>
<script src="client.lua" type="client" cache="false"/>
<script src="server.lua" type="server" cache="false"/>
<file src="hud.png" />
<file src="hud1.png" />
<file src="hud2.png" />
<file src="hud4.png" />
</meta>
function quitar ( )
showPlayerHudComponent (source, "weapon", false)
showPlayerHudComponent (source, "ammo", false)
showPlayerHudComponent (source, "clock", false)
end
addEventHandler ( "onPlayerJoin", getRootElement(), quitar )
addEventHandler ( "onResourceStart", getRootElement(), quitar )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment