Scorpio Posted May 1, 2013 Share Posted May 1, 2013 السلام عليكم انا عندي كودين مركلين الأول وهو توقف في الماركر يطلع لوحة تختار سيارة لكن مشكلة لما تاخذ سيارة و واحد ثاني يجي يستخدم الماركر السيارة تختفي الي مع الأول الكود --[[ * Script : Admins Cars Marker | v1.0 * Type : client ============ * Author : --]] -------------------------------- local spots = { -- size = -- r, g, b = -- a = -- { x, y, z, _, size, r, g, b, a }, { 2487.6398925781, -1666.7453613281, 13.34375, _, 1.5, 255, 255, 0, 255 }, { 1536.6932373047, -1684.7084960938, 13.546875, _, 1.5, 255, 255, 0, 255 }, { 1755.7238769531, -1896.7358398438, 13.556614875793, _, 1.5, 255, 0, 0, 255 }, { 2007.5480957031, -1440.3802490234, 13.563167572021, _, 1.5, 255, 255, 0, 255 } } --- Cars = { -- ['Name'] = ID ['faggio'] = 462, ['burrito'] = 482, ['bobcat'] = 422 } -------------------------------- for k,v in ipairs( spots ) do createMarker ( v[1],v[2],v[3] - 1, 'cylinder', v[5], v[6], v[7], v[8], v[9] ) end for k,v in ipairs( getElementsByType ( 'marker', resourceRoot ) ) do setElementData ( v, 'fromMode', true ) end function getIDFromName ( name ) for k,v in pairs( Cars ) do if name == k then return v end end return nil end GUIEditor = { window = { }, grid = { }, button = { } } addEventHandler ( 'onClientResourceStart', resourceRoot, function ( ) GUIEditor.window[1] = guiCreateWindow(0.3512,0.2567,0.2825,0.6233,"Car Admin",true) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) ---- GUIEditor.grid[1] = guiCreateGridList(0.0619,0.0615,0.8761,0.6471,true,GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.grid[1],"Name",0.9) for k,v in pairs( Cars ) do local row = guiGridListAddRow ( GUIEditor.grid[1] ) guiGridListSetItemText ( GUIEditor.grid[1], row, 1, k, false, false ) end ---- GUIEditor.button[1] = guiCreateButton(0.0664,0.7326,0.8628,0.1016,"اختيار",true,GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(0.0664,0.869,0.8628,0.1016,"اغلاق",true,GUIEditor.window[1]) end ) addEventHandler ( 'onClientMarkerHit', root, function ( element ) if element == localPlayer then if getElementData ( source, 'fromMode' ) then if isPedInVehicle ( element ) then return end if getElementData ( element, 'Admin' ) then guiSetVisible ( GUIEditor.window[1], true ) showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) else outputChatBox ( '#ff0000 الرجاء تسجيل دخولك لكي تستطيع استخدام الماركر', 255, 255, 0, true ) end end end end ) addEventHandler ( 'onClientGUIClick', root, function ( ) if source == GUIEditor.button[1] then local row, col = guiGridListGetSelectedItem ( GUIEditor.grid[1] ) if row and col and row ~= -1 and col ~= -1 then local name = guiGridListGetItemText ( GUIEditor.grid[1], row, col ) local id = getIDFromName ( name ) triggerServerEvent ( 'onVehicleCreate', localPlayer, id ); guiSetVisible ( GUIEditor.window[1], false ) showCursor ( false ) else outputChatBox ( '#00ffff الرجاء اختيار سيارة من الوحة', 255, 255, 255, true ); end elseif source == GUIEditor.button[2] then guiSetVisible ( GUIEditor.window[1], false ) showCursor ( false ) end end ) addEventHandler ( 'onClientGUIDoubleClick', root, function ( ) if source == GUIEditor.grid[1] then local row, col = guiGridListGetSelectedItem ( GUIEditor.grid[1] ) if row and col and row ~= -1 and col ~= -1 then local name = guiGridListGetItemText ( GUIEditor.grid[1], row, col ) local id = getIDFromName ( name ) triggerServerEvent ( 'onVehicleCreate', localPlayer, id ); guiSetVisible ( GUIEditor.window[1], false ) showCursor ( false ) else return end end end ) Link to comment
iPrestege Posted May 1, 2013 Share Posted May 1, 2013 getIDFromName > getVehicleIDFromName Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now