PaQus
Wiek: 22 Na forum: 2897 dni Posty: 10
Nick w MP: PaQus
Siemanko, mam problem ze skryptem na pod?wietlenie licznika.
Mianowicie po wjechaniu w blipa pod?wietlenie mo?na montowa? i ?miga, lecz nie pokazuje grafiki pod cen? z kolorem.
Grafika sama w sobie jest w folderze lecz jest drugi problem, po dopisaniu grafiki do mety wywala skrypt i nie dzia?a.
Kod skryptu
--[[
Autor Skryptu : NexBoy
Zakaz Usuwania Autora i u ? ywania tego kodu be ? mojej zgody !
2016r
]]--
local screenW , screenH = guiGetScreenSize ()
panelL = false
function PanelPodswietlenie ()
local Alpha , Alpha2 = interpolateBetween ( 0 , 0 , 0 , 255 , 209 , 0 , (( getTickCount () - tick ) / 2500 ), "Linear" )
local r , g , b = interpolateBetween ( 255 , 255 , 255 , 20 , 250 , 0 ,( getTickCount ()- tick )/ 1100 , "SineCurve" )
local r2 , g2 , b2 = interpolateBetween ( 255 , 255 , 255 , 255 , 0 , 0 ,( getTickCount ()- tick )/ 1100 , "SineCurve" )
exports [ "buttons" ]: createCustomWindow ( "Montowanie Podswietlania licznika" , screenW * 0.2513 , screenH * 0.2083 , screenW * 0.5096 , screenH * 0.5859 , tocolor ( 255 , 255 , 255 , 255 ), false )
exports [ "buttons" ]: createCustomButton ( "Zamknij Okno" , screenW * 0.4500 , screenH * 0.7015 , screenW * 0.1094 , screenH * 0.0600 , tocolor ( 255 , 255 , 255 , 255 ), false )
exports [ "buttons" ]: createCustomText ( "Aby zamontowa? kolor naci?nij na pole z danym kolorem!" , screenW * 0.4553 , screenH * 0.1239 , screenW * 0.5552 , screenH * 0.5102 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default" , "center" , "center" , false , false , false , false , false )
dxDrawImage ( screenW * 0.2438 , screenH * 0.5161 , screenW * 0.2182 , screenH * 0.1966 , "przycisk.png" , 0 , 0 , 0 , tocolor ( 3 , 167 , 0 , 255 ), false )
dxDrawImage ( screenW * 0.4004 , screenH * 0.5161 , screenW * 0.2182 , screenH * 0.1966 , "przycisk.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 0 , 255 ), false )
dxDrawImage ( screenW * 0.5608 , screenH * 0.5161 , screenW * 0.2182 , screenH * 0.1966 , "przycisk.png" , 0 , 0 , 0 , tocolor ( 0 , 92 , 255 , 255 ), false )
dxDrawImage ( screenW * 0.2438 , screenH * 0.4161 , screenW * 0.2182 , screenH * 0.1966 , "przycisk.png" , 0 , 0 , 0 , tocolor ( 255 , 96 , 0 , 255 ), false )
dxDrawImage ( screenW * 0.4004 , screenH * 0.4161 , screenW * 0.2182 , screenH * 0.1966 , "przycisk.png" , 0 , 0 , 0 , tocolor ( 255 , 0 , 255 , 255 ), false )
dxDrawImage ( screenW * 0.5608 , screenH * 0.4161 , screenW * 0.2182 , screenH * 0.1966 , "przycisk.png" , 0 , 0 , 0 , tocolor ( 0 , 255 , 255 , 255 ), false )
dxDrawImage ( screenW * 0.2438 , screenH * 0.3161 , screenW * 0.2182 , screenH * 0.1966 , "przycisk.png" , 0 , 0 , 0 , tocolor ( 138 , 0 , 255 , 255 ), false )
dxDrawImage ( screenW * 0.4004 , screenH * 0.3161 , screenW * 0.2182 , screenH * 0.1966 , "przycisk.png" , 0 , 0 , 0 , tocolor ( 255 , 0 , 0 , 255 ), false )
dxDrawImage ( screenW * 0.5608 , screenH * 0.3161 , screenW * 0.2182 , screenH * 0.1966 , "przycisk.png" , 0 , 0 , 0 , tocolor ( 0 , 0 , 255 , 255 ), false )
dxDrawText ( "Koszt: 37 500PLN" , screenW * 0.2818 , screenH * 0.5808 , screenW * 0.4114 , screenH * 0.5586 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Koszt: 18 500PLN" , screenW * 0.4385 , screenH * 0.5895 , screenW * 0.5681 , screenH * 0.5573 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Koszt: 31 500PLN" , screenW * 0.6010 , screenH * 0.5895 , screenW * 0.7306 , screenH * 0.5573 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Koszt: 22 500PLN" , screenW * 0.2818 , screenH * 0.3808 , screenW * 0.4114 , screenH * 0.5586 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Koszt: 28 900PLN" , screenW * 0.4385 , screenH * 0.3895 , screenW * 0.5681 , screenH * 0.5573 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Koszt: 38 500PLN" , screenW * 0.6010 , screenH * 0.3895 , screenW * 0.7306 , screenH * 0.5573 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Koszt: 35 500PLN" , screenW * 0.2818 , screenH * 0.1808 , screenW * 0.4114 , screenH * 0.5586 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Koszt: 40 000PLN" , screenW * 0.4385 , screenH * 0.1895 , screenW * 0.5681 , screenH * 0.5573 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Koszt: 39 500PLN" , screenW * 0.6010 , screenH * 0.1895 , screenW * 0.7306 , screenH * 0.5573 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
end
addEvent ( "PokazGuiMontowaniePodswietlenie" , true )
addEventHandler ( "PokazGuiMontowaniePodswietlenie" , resourceRoot , function()
local pojazd = getPedOccupiedVehicle ( localPlayer )
if getVehicleController ( pojazd ) ~= localPlayer then return end
if panelL == false then
addEventHandler ( "onClientRender" , root , PanelPodswietlenie )
tick = getTickCount ()
panelL = true
playSound ( "Dzwiek/PiP.mp3" )
showCursor ( true )
end
end )
function ZamknijOkno ( button , state )
if panelL and button == "left" and state == "down" then
if cursorPosition ( screenW * 0.4500 , screenH * 0.7015 , screenW * 0.1094 , screenH * 0.0600 ) then
playSound ( "Dzwiek/ST.mp3" )
removeEventHandler ( "onClientRender" , root , PanelPodswietlenie )
panelL = false
showCursor ( false )
end
end
end
addEventHandler ( "onClientClick" , getRootElement (), ZamknijOkno )
function ZamontujPodswietlenie ( button , state )
if panelL and button == "left" and state == "down" then -- PIERWSZY
if cursorPosition ( screenW * 0.2826 , screenH * 0.5903 , screenW * 0.1288 , screenH * 0.0547 ) then
local vehicle = getPedOccupiedVehicle ( localPlayer )
local Kolor = getElementData ( vehicle , "licznik:kolor" ) or "Zwykly"
if Kolor == "zielone" then
outputChatBox ( "✘ Ju? posiadasz zamontowane pod?wietlenie Zielone!" , 255 , 0 , 0 )
return
end
playSound ( "Dzwiek/ST.mp3" )
triggerServerEvent ( "DajLicznikZielony" , localPlayer )
end
end
if panelL and button == "left" and state == "down" then -- DRUGI
if cursorPosition ( screenW * 0.4392 , screenH * 0.5903 , screenW * 0.1288 , screenH * 0.0547 ) then
local vehicle = getPedOccupiedVehicle ( localPlayer )
local Kolor = getElementData ( vehicle , "licznik:kolor" ) or "Zwykly"
if Kolor == "zolty" then
outputChatBox ( "✘ Ju? posiadasz zamontowane pod?wietlenie ???te!" , 255 , 0 , 0 )
return
end
playSound ( "Dzwiek/ST.mp3" )
triggerServerEvent ( "DajLicznikZolty" , localPlayer )
end
end
if panelL and button == "left" and state == "down" then -- TRZECI
if cursorPosition ( screenW * 0.6018 , screenH * 0.5903 , screenW * 0.1288 , screenH * 0.0547 ) then
local vehicle = getPedOccupiedVehicle ( localPlayer )
local Kolor = getElementData ( vehicle , "licznik:kolor" ) or "Zwykly"
if Kolor == "blekit" then
outputChatBox ( "✘ Ju? posiadasz zamontowane pod?wietlenie B??kitne!" , 255 , 0 , 0 )
return
end
playSound ( "Dzwiek/ST.mp3" )
triggerServerEvent ( "DajLicznikBlekitny" , localPlayer )
end
end
if panelL and button == "left" and state == "down" then -- CZWARTY
if cursorPosition ( screenW * 0.2826 , screenH * 0.4903 , screenW * 0.1288 , screenH * 0.0547 ) then
local vehicle = getPedOccupiedVehicle ( localPlayer )
local Kolor = getElementData ( vehicle , "licznik:kolor" ) or "Zwykly"
if Kolor == "pom" then
outputChatBox ( "✘ Ju? posiadasz zamontowane pod?wietlenie Pomara?czowe!" , 255 , 0 , 0 )
return
end
playSound ( "Dzwiek/ST.mp3" )
triggerServerEvent ( "DajLicznikPomaranczowy" , localPlayer )
end
end
if panelL and button == "left" and state == "down" then -- PIATY
if cursorPosition ( screenW * 0.4392 , screenH * 0.4903 , screenW * 0.1288 , screenH * 0.0547 ) then
local vehicle = getPedOccupiedVehicle ( localPlayer )
local Kolor = getElementData ( vehicle , "licznik:kolor" ) or "Zwykly"
if Kolor == "roz" then
outputChatBox ( "✘ Ju? posiadasz zamontowane pod?wietlenie R??owe!" , 255 , 0 , 0 )
return
end
playSound ( "Dzwiek/ST.mp3" )
triggerServerEvent ( "DajLicznikRozowy" , localPlayer )
end
end
if panelL and button == "left" and state == "down" then -- SZOSTY
if cursorPosition ( screenW * 0.6018 , screenH * 0.4903 , screenW * 0.1288 , screenH * 0.0547 ) then
local vehicle = getPedOccupiedVehicle ( localPlayer )
local Kolor = getElementData ( vehicle , "licznik:kolor" ) or "Zwykly"
if Kolor == "turkus" then
outputChatBox ( "✘ Ju? posiadasz zamontowane pod?wietlenie Turkusowe!" , 255 , 0 , 0 )
return
end
playSound ( "Dzwiek/ST.mp3" )
triggerServerEvent ( "DajLicznikTurkusowy" , localPlayer )
end
end
if panelL and button == "left" and state == "down" then -- SIODMY
if cursorPosition ( screenW * 0.2826 , screenH * 0.3903 , screenW * 0.1288 , screenH * 0.0547 ) then
local vehicle = getPedOccupiedVehicle ( localPlayer )
local Kolor = getElementData ( vehicle , "licznik:kolor" ) or "Zwykly"
if Kolor == "fiolet" then
outputChatBox ( "✘ Ju? posiadasz zamontowane pod?wietlenie Fioletowe!" , 255 , 0 , 0 )
return
end
playSound ( "Dzwiek/ST.mp3" )
triggerServerEvent ( "DajLicznikFioletowy" , localPlayer )
end
end
if panelL and button == "left" and state == "down" then -- OSMY
if cursorPosition ( screenW * 0.4392 , screenH * 0.3903 , screenW * 0.1288 , screenH * 0.0547 ) then
local vehicle = getPedOccupiedVehicle ( localPlayer )
local Kolor = getElementData ( vehicle , "licznik:kolor" ) or "Zwykly"
if Kolor == "czerw" then
outputChatBox ( "✘ Ju? posiadasz zamontowane pod?wietlenie Czerwone!" , 255 , 0 , 0 )
return
end
playSound ( "Dzwiek/ST.mp3" )
triggerServerEvent ( "DajLicznikCzerwony" , localPlayer )
end
end
if panelL and button == "left" and state == "down" then -- DZIEWIATY
if cursorPosition ( screenW * 0.6018 , screenH * 0.3903 , screenW * 0.1288 , screenH * 0.0547 ) then
local vehicle = getPedOccupiedVehicle ( localPlayer )
local Kolor = getElementData ( vehicle , "licznik:kolor" ) or "Zwykly"
if Kolor == "nieb" then
outputChatBox ( "✘ Ju? posiadasz zamontowane pod?wietlenie Niebieskie!" , 255 , 0 , 0 )
return
end
playSound ( "Dzwiek/ST.mp3" )
triggerServerEvent ( "DajLicznikNiebieski" , localPlayer )
end
end
end
addEventHandler ( "onClientClick" , getRootElement (), ZamontujPodswietlenie )
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
function filedelet ()
if fileExists ( "Montowanie_c.lua" ) then
fileDelete ( "Montowanie_c.lua" )
end
end
addEventHandler ( "onClientResourceStart" , getResourceRootElement ( getThisResource ()), filedelet )
addEventHandler ( "onClientPlayerQuit" , getRootElement (), filedelet )
addEventHandler ( "onClientPlayerJoin" , getRootElement (), filedelet )
Za pomoc stawiam zimnego bronksa.