Wysłany: 2018-11-11, 16:03
Fl!k
Wiek: 26 Na forum: 3593 dni Posty: 162
Piwa : 18
Witam gdy dodaje do schowka aby mozna by?o wyci?ga? skina nie dzia?a
Kod 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 )
Wysłany: 2018-11-11, 17:18
Kalizman
Wiek: 23 Na forum: 3652 dni Posty: 1394
Piwa : 4619
poka? miejsce w kt?rym dajesz skina bo nie widz? go w kodzie
Wysłany: 2018-11-11, 18:13
Fl!k
Wiek: 26 Na forum: 3593 dni Posty: 162
Piwa : 18
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 )
debugscript 3
Oraz s.lua
object = {}
object_preview = {}
elements = {}
addEvent ( "iyw_fire_equipment:say" , true )
addEventHandler ( "iyw_fire_equipment:say" , root , function( text )
local sphere = ColShape . Sphere ( Vector3 ( getElementPosition ( source )), 30 )
local players = sphere : getElementsWithin ( "player" )
sphere : destroy ()
for _ , v in pairs ( players ) do
outputChatBox ( "** " .. source . name : gsub ( "#%x%x%x%x%x%x" , "" ).. " " .. text , v , 255 , 128 , 255 )
end
end )
local function create ( player )
if player : getData ( "player:duty" ) == "SAFD" then
object_preview [ player ] = Object ( 1437 , 0 , 0 , 0 , 0 , 0 , 0 )
object_preview [ player ]: setCollisionsEnabled ( false )
object_preview [ player ]. scale = 0.8
object_preview [ player ]: attach ( player , 0 , 2 , 0 , - 30 , 0 , 0 )
bindKey ( player , "z" , "down" , function( participant )
local rotation = { getElementRotation ( object_preview [ player ])}
object [ participant ] = Object ( 1437 , Vector3 ( getElementPosition ( object_preview [ player ])), - 30 , rotation [ 2 ], rotation [ 3 ])
object [ participant ]. scale = 1
object_preview [ player ]: detach ()
object_preview [ player ]: destroy ()
object_preview [ player ] = nil
end )
end
end
addEventHandler ( "onPlayerQuit" , root , function()
if object_preview [ source ] or isElement ( object_preview [ source ]) or elements [ source ] or isElement ( elements [ source ]) or object [ source ] or isElement ( object [ source ]) then
object_preview [ source ]: destroy ()
elements [ source ]: destroy ()
object [ source ]: destroy ()
end
end )
addEvent ( "iyw_fire_equipment:give" , true )
addEventHandler ( "iyw_fire_equipment:give" , root , function( value )
if value == "extinguisher" then
triggerClientEvent ( source , "onClientAddNotification" , source , "Wzi??e?(a?) ga?nic? ze schowka." , "success" )
giveWeapon ( source , 42 , 9999 )
elseif value == "saw" then
triggerClientEvent ( source , "onClientAddNotification" , source , "Wzi??e?(a?) pi?? mechaniczn? ze schowka." , "success" )
giveWeapon ( source , 9 , 9999 )
elseif value == "aodo" then
triggerClientEvent ( source , "onClientAddNotification" , source , "Wzi??e?(a?) AODO ze schowka." , "success" )
setPlayerSkin ( root , 278 )
elseif value == "jump" then
triggerClientEvent ( source , "onClientAddNotification" , source , "Wzi??e?(a?) skokochron ze schowka. (Aby go postawi?, wpisz /skokochron)" , "success" )
setElementData ( source , "vehicle:jumping" , true )
elseif value == "ladder" then
if not source : getData ( "player:ladder" ) then
if not object [ source ] and not elements [ source ] then
elements [ source ] = Object ( 1428 , 0 , 0 , 0 , 0 , 0 , 0 )
elements [ source ]: setCollisionsEnabled ( false )
elements [ source ]. scale = 0.8
exports [ "bone_attach" ]: attachElementToBone ( elements [ source ], source , 3 , 0.2 , 0 , - 0.1 , 0 , 90 , 80 )
source : setData ( "player:ladder" , true )
setControlState ( source , "walk" , true )
bindKey ( source , "lctrl" , "down" , function( player )
if player : getData ( "player:ladder" ) then
if elements [ player ] and isElement ( elements [ player ]) then
elements [ player ]: destroy ()
player : setData ( "player:ladder" , false )
setControlState ( player , "walk" , false )
end
create ( player )
end
end )
else
triggerClientEvent ( source , "onClientAddNotification" , source , "Mo?esz ro??o?y? tylko jedn? drabin?!" , "error" )
end
else
if elements [ source ] and isElement ( elements [ source ]) then
elements [ source ]: destroy ()
source : setData ( "player:ladder" , false )
setControlState ( source , "walk" , false )
end
end
end
end )
Wysłany: 2018-11-11, 18:27
Kalizman
Wiek: 23 Na forum: 3652 dni Posty: 1394
Piwa : 4619
Wysłany: 2018-11-11, 18:36
Fl!k
Wiek: 26 Na forum: 3593 dni Posty: 162
Piwa : 18
s?
[ Dodano : 2018-11-11, 18:38 ]
M?g? by? mi to zrobi??
[ Dodano : 2018-11-11, 21:05 ]
"Kalizman" napisał/a :
Zrobi? bys mi to?
Wysłany: 2018-11-12, 18:34
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
"Szym34kKacperQ" napisał/a :s?
[ Dodano : 2018-11-11, 18:38 ]
M?g? by? mi to zrobi??
[ Dodano : 2018-11-11, 21:05 ]
"Kalizman" napisał/a :
Zrobi? bys mi to?
Sp?jrz, kt?ra to linijka. Sp?jrz ile masz funkcji, kt?rym brakuje zamkni?cia end'u i tyle.
Tagi: schowek :: psp
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: