اللي فهمته منك انك تبي تسوي لوحه وا ماركرات ولما اللاعب يوقف عالماركر
تفتحله لوحه ويضغط الزر ياخد منها سياره
ملف سيرفر
ves = { }
addEvent("giveCar")
addEventHandler("giveCar", root,
function( action, data )
if ( action == "car" ) then
if ( isElement ( ves[source] ) ) then destroyElement( ves[source] ) end
local x, y, z = getElementPosition(source)
ves[source] = createVehicle ( data['carID'], x, y, z )
warpPedIntoVehicle( source, ves[source] )
outputChatBox( "#AA0000 You Get [ ".. data['carName'] .." ] ! ", source, 0, 0, 0, true )
end
end
)
ملف كلنت
GUIEditor = {
gridlist = {},
window = {},
button = {}
}
Vehicles = guiCreateWindow(606, 221, 259, 378, "::[Vehicles]::", false)
guiWindowSetSizable(Vehicles, false)
guiSetVisible( Vehicles, false )
guiSetProperty(Vehicles, "CaptionColour", "FF6FBC40")
ID = guiCreateGridList(9, 22, 240, 322, false, Vehicles)
guiGridListAddColumn(ID, "#", 0.3)
guiGridListAddColumn(ID, "Vehicles", 0.3)
guiGridListAddColumn(ID, "ID", 0.3)
Use = guiCreateButton(14, 346, 98, 22, "Use", false, Vehicles)
guiSetFont(Use, "default-bold-small")
guiSetProperty(Use, "NormalTextColour", "FF62977A")
Colos = guiCreateButton(147, 346, 98, 22, "Colos", false, Vehicles)
guiSetFont(Colos, "default-bold-small")
guiSetProperty(Colos, "NormalTextColour", "FFD14529")
local Markers = { -- الماركرات
{3045.10132 ,2047.44727 ,23.59525},
{3064.66455 ,2047.49512 ,23.59525},
{3083.14307 ,2047.31677 ,23.59525},
{3083.98706 ,2165.42358 ,23.59525},
{3064.50220 ,2165.48853 ,23.59525},
{3047.02734 ,2165.67456 ,23.59525},
}
for i,M in ipairs(Markers) do
local marker = createMarker ( M[1], M[2], M[3] -2 , "cylinder", 1.5, 0, 0, 255 , 35 )
end
wndroot = getResourceRootElement()
addEventHandler("onClientMarkerHit", root,
function( plr )
if plr == localPlayer then
guiSetVisible( Vehicles, true )
showCursor( true )
refresh ()
end
end
)
addEventHandler("onClientGUIClick", wndroot,
function()
if ( source == Colos ) then
guiSetVisible( Vehicles, false )
showCursor( false )
end
end
)
vehicles = { -- Name / ID
{"Car 1", 409 },
{"Car 2", 415 },
}
function refresh ()
guiGridListClear( ID )
for i,v in ipairs ( vehicles ) do
local idRow = guiGridListAddRow ( ID )
guiGridListSetItemText( ID, idRow, 1, tostring ( v[1] ), false, false )
guiGridListSetItemData( ID, idRow, 1, { carName = v[1] ,carID = v[2] } )
end
end
addEventHandler("onClientGUIClick", wndroot,
function()
local selected = guiGridListGetSelectedItem( ID )
local text = guiGridListGetItemText( ID, selected, 1 )
local dataa = guiGridListGetItemData( ID, selected, 1 )
if source == Use then
if ( selected ~= -1 ) then
triggerServerEvent( "giveCar", localPlayer, "car", dataa )
end
end
end
)