StifMaster
Wiek: 30 Na forum: 3525 dni Posty: 57
Nick w MP: Sztefi
Piwa : 5
Witam, jak zrobi? ?eby neony nie by?y do auta tylko do ziemi. Tak jak na Mega . Z g?ry dzi?ki
c.lua
GUIEditor = {
button = {},
window = {},
label = {}
}
addEventHandler ( "onClientResourceStart" , resourceRoot ,
function()
GUIEditor . window [ 1 ] = guiCreateWindow ( 0.41 , 0.17 , 0.19 , 0.60 , "Panel Nen?w" , true )
guiWindowSetMovable ( GUIEditor . window [ 1 ], false )
guiWindowSetSizable ( GUIEditor . window [ 1 ], false )
guiSetAlpha ( GUIEditor . window [ 1 ], 0.56 )
guiSetProperty ( GUIEditor . window [ 1 ], "CloseButtonEnabled" , "False" )
guiSetProperty ( GUIEditor . window [ 1 ], "CaptionColour" , "FF1EB8AF" )
GUIEditor . button [ 1 ] = guiCreateButton ( 0.07 , 0.19 , 0.86 , 0.06 , "Czerwony" , true , GUIEditor . window [ 1 ])
GUIEditor . button [ 2 ] = guiCreateButton ( 0.07 , 0.48 , 0.86 , 0.06 , "Zolty" , true , GUIEditor . window [ 1 ])
GUIEditor . button [ 3 ] = guiCreateButton ( 0.07 , 0.58 , 0.86 , 0.06 , "Rozowy" , true , GUIEditor . window [ 1 ])
GUIEditor . button [ 4 ] = guiCreateButton ( 0.07 , 0.90 , 0.86 , 0.06 , "Usun Neon" , true , GUIEditor . window [ 1 ])
GUIEditor . button [ 5 ] = guiCreateButton ( 0.07 , 0.29 , 0.86 , 0.06 , "Niebieski" , true , GUIEditor . window [ 1 ])
GUIEditor . button [ 6 ] = guiCreateButton ( 0.07 , 0.38 , 0.86 , 0.06 , "Zielony" , true , GUIEditor . window [ 1 ])
GUIEditor . button [ 7 ] = guiCreateButton ( 0.07 , 0.68 , 0.86 , 0.06 , "Bialy" , true , GUIEditor . window [ 1 ])
GUIEditor . label [ 1 ] = guiCreateLabel ( 0.23 , 0.07 , 0.62 , 0.04 , "Wybierz Kolor!" , true , GUIEditor . window [ 1 ])
guiSetFont ( GUIEditor . label [ 1 ], "clear-normal" )
guiLabelSetHorizontalAlign ( GUIEditor . label [ 1 ], "center" , false )
guiLabelSetVerticalAlign ( GUIEditor . label [ 1 ], "center" )
guiSetVisible ( GUIEditor . window [ 1 ], false )
end
)
function showWindow ()
guiSetVisible ( GUIEditor . window [ 1 ], true )
showCursor ( true )
end
addEvent ( "showWindow" , true )
addEventHandler ( "showWindow" , getRootElement (), showWindow )
function onClickRegister ( button , state )
if( button == "left" and state == "up" ) then
local vehicle = getPedOccupiedVehicle ( localPlayer )
if ( source == GUIEditor . button [ 1 ]) then
guiSetVisible ( GUIEditor . window [ 1 ], false )
showCursor ( false )
setElementData ( vehicle , "neony" , 1 )
end
if ( source == GUIEditor . button [ 2 ]) then
guiSetVisible ( GUIEditor . window [ 1 ], false )
showCursor ( false )
setElementData ( vehicle , "neony" , 4 )
end
if ( source == GUIEditor . button [ 3 ]) then
guiSetVisible ( GUIEditor . window [ 1 ], false )
showCursor ( false )
setElementData ( vehicle , "neony" , 5 )
end
if ( source == GUIEditor . button [ 7 ]) then
guiSetVisible ( GUIEditor . window [ 1 ], false )
showCursor ( false )
setElementData ( vehicle , "neony" , 6 )
end
if ( source == GUIEditor . button [ 5 ]) then
guiSetVisible ( GUIEditor . window [ 1 ], false )
showCursor ( false )
setElementData ( vehicle , "neony" , 2 )
end
if ( source == GUIEditor . button [ 6 ]) then
guiSetVisible ( GUIEditor . window [ 1 ], false )
showCursor ( false )
setElementData ( vehicle , "neony" , 3 )
end
if ( source == GUIEditor . button [ 4 ]) then
guiSetVisible ( GUIEditor . window [ 1 ], false )
showCursor ( false )
setElementData ( vehicle , "neony" , false )
end
end
end
addEventHandler ( "onClientGUIClick" , resourceRoot , onClickRegister )
s.lua
-- ///////////////////////////////////// Settings ////////////////////////////////////////
local NID ={
3962 , 2113 , 1784 , 2054 , 2428 , 2352
}
local postion ={- 1 , 0 ,- 0.5 }
-- ///////////////////////////////////// Other /////////////////////////////////
function bindHoron4 ( veh )
if not veh then return end
local OBJECTID = tonumber ( getElementData ( veh , "neony" ))
if not OBJECTID then return end
if OBJECTID == 0 then return end
local zalozone = getElementData ( veh , "zalozone" )
if ( zalozone and type ( zalozone )== "table" ) then
destroyElement ( zalozone [ 1 ])
destroyElement ( zalozone [ 2 ])
removeElementData ( veh , "zalozone" )
else
neon1 = createObject ( NID [ OBJECTID ], 0 , 0 , 0 )
neon2 = createObject ( NID [ OBJECTID ], 0 , 0 , 0 )
setElementData ( veh , "zalozone" , { neon1 , neon2 })
attachElements ( neon1 , veh , postion [ 1 ], postion [ 2 ], postion [ 3 ])
attachElements ( neon2 , veh ,- postion [ 1 ], postion [ 2 ], postion [ 3 ])
setElementVelocity ( veh , 0 , 0 , 0.01 )
end
end
addEventHandler ( "onElementDestroy" , getRootElement (), function ()
if getElementType ( source ) == "vehicle" then
local zalozone = getElementData ( source , "zalozone" )
if ( zalozone and type ( zalozone )== "table" ) then
destroyElement ( zalozone [ 1 ])
destroyElement ( zalozone [ 2 ])
removeElementData ( source , "zalozone" )
end
end
end )
function outputChange ( dataName , oldValue )
if getElementType ( source ) == "vehicle" then
if dataName == "neony" then
local zalozone = getElementData ( source , "zalozone" )
if ( zalozone and type ( zalozone )== "table" ) then
destroyElement ( zalozone [ 1 ])
destroyElement ( zalozone [ 2 ])
removeElementData ( source , "zalozone" )
end
bindHoron4 ( source )
end
end
end
addEventHandler ( "onElementDataChange" , getRootElement (), outputChange )