local skins = { "Skin Jobs 1 (skin: 271)", "Skin Jobs 2 (skin: 298)" }
GUIEditor = {
--label = {},
button = {},
window = {},
memo = {},
gridlist = {}
}
GUIEditor.window = guiCreateWindow(256, 98, 294, 435, "baba", false)
guiWindowSetSizable(GUIEditor.window, false)
GUIEditor.memo = guiCreateMemo(9, 27, 275, 219, " \"{SMILIES_PATH}/icon_razz.gif\" alt=\"\" title=\"Razz\" /> ", false, GUIEditor.window)
guiMemoSetReadOnly(GUIEditor.memo, true)
GUIEditor.aceptar = guiCreateButton(9, 397, 127, 28, "Take Skin Jop", false, GUIEditor.window)
GUIEditor.cancelar = guiCreateButton(157, 397, 127, 28, "Exit", false, GUIEditor.window)
GUIEditor.gridlist = guiCreateGridList(9, 256, 275, 131, false, GUIEditor.window)
guiGridListSetSelectionMode(GUIEditor.gridlist,2)
_skins = guiGridListAddColumn(GUIEditor.gridlist, "اختار شخصياتك", 0.9)
guiSetVisible(GUIEditor.window, false)
for index, skin in ipairs ( skins ) do
local row = guiGridListAddRow ( GUIEditor.gridlist )
guiGridListSetItemText ( GUIEditor.gridlist, row, _skins, tostring ( skin ), false, false )
end
addEventHandler ( "onClientGUIClick", guiRoot,
function ( )
if ( source == GUIEditor.aceptar ) then
local row, col = guiGridListGetSelectedItem ( GUIEditor.gridlist )
if ( row and col and row ~= -1 and col ~= -1 ) then
local skinName = guiGridListGetItemText ( GUIEditor.gridlist, row, 1 )
if ( skinName == "Skin Jobs 1 (skin: 271)" ) then
triggerServerEvent ( "setBarco", localPlayer, 271 )
elseif ( skinName == "Skin Jobs 2 (skin: 298)" ) then
triggerServerEvent ( "setBarco", localPlayer, 298 )
end
guiSetVisible ( GUIEditor.window, false )
showCursor ( false )
else
outputChatBox ( "اخترا شخصيتك ", 255, 0, 0 )
end
elseif ( source == GUIEditor.cancelar ) then
guiSetVisible ( GUIEditor.window, false )
showCursor ( false )
end
end
)
function pe ()
if guiGetVisible (GUIEditor.window) == true then
else
showCursor (true)
guiSetVisible (GUIEditor.window,true)
end
end
addEvent ("baba", true)
addEventHandler ("baba",root, pe)
addEvent ( "barco_set_location", true )
addEventHandler ( "barco_set_location", root,
function ( x, y, z )
marker = createMarker ( x, y, z - 1, "cylinder", 2.5, 235, 141, 19, 153 )
blip = createBlipAttachedTo ( marker, 41 )
addEventHandler ( "onClientMarkerHit", marker, onBarcoStopHit )
end
)
function onBarcoStopHit ( hitPlayer )
if ( getElementType ( hitPlayer ) == "player" ) and ( hitPlayer == localPlayer ) then
triggerServerEvent ( "pizza_finish", localPlayer )
if isElement ( blip ) then
destroyElement ( blip )
end
if isElement ( marker ) then
removeEventHandler ( "onClientMarkerHit", marker, onBarcoStopHit )
destroyElement ( marker )
end
end
end
addEventHandler ( "onClientVehicleExit", root,
function ( thePlayer )
if ( thePlayer == localPlayer ) then
if isElement ( blip ) then
destroyElement ( blip )
end
if isElement ( marker ) then
removeEventHandler ( "onClientMarkerHit", marker, onBarcoStopHit )
destroyElement ( marker )
end
end
end
)
GUIEditor_Button = {}
GUIEditor_Grid = {}
GUIEditor_Marker = {}
GUIEditor_Window = {}
vehicleId = {535,600}
GUIEditor_Marker[1] = createMarker(2473.52051, -1696.91187, 12.51631,"cylinder",3,255,255,0,255)
GUIEditor_Marker[2] = createMarker(2459.45264, -1690.21484, 12.54478,"cylinder",3,255,0,0,0)
local x,y = guiGetScreenSize()
local x = x - 208
local y = y - 321
GUIEditor_Window[1] = guiCreateWindow(200,147,246,314,"baba",false)
guiSetVisible(GUIEditor_Window[1],false)
guiSetAlpha(GUIEditor_Window[1],1)
guiWindowSetSizable(GUIEditor_Window[1],false)
GUIEditor_Grid[1] = guiCreateGridList(9,34,228,155,false,GUIEditor_Window[1])
guiGridListSetSelectionMode(GUIEditor_Grid[1],2)
column = guiGridListAddColumn(GUIEditor_Grid[1],"vehicle name",0.9)
GUIEditor_Button[2] = guiCreateButton(20,208,210,41,"Select",false,GUIEditor_Window[1])
GUIEditor_Button[1] = guiCreateButton(20,252,210,41,"Close",false,GUIEditor_Window[1])
for i,id in ipairs ( vehicleId ) do
guiGridListSetItemText ( GUIEditor_Grid[1], guiGridListAddRow( GUIEditor_Grid[1] ), column, getVehicleNameFromModel( id ), false, false )
end
------------------------------------------------------------------------------------------------------
addEventHandler ("onClientMarkerHit", GUIEditor_Marker[1],
function( player )
if getPlayerTeam( player ) and getTeamName( getPlayerTeam( player ) ) == 'baba' and not isPedInVehicle( player ) and player == localPlayer then
x999,y999,z999 = getElementPosition( localPlayer )
setElementFrozen ( localPlayer, true )
guiSetVisible(GUIEditor_Window[1],true)
showCursor( true )
end
end
)
addEventHandler('onClientGUIClick', root,
function()
if ( source == GUIEditor_Button[1] ) then
guiSetVisible(GUIEditor_Window[1],false)
showCursor( false )
setElementFrozen ( localPlayer, false )
elseif ( source == GUIEditor_Button[2] ) then
local name = guiGridListGetItemText( GUIEditor_Grid[1], guiGridListGetSelectedItem ( GUIEditor_Grid[1] ), 1 )
triggerServerEvent('gvoa', getLocalPlayer(), name)
guiSetVisible(GUIEditor_Window[1],false)
setElementFrozen ( localPlayer, false )
showCursor( false )
end
end
)
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
addEventHandler("onClientRender", getRootElement(),
function()
local x, y, z = getElementPosition (GUIEditor_Marker[2])
local x2, y2, z2 = getElementPosition(localPlayer)
if(isLineOfSightClear(x, y, z, x2, y2, z2, true, true, false, true)) then
local sx, sy = getScreenFromWorldPosition(x, y, z+2)
if(sx) and (sy) then
local distance = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
if(distance < 100) then
dxDrawText("baba", sx, sy, sx, sy, tocolor(255, 255, 0, 1000), 2-(distance/100), "arial", "center", "center")
dxDrawText("baba", sx, sy, sx, sy, tocolor(255, 255, 0, 1000), 2-(distance/100), "arial", "center", "center")
end
end
end
end)
ذا الكود يا بسام