Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2019-09-18, 15:47


ASIEK







Wiek: 30
Na forum: 2841 dni
Posty: 13

Piwa: 394

Respekt: 40

Ostrzeżeń: 60%
A wi?c tak przy celowaniu z broni czy z suszary admina przeszkadza mi to ?e po ka?dym celowaniu odpala si? kursor a gdy wy??cz? ten scoreboard w pe?ni to tego nie ma ... Podaj? kod i prosz? o pomoc.

Zdj : https://imgur.com/a/1KvN7pZ



Kod:

--[[

Author: danibayez
MTA Forum: https://goo.gl/QX0mcT

]]

local width, height, h_height, r_height, s_width = 500, 520, 70, 40, 15
local renderTarget = dxCreateRenderTarget( width, height, true )
local font = dxCreateFont( "files/font.ttf", 18 )
local posX = ( screenW - width ) / 2
local isScrollActive, scrollCache, scrollColor = _, 0, 0
local players = { }

addEventHandler( "onClientRender", root,
function( )
if ( getKeyState( "TAB" ) ) then

local c_height = #players * r_height
local posY = ( screenH - ( math.min( c_height, height ) + h_height ) ) / 2
dxDrawRectangle( posX, posY, width, h_height, tocolor( 42, 93, 132, 255 ), true )
dxDrawImage( posX + 10, posY + ( h_height - 64 ), 64, 64, "files/skins/" .. getElementModel( localPlayer ) .. ".png", 0, 0, 0, tocolor( 255, 255, 255, 255 ), true )
dxDrawText( #players .. "/100", posX, posY, posX + width - 10, posY + h_height, tocolor( 255, 255, 255, 255 ), 1, font, "right", "center", false, false, true )
local headerX, headerY = posX + 85, posY + 7
dxDrawImageSection( headerX, headerY, 16, 16, 16, 0, 16, 16, "files/icons.png", 0, 0, 0, tocolor( 255, 255, 255, 255 ), true )
dxDrawText( getPlayerName( localPlayer ):gsub( "_", " " ), headerX + 20, headerY, headerX + 20, headerY + 16, tocolor( 255, 255, 255, 255 ), 0.55, font, "left", "center", false, false, true,true )
dxDrawImageSection( headerX, headerY + 20, 16, 16, 32, 0, 16, 16, "files/icons.png", 0, 0, 0, tocolor( 255, 255, 255, 255 ), true )
dxDrawText( convertNumber( getPlayerMoney( ) ) .. "$", headerX + 20, headerY + 20, headerX + 20, headerY + 36, tocolor( 255, 255, 255, 255 ), 0.55, font, "left", "center", false, false, true )
dxDrawImageSection( headerX, headerY + 40, 16, 16, 0, 0, 16, 16, "files/icons.png", 0, 0, 0, tocolor( 255, 255, 255, 255 ), true )
dxDrawText( _getZoneName( getElementPosition( localPlayer ) ), headerX + 20, headerY + 40, headerX + 20, headerY + 56, tocolor( 255, 255, 255, 255 ), 0.55, font, "left", "center", false, false, true )

local offsetY = 0
local _width = c_height > height and width - s_width - 5 or width

dxSetRenderTarget( renderTarget, true )

for i = 1, #players do

local r, g, b = getPlayerNametagColor( players[ i ] )
local posY = offsetY - scrollCache
dxDrawRectangle( 0, posY, width, r_height, tocolor( 0, 0, 0, 200 ) )
dxDrawText( ( getElementData( players[ i ], "roleplayid" ) or 0 ), 0, posY, 50, posY + r_height, tocolor( r, g, b, 255 ), 0.6, font, "center", "center" )
dxDrawText( getPlayerName( players[ i ] ):gsub( "_", " " ), 60, posY, 160, posY + r_height, tocolor( r, g, b, 255 ), 0.6, font, "left", "center",false,false,false,true )
dxDrawText( getPlayerPing( players[ i ] ), _width - 70, posY, _width, posY + r_height, tocolor( r, g, b, 255 ), 0.6, font, "center", "center" )
offsetY = offsetY + r_height

end

if ( width ~= _width ) then

local vRatio = height / c_height
local s_height = height * vRatio
local scrollY = ( vRatio * scrollCache ) + 5
local isHover = isCursorOnElement( posX + _width, posY + scrollY + h_height, s_width, s_height - 10 )
local r, g, b = interpolateBetween( 42, 93, 132, 22, 73, 112, scrollColor, "Linear" )
scrollColor = math.min( math.max( isScrollActive and scrollColor + 0.1 or scrollColor - 0.1, 0 ), 1 )
_dxDrawRectangle( _width, 5, s_width, height - 10, 10, tocolor( 0, 0, 0, 200 ) )
_dxDrawRectangle( _width, scrollY, s_width, s_height - 10, 10, tocolor( r, g, b, 255 ) )

if ( isHover and getKeyState( "mouse1" ) ) then isScrollActive = not isScrollActive and cursorY( ) - scrollY + 5 or isScrollActive elseif ( not getKeyState( "mouse1" ) ) then isScrollActive = nil end

if ( isScrollActive ) then

scrollCache = math.min( math.max( ( cursorY( ) - isScrollActive ) / vRatio, 0 ), c_height - height )

end

end

dxSetRenderTarget( )
dxDrawImage( posX, posY + h_height, width, height, renderTarget, 0, 0, 0, tocolor( 255, 255, 255, 255 ), true )

end
showCursor( getKeyState( "mouse2" ) )
end
)

addEventHandler( "onClientPlayerJoin", root, function( ) players = getElementsByType( "player" ) end )
addEventHandler( "onClientResourceStart", resourceRoot, function( ) players = getElementsByType( "player" ) end )
addEventHandler( "onClientPlayerQuit", root, function( ) players = getElementsByType( "player" ) scrollCache = math.min( scrollCache, #players * r_height ) end )

addEventHandler( "onClientKey", root,
function( key )
local c_height = #players * r_height
if ( getKeyState( "TAB" ) and ( c_height > height ) ) then
if ( key == "mouse_wheel_up" ) then
scrollCache = math.max( scrollCache - r_height, 0 )
elseif ( key == "mouse_wheel_down" ) then
scrollCache = math.min( scrollCache + r_height, c_height - height )
end
end
end
)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-09-18, 17:08


Pawel5321

Szkrypter






Wiek: 36
Na forum: 3809 dni
Posty: 237
Nick w MP: Pawell

Piwa: 2315

Respekt: 240
Respekt: 240Respekt: 240


--[[ 

Authordanibayez 
MTA Forumhttps://goo.gl/QX0mcT 

]] 

local widthheighth_heightr_heights_width 500520704015 
local renderTarget dxCreateRenderTargetwidthheighttrue local font dxCreateFont"files/font.ttf"18 local posX = ( screenW width ) / 2 
local isScrollActivescrollCachescrollColor _00 
local players = { } 

addEventHandler"onClientRender"root, 
function( ) 
if ( getKeyState"TAB" ) ) then 

local c_height #players * r_height 
local posY = ( screenH - ( math.minc_heightheight ) + h_height ) ) / 2 
dxDrawRectangleposXposYwidthh_heighttocolor4293132255 ), true dxDrawImageposX 10posY + ( h_height 64 ), 6464"files/skins/" .. getElementModellocalPlayer ) .. ".png"000tocolor255255255255 ), true dxDrawText#players .. "/100", posX, posY, posX + width - 10, posY + h_height, tocolor( 255, 255, 255, 255 ), 1, font, "right", "center", false, false, true ) 
local headerXheaderY posX 85posY 7 
dxDrawImageSectionheaderXheaderY16161601616"files/icons.png"000tocolor255255255255 ), true dxDrawTextgetPlayerNamelocalPlayer ):gsub"_"" " ), headerX 20headerYheaderX 20headerY 16tocolor255255255255 ), 0.55font"left""center"falsefalsetrue,true dxDrawImageSectionheaderXheaderY 2016163201616"files/icons.png"000tocolor255255255255 ), true )
dxDrawTextconvertNumbergetPlayerMoney( ) ) .. "$"headerX 20headerY 20headerX 20headerY 36tocolor255255255255 ), 0.55font"left""center"falsefalsetrue dxDrawImageSectionheaderXheaderY 401616001616"files/icons.png"000tocolor255255255255 ), true dxDrawText_getZoneNamegetElementPositionlocalPlayer ) ), headerX 20headerY 40headerX 20headerY 56tocolor255255255255 ), 0.55font"left""center"falsefalsetrue local offsetY 0 
local _width c_height height and width s_width or width 

dxSetRenderTargetrenderTargettrue ) 

for 1#players do 

local rggetPlayerNametagColorplayers] ) 
local posY offsetY scrollCache 
dxDrawRectangle0posYwidthr_heighttocolor000200 ) ) 
dxDrawText( ( getElementDataplayers], "roleplayid" ) or ), 0posY50posY r_heighttocolorrgb255 ), 0.6font"center""center" dxDrawTextgetPlayerNameplayers] ):gsub"_"" " ), 60posY160posY r_heighttocolorrgb255 ), 0.6font"left""center",false,false,false,true dxDrawTextgetPlayerPingplayers] ), _width 70posY_widthposY r_heighttocolorrgb255 ), 0.6font"center""center" offsetY offsetY r_height 

end 

if ( width ~= _width then 

local vRatio height c_height 
local s_height height vRatio 
local scrollY = ( vRatio scrollCache ) + 5 
local isHover isCursorOnElementposX _widthposY scrollY h_heights_widths_height 10 local rginterpolateBetween42931322273112scrollColor"Linear" scrollColor math.minmath.maxisScrollActive and scrollColor 0.1 or scrollColor 0.1), _dxDrawRectangle_width5s_widthheight 1010tocolor000200 ) ) 
_dxDrawRectangle_widthscrollYs_widths_height 1010tocolorrgb255 ) ) 

if ( isHover and getKeyState"mouse1" ) ) then isScrollActive not isScrollActive and cursorY( ) - scrollY or isScrollActive elseif ( not getKeyState"mouse1" ) ) then isScrollActive nil end 

if ( isScrollActive then 

scrollCache math.minmath.max( ( cursorY( ) - isScrollActive ) / vRatio), c_height height end 

end 

dxSetRenderTarget( ) 
dxDrawImageposXposY h_heightwidthheightrenderTarget000tocolor255255255255 ), true showCursorgetKeyState"mouse2" ) ) 
end 

end 
addEventHandler"onClientPlayerJoin"root, function( ) players getElementsByType"player" end addEventHandler"onClientResourceStart"resourceRoot, function( ) players getElementsByType"player" end addEventHandler"onClientPlayerQuit"root, function( ) players getElementsByType"player" scrollCache math.minscrollCache#players * r_height ) end ) 

addEventHandler"onClientKey"root, 
function( key local c_height #players * r_height 
if ( getKeyState"TAB" ) and ( c_height height ) ) then 
if ( key == "mouse_wheel_up" then 
scrollCache math.maxscrollCache r_height) 
elseif ( key == "mouse_wheel_down" then 
scrollCache math.minscrollCache r_heightc_height height end 
end 
end 
)


Postaw piwo autorowi tego posta
 

 
Tagi: scoreboard :: przeszkadza :: celowaniu :: bronią
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » ScoreBoard przeszkadza w celowaniu bronią Odpowiedz do tematu

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku