Wysłany: 2018-11-11, 23:21
Fl!k
Wiek: 26 Na forum: 3592 dni Posty: 162
Piwa : 18
Witam chcia?em odda? do schowka aodo gdy doda?em schowek przesta? dzia?a?
c.lua
local screenSize = Vector2 ( guiGetScreenSize ())
local ticks = { alphaTick = getTickCount (), animTick = getTickCount (), vehicle = nil }
local function isMouseInPosition ( x , y , width , height )
if not isCursorShowing () then return false end
local cursor = { getCursorPosition ()}
local cx , cy = ( cursor [ 1 ]* screenSize . x ), ( cursor [ 2 ]* screenSize . y )
if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end
end
function isEventHandlerAdded ( sEventName , pElementAttachedTo , func )
if type ( sEventName ) == 'string' and isElement ( pElementAttachedTo ) and type ( func ) == 'function' then
local aAttachedFunctions = getEventHandlers ( sEventName , pElementAttachedTo )
if type ( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs(aAttachedFunctions) do if v == func then return true end end end
end return false
end
local function scaleElement ( sx , sy )
return ( screenSize . x - sx )/ 2 , ( screenSize . y - sy )/ 2
end
local icon_x , icon_y = scaleElement ( 128 , 128 )
local function drawGUI ()
local up = interpolateBetween ( 100 , 0 , 0 , 0 , 0 , 0 , ( getTickCount ()- ticks . animTick )/ 2000 , "OutBack" )
if anim == "fadein" then
progress = ( getTickCount ()- ticks . alphaTick )/ 1000
alpha = interpolateBetween ( alpha , 0 , 0 , 255 , 0 , 0 , progress , "Linear" )
if alpha == 255 then
ticks . alphaTick = getTickCount ()
anim = nil
end
elseif anim == "fadeout" then
progress = ( getTickCount ()- ticks . alphaTick )/ 500
alpha = interpolateBetween ( alpha , 0 , 0 , 0 , 0 , 0 , progress , "Linear" )
if alpha == 0 then
removeEventHandler ( "onClientRender" , root , drawGUI )
ticks . alphaTick = nil
anim = nil
end
end
if isMouseInPosition ( icon_x - 300 , icon_y , 128 , 128 ) then color_one_down = { 36 , 175 , 178 } else color_one_down = { 255 , 255 , 255 } end
if isMouseInPosition ( icon_x - 150 , icon_y , 128 , 128 ) then color_two_down = { 36 , 175 , 178 } else color_two_down = { 255 , 255 , 255 } end
if isMouseInPosition ( icon_x , icon_y , 128 , 128 ) then color_three_down = { 36 , 175 , 178 } else color_three_down = { 255 , 255 , 255 } end
if isMouseInPosition ( icon_x + 150 , icon_y , 128 , 128 ) then color_four_down = { 36 , 175 , 178 } else color_four_down = { 255 , 255 , 255 } end
if isMouseInPosition ( icon_x + 300 , icon_y , 128 , 128 ) then color_five_down = { 36 , 175 , 178 } else color_five_down = { 255 , 255 , 255 } end
if isMouseInPosition ( icon_x + 450 , icon_y , 128 , 128 ) then color_six_down = { 36 , 175 , 178 } else color_six_down = { 255 , 255 , 255 } end
dxDrawImage ( icon_x - 300 , icon_y + up , 128 , 128 , "images/extinguisher.png" , 0 , 0 , 0 , tocolor ( color_one_down [ 1 ], color_one_down [ 2 ], color_one_down [ 3 ], alpha ), false )
dxDrawImage ( icon_x - 150 , icon_y + up , 128 , 128 , "images/ladder.png" , 0 , 0 , 0 , tocolor ( color_two_down [ 1 ], color_two_down [ 2 ], color_two_down [ 3 ], alpha ), false )
dxDrawImage ( icon_x , icon_y + up , 128 , 128 , "images/object.png" , 0 , 0 , 0 , tocolor ( color_three_down [ 1 ], color_three_down [ 2 ], color_three_down [ 3 ], alpha ), false )
dxDrawImage ( icon_x + 150 , icon_y + up , 128 , 128 , "images/saw.png" , 0 , 0 , 0 , tocolor ( color_four_down [ 1 ], color_four_down [ 2 ], color_four_down [ 3 ], alpha ), false )
dxDrawImage ( icon_x + 300 , icon_y + up , 128 , 128 , "images/sorbent.png" , 0 , 0 , 0 , tocolor ( color_five_down [ 1 ], color_five_down [ 2 ], color_five_down [ 3 ], alpha ), false )
dxDrawImage ( icon_x + 450 , icon_y + up , 128 , 128 , "images/aodo.png" , 0 , 0 , 0 , tocolor ( color_six_down [ 1 ], color_six_down [ 2 ], color_six_down [ 3 ], alpha ), false )
end
for i , v in ipairs ( getElementsByType ( "vehicle" )) do
if v . model == 407 then
if v : getData ( "vehicle:rank" ) then
marker = Marker ( 0 , 0 , 0 , "cylinder" , 1 , 255 , 0 , 0 , 150 )
attachElements ( marker , v , 1.8 , 0 , - 1 )
addEventHandler ( "onClientMarkerHit" , resourceRoot , function( player , dimension )
if player == localPlayer and dimension then
if not isEventHandlerAdded ( "onClientRender" , root , drawGUI ) then
if player : getData ( "player:duty" ) == "SAFD" then
local data = marker : getData ( "marker:vehicle" )
ticks . vehicle = data
alpha = 0
anim = "fadein"
showChat ( false )
showCursor ( true , false )
ticks . animTick = getTickCount ()
ticks . alphaTick = getTickCount ()
player : setData ( "player:blackwhite" , true )
player : setData ( "player:hud_visible" , true )
setPlayerHudComponentVisible ( "radar" , false )
addEventHandler ( "onClientRender" , root , drawGUI )
-- triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "podchodzi do wozu, przegl?daj?c zawarto??..." )
end
end
end
end )
addEventHandler ( "onClientMarkerLeave" , marker , function( player , dimension )
if player == localPlayer and dimension then
if isEventHandlerAdded ( "onClientRender" , root , drawGUI ) then
alpha = 255
showChat ( true )
anim = "fadeout"
showCursor ( false )
ticks . vehicle = nil
ticks . animTick = getTickCount ()
ticks . alphaTick = getTickCount ()
player : setData ( "player:blackwhite" , false )
player : setData ( "player:hud_visible" , false )
setPlayerHudComponentVisible ( "radar" , true )
end
end
end )
end
end
end
local function closeGUI ()
alpha = 255
showChat ( true )
anim = "fadeout"
showCursor ( false )
ticks . animTick = getTickCount ()
ticks . alphaTick = getTickCount ()
setPlayerHudComponentVisible ( "radar" , true )
localPlayer : setData ( "player:blackwhite" , false )
localPlayer : setData ( "player:hud_visible" , false )
end
addEventHandler ( "onClientClick" , root , function( button , state )
if button == "left" and state == "down" then
if isEventHandlerAdded ( "onClientRender" , root , drawGUI ) then
if isMouseInPosition ( icon_x - 300 , icon_y , 128 , 128 ) then
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "bierze ga?nic? ze schowka." )
triggerServerEvent ( "iyw_fire_equipment:give" , localPlayer , "extinguisher" )
elseif isMouseInPosition ( icon_x - 150 , icon_y , 128 , 128 ) then
if not localPlayer : getData ( "player:ladder" ) then
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "w?wczas chwyci? za drabin?, oraz wyj?? j? ze schowka." )
triggerServerEvent ( "iyw_fire_equipment:give" , localPlayer , "ladder" )
else
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "z?o?y? drabin?, oraz umie?ci? j? w schowku." )
triggerServerEvent ( "iyw_fire_equipment:give" , localPlayer , "ladder" )
end
elseif isMouseInPosition ( icon_x , icon_y , 128 , 128 ) then
if not localPlayer : getData ( "vehicle:jumping" ) then
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "bierze skokochron ze schowka." )
triggerServerEvent ( "iyw_fire_equipment:give" , localPlayer , "jump" )
else
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "chowa skokochron do schowka." )
localPlayer : setData ( "vehicle:jumping" , false )
end
elseif isMouseInPosition ( icon_x + 150 , icon_y , 128 , 128 ) then
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "bierze pi?? mechaniczn? ze schowka." )
triggerServerEvent ( "iyw_fire_equipment:give" , localPlayer , "saw" )
end
elseif isMouseInPosition ( icon_x + 450 , icon_y , 128 , 128 ) then
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "bierze AODO ze schowka." )
triggerServerEvent ( "iyw_fire_equipment:give" , localPlayer , "aodo" )
end
end
end
end )
debugscript 3
Wysłany: 2018-11-12, 01:29
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
W linijce (bodaj?e) 150 pojawi? si? end, kt?ry by? zb?dny i powodowa? b??dy.
Spr?buj poni?szy kod:
local screenSize = Vector2 ( guiGetScreenSize ())
local ticks = { alphaTick = getTickCount (), animTick = getTickCount (), vehicle = nil }
local function isMouseInPosition ( x , y , width , height )
if not isCursorShowing () then return false end
local cursor = { getCursorPosition ()}
local cx , cy = ( cursor [ 1 ]* screenSize . x ), ( cursor [ 2 ]* screenSize . y )
if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end
end
function isEventHandlerAdded ( sEventName , pElementAttachedTo , func )
if type ( sEventName ) == 'string' and isElement ( pElementAttachedTo ) and type ( func ) == 'function' then
local aAttachedFunctions = getEventHandlers ( sEventName , pElementAttachedTo )
if type ( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs(aAttachedFunctions) do if v == func then return true end end end
end return false
end
local function scaleElement ( sx , sy )
return ( screenSize . x - sx )/ 2 , ( screenSize . y - sy )/ 2
end
local icon_x , icon_y = scaleElement ( 128 , 128 )
local function drawGUI ()
local up = interpolateBetween ( 100 , 0 , 0 , 0 , 0 , 0 , ( getTickCount ()- ticks . animTick )/ 2000 , "OutBack" )
if anim == "fadein" then
progress = ( getTickCount ()- ticks . alphaTick )/ 1000
alpha = interpolateBetween ( alpha , 0 , 0 , 255 , 0 , 0 , progress , "Linear" )
if alpha == 255 then
ticks . alphaTick = getTickCount ()
anim = nil
end
elseif anim == "fadeout" then
progress = ( getTickCount ()- ticks . alphaTick )/ 500
alpha = interpolateBetween ( alpha , 0 , 0 , 0 , 0 , 0 , progress , "Linear" )
if alpha == 0 then
removeEventHandler ( "onClientRender" , root , drawGUI )
ticks . alphaTick = nil
anim = nil
end
end
if isMouseInPosition ( icon_x - 300 , icon_y , 128 , 128 ) then color_one_down = { 36 , 175 , 178 } else color_one_down = { 255 , 255 , 255 } end
if isMouseInPosition ( icon_x - 150 , icon_y , 128 , 128 ) then color_two_down = { 36 , 175 , 178 } else color_two_down = { 255 , 255 , 255 } end
if isMouseInPosition ( icon_x , icon_y , 128 , 128 ) then color_three_down = { 36 , 175 , 178 } else color_three_down = { 255 , 255 , 255 } end
if isMouseInPosition ( icon_x + 150 , icon_y , 128 , 128 ) then color_four_down = { 36 , 175 , 178 } else color_four_down = { 255 , 255 , 255 } end
if isMouseInPosition ( icon_x + 300 , icon_y , 128 , 128 ) then color_five_down = { 36 , 175 , 178 } else color_five_down = { 255 , 255 , 255 } end
if isMouseInPosition ( icon_x + 450 , icon_y , 128 , 128 ) then color_six_down = { 36 , 175 , 178 } else color_six_down = { 255 , 255 , 255 } end
dxDrawImage ( icon_x - 300 , icon_y + up , 128 , 128 , "images/extinguisher.png" , 0 , 0 , 0 , tocolor ( color_one_down [ 1 ], color_one_down [ 2 ], color_one_down [ 3 ], alpha ), false )
dxDrawImage ( icon_x - 150 , icon_y + up , 128 , 128 , "images/ladder.png" , 0 , 0 , 0 , tocolor ( color_two_down [ 1 ], color_two_down [ 2 ], color_two_down [ 3 ], alpha ), false )
dxDrawImage ( icon_x , icon_y + up , 128 , 128 , "images/object.png" , 0 , 0 , 0 , tocolor ( color_three_down [ 1 ], color_three_down [ 2 ], color_three_down [ 3 ], alpha ), false )
dxDrawImage ( icon_x + 150 , icon_y + up , 128 , 128 , "images/saw.png" , 0 , 0 , 0 , tocolor ( color_four_down [ 1 ], color_four_down [ 2 ], color_four_down [ 3 ], alpha ), false )
dxDrawImage ( icon_x + 300 , icon_y + up , 128 , 128 , "images/sorbent.png" , 0 , 0 , 0 , tocolor ( color_five_down [ 1 ], color_five_down [ 2 ], color_five_down [ 3 ], alpha ), false )
dxDrawImage ( icon_x + 450 , icon_y + up , 128 , 128 , "images/aodo.png" , 0 , 0 , 0 , tocolor ( color_six_down [ 1 ], color_six_down [ 2 ], color_six_down [ 3 ], alpha ), false )
end
for i , v in ipairs ( getElementsByType ( "vehicle" )) do
if v . model == 407 then
if v : getData ( "vehicle:rank" ) then
marker = Marker ( 0 , 0 , 0 , "cylinder" , 1 , 255 , 0 , 0 , 150 )
attachElements ( marker , v , 1.8 , 0 , - 1 )
addEventHandler ( "onClientMarkerHit" , resourceRoot , function( player , dimension )
if player == localPlayer and dimension then
if not isEventHandlerAdded ( "onClientRender" , root , drawGUI ) then
if player : getData ( "player:duty" ) == "SAFD" then
local data = marker : getData ( "marker:vehicle" )
ticks . vehicle = data
alpha = 0
anim = "fadein"
showChat ( false )
showCursor ( true , false )
ticks . animTick = getTickCount ()
ticks . alphaTick = getTickCount ()
player : setData ( "player:blackwhite" , true )
player : setData ( "player:hud_visible" , true )
setPlayerHudComponentVisible ( "radar" , false )
addEventHandler ( "onClientRender" , root , drawGUI )
-- triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "podchodzi do wozu, przegl?daj?c zawarto??..." )
end
end
end
end )
addEventHandler ( "onClientMarkerLeave" , marker , function( player , dimension )
if player == localPlayer and dimension then
if isEventHandlerAdded ( "onClientRender" , root , drawGUI ) then
alpha = 255
showChat ( true )
anim = "fadeout"
showCursor ( false )
ticks . vehicle = nil
ticks . animTick = getTickCount ()
ticks . alphaTick = getTickCount ()
player : setData ( "player:blackwhite" , false )
player : setData ( "player:hud_visible" , false )
setPlayerHudComponentVisible ( "radar" , true )
end
end
end )
end
end
end
local function closeGUI ()
alpha = 255
showChat ( true )
anim = "fadeout"
showCursor ( false )
ticks . animTick = getTickCount ()
ticks . alphaTick = getTickCount ()
setPlayerHudComponentVisible ( "radar" , true )
localPlayer : setData ( "player:blackwhite" , false )
localPlayer : setData ( "player:hud_visible" , false )
end
addEventHandler ( "onClientClick" , root , function( button , state )
if button == "left" and state == "down" then
if isEventHandlerAdded ( "onClientRender" , root , drawGUI ) then
if isMouseInPosition ( icon_x - 300 , icon_y , 128 , 128 ) then
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "bierze ga?nic? ze schowka." )
triggerServerEvent ( "iyw_fire_equipment:give" , localPlayer , "extinguisher" )
elseif isMouseInPosition ( icon_x - 150 , icon_y , 128 , 128 ) then
if not localPlayer : getData ( "player:ladder" ) then
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "w?wczas chwyci? za drabin?, oraz wyj?? j? ze schowka." )
triggerServerEvent ( "iyw_fire_equipment:give" , localPlayer , "ladder" )
else
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "z?o?y? drabin?, oraz umie?ci? j? w schowku." )
triggerServerEvent ( "iyw_fire_equipment:give" , localPlayer , "ladder" )
end
elseif isMouseInPosition ( icon_x , icon_y , 128 , 128 ) then
if not localPlayer : getData ( "vehicle:jumping" ) then
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "bierze skokochron ze schowka." )
triggerServerEvent ( "iyw_fire_equipment:give" , localPlayer , "jump" )
else
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "chowa skokochron do schowka." )
localPlayer : setData ( "vehicle:jumping" , false )
end
elseif isMouseInPosition ( icon_x + 150 , icon_y , 128 , 128 ) then
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "bierze pi?? mechaniczn? ze schowka." )
triggerServerEvent ( "iyw_fire_equipment:give" , localPlayer , "saw" )
elseif isMouseInPosition ( icon_x + 450 , icon_y , 128 , 128 ) then
closeGUI ()
triggerServerEvent ( "iyw_fire_equipment:say" , localPlayer , "bierze AODO ze schowka." )
triggerServerEvent ( "iyw_fire_equipment:give" , localPlayer , "aodo" )
end
end
end
end )
Tagi: nie :: działający :: schowek :: psp
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: