TheBAMBO
restMTA
Wiek: 22 Na forum: 2812 dni Posty: 73
Nick w MP: zexty
Piwa : 12110
Witam, napisa?em panel F1, lecz gdy go wlaczam nie dzia?aj? ?adne elementy w cgui, za pomoc stawiam
Kod:
--[[
@ Autor : TheNoobisty
- Zabrania si ? edytowania skryptu bez zgody jego autora -
]]--
zakladka = guiCreateLabel ( 0.02 , 0.09 , 0.71 , 0.84 , "" , true )
local font0_normal = guiCreateFont ( ":pd_gui/fonts/normal.ttf" , 13 )
guiSetFont ( zakladka , font0_normal )
guiLabelSetHorizontalAlign ( zakladka , "center" , false )
guiLabelSetVerticalAlign ( zakladka , "center" )
label = guiCreateLabel ( 0.02 , 0.02 , 0.70 , 0.07 , "" , true )
local font1_gtav = guiCreateFont ( ":pd_gui/fonts/gtav.ttf" , 39 )
guiSetFont ( label , font1_gtav )
guiLabelSetHorizontalAlign ( label , "center" , false )
guiLabelSetVerticalAlign ( label , "center" )
local screenW , screenH = guiGetScreenSize ()
F1 = false
function cursorPosition ( x , y , w , h )
if ( not isCursorShowing ()) then
return false
end
local mx , my = getCursorPosition ()
local fullx , fully = guiGetScreenSize ()
cursorx , cursory = mx * fullx , my * fully
if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
return true
else
return false
end
end
-- Zakladki
Przewodnik = "Przewodnik"
Prace = "Prace"
Komendy = "Komendy"
Bindy = "Bindy"
Premium = "Premium"
local dxfont0_gtav = dxCreateFont ( ":pd_gui/fonts/gtav.ttf" , 49 )
local dxfont1_normal = dxCreateFont ( ":pd_gui/fonts/normal.ttf" , 12 )
function render ()
dxDrawRectangle ( screenW * 0.0000 , screenH * 0.0000 , screenW * 1.0000 , screenH * 1.0000 , tocolor ( 65 , 65 , 65 , 225 ), false )
if cursorPosition ( screenW * 0.9440 , screenH * 0.1629 , screenW * 0.0560 , screenH * 0.0219 ) then
dxDrawRectangle ( screenW * 0.9440 , screenH * 0.1629 , screenW * 0.0560 , screenH * 0.0219 , tocolor ( 35 , 35 , 35 , 225 ), false )
else
dxDrawRectangle ( screenW * 0.9440 , screenH * 0.1629 , screenW * 0.0560 , screenH * 0.0219 , tocolor ( 65 , 65 , 65 , 225 ), false )
end
if cursorPosition ( screenW * 0.9440 , screenH * 0.1905 , screenW * 0.0560 , screenH * 0.0219 ) then
dxDrawRectangle ( screenW * 0.9440 , screenH * 0.1905 , screenW * 0.0560 , screenH * 0.0219 , tocolor ( 35 , 35 , 35 , 225 ), false )
else
dxDrawRectangle ( screenW * 0.9440 , screenH * 0.1905 , screenW * 0.0560 , screenH * 0.0219 , tocolor ( 65 , 65 , 65 , 225 ), false )
end
if cursorPosition ( screenW * 0.9440 , screenH * 0.2162 , screenW * 0.0560 , screenH * 0.0219 ) then
dxDrawRectangle ( screenW * 0.9440 , screenH * 0.2162 , screenW * 0.0560 , screenH * 0.0219 , tocolor ( 35 , 35 , 35 , 225 ), false )
else
dxDrawRectangle ( screenW * 0.9440 , screenH * 0.2162 , screenW * 0.0560 , screenH * 0.0219 , tocolor ( 65 , 65 , 65 , 225 ), false )
end
if cursorPosition ( screenW * 0.9440 , screenH * 0.2429 , screenW * 0.0560 , screenH * 0.0219 ) then
dxDrawRectangle ( screenW * 0.9440 , screenH * 0.2429 , screenW * 0.0560 , screenH * 0.0219 , tocolor ( 35 , 35 , 35 , 225 ), false )
else
dxDrawRectangle ( screenW * 0.9440 , screenH * 0.2429 , screenW * 0.0560 , screenH * 0.0219 , tocolor ( 65 , 65 , 65 , 225 ), false )
end
if cursorPosition ( screenW * 0.9440 , screenH * 0.2686 , screenW * 0.0560 , screenH * 0.0219 ) then
dxDrawRectangle ( screenW * 0.9440 , screenH * 0.2686 , screenW * 0.0560 , screenH * 0.0219 , tocolor ( 35 , 35 , 35 , 225 ), false )
else
dxDrawRectangle ( screenW * 0.9440 , screenH * 0.2686 , screenW * 0.0560 , screenH * 0.0219 , tocolor ( 65 , 65 , 65 , 225 ), false )
end
-- dxDrawText ( "Panel Pomocy" , screenW * 0.7315 , screenH * 0.0133 , screenW * 0.9940 , screenH * 0.1029 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont0_gtav , "center" , "center" , false , false , true , false , false )
dxDrawText ( "Przewodnik" , screenW * 0.9446 , screenH * 0.1638 , screenW * 0.9940 , screenH * 0.1857 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont1_normal , "right" , "center" , false , false , true , false , false )
dxDrawText ( "Prace" , screenW * 0.9446 , screenH * 0.1905 , screenW * 0.9940 , screenH * 0.2124 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont1_normal , "right" , "center" , false , false , true , false , false )
dxDrawText ( "Bindy" , screenW * 0.9446 , screenH * 0.2429 , screenW * 0.9940 , screenH * 0.2648 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont1_normal , "right" , "center" , false , false , true , false , false )
dxDrawText ( "Komendy" , screenW * 0.9446 , screenH * 0.2162 , screenW * 0.9940 , screenH * 0.2381 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont1_normal , "right" , "center" , false , false , true , false , false )
dxDrawText ( "Premium" , screenW * 0.9446 , screenH * 0.2695 , screenW * 0.9940 , screenH * 0.2914 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , dxfont1_normal , "right" , "center" , false , false , true , false , false )
end
addEventHandler ( "onClientClick" , getRootElement (), function( button , state )
if button == "left" and state == "down" then
if cursorPosition ( screenW * 0.9440 , screenH * 0.1629 , screenW * 0.0560 , screenH * 0.0219 ) then
guiSetVisible ( label , true )
guiSetVisible ( zakladka , true )
guiSetText ( zakladka , "1" )
guiSetText ( label , Przewodnik )
elseif cursorPosition ( screenW * 0.9440 , screenH * 0.1905 , screenW * 0.0560 , screenH * 0.0219 ) then
guiSetVisible ( label , true )
guiSetVisible ( zakladka , true )
guiSetText ( zakladka , "2" )
guiSetText ( label , Prace )
elseif cursorPosition ( screenW * 0.9440 , screenH * 0.2162 , screenW * 0.0560 , screenH * 0.0219 ) then
guiSetVisible ( label , true )
guiSetVisible ( zakladka , true )
guiSetText ( zakladka , "3" )
guiSetText ( label , Komendy )
elseif cursorPosition ( screenW * 0.9440 , screenH * 0.2429 , screenW * 0.0560 , screenH * 0.0219 ) then
guiSetVisible ( label , true )
guiSetVisible ( zakladka , true )
guiSetText ( zakladka , "4" )
guiSetText ( label , Bindy )
elseif cursorPosition ( screenW * 0.9440 , screenH * 0.2686 , screenW * 0.0560 , screenH * 0.0219 ) then
guiSetVisible ( label , true )
guiSetVisible ( zakladka , true )
guiSetText ( zakladka , "5" )
guiSetText ( label , Premium )
end
end
end )
function F1 ()
if F1 == false then
if getElementData ( localPlayer , "dashboard" ) then return end
if getElementData ( localPlayer , "player:radar:ko?owy" ) then
setPlayerHudComponentVisible ( "radar" , false )
setElementData ( localPlayer , "nimaradaru" , true )
end
addEventHandler ( "onClientRender" , getRootElement (), render )
guiSetVisible ( label , true )
guiSetVisible ( zakladka , true )
guiSetText ( zakladka , "Witaj na BackToRPG!" )
guiSetText ( label , "Panel Pomocy" )
setElementData ( localPlayer , "notshowhud" , true )
setElementData ( localPlayer , "f1" , true )
showCursor ( true )
showChat ( false )
F1 = true
else
if getElementData ( localPlayer , "player:radar:ko?owy" ) then
setPlayerHudComponentVisible ( "radar" , true )
setElementData ( localPlayer , "nimaradaru" , false )
end
removeEventHandler ( "onClientRender" , getRootElement (), render )
guiSetVisible ( label , false )
guiSetVisible ( zakladka , false )
showCursor ( false )
showChat ( true )
setElementData ( localPlayer , "notshowhud" , false )
setElementData ( localPlayer , "f1" , false )
F1 = false
end
end
bindKey ( "F1" , "down" , F1 )
function convertNumber ( number )
local formatted = number
while true do
formatted , k = string . gsub ( formatted , "^(-?%d+)(%d%d%d)" , '%1,%2' )
if ( k == 0 ) then
break
end
end
return formatted
end