SmoKing Posted June 12, 2013 Share Posted June 12, 2013 (edited) السلام عليكم شباب ابيكم تساعدوني في ماركر يوم تروح له تفتح لك لوحه تجيكم سيارات تختار بس انا يوم اروح للماركر يطلع اللوحه ويوم اختار سياره يكتب onVehicleCreaeCreate وش مشكلته الاكواد client -------------------------------- local spots = { -- size -- r, g, b -- a -- { x, y, z, _, size, r, g, b, a }, { 2822.3000488281, 2745.6000976563, 9.8000001907349, _, 2, 239, 57, 15, 255 } } --- Cars = { -- ['Name'] = ID ['Infernus'] = 411, ['Turismo'] = 451, ['Monster 2'] = 556, ['NRG-500'] = 511 } -------------------------------- -------------------------------- 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,"Cars",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,"Selection",true,GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(0.0664,0.869,0.8628,0.1016,"Close",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, 'Group' ) == "Grim" then guiSetVisible ( GUIEditor.window[1], true ) showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) 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 ) 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 ) end end end ) players = getElementsByType ( 'player' ) function getAllowed ( ) for _,v in ipairs( Groups ) do return v end end server addEventHandler ( 'onPlayerLogin', root, function ( _, acc ) if isGuestAccount ( acc ) then return end local accName = getAccountName ( acc ) if isObjectInACLGroup ( 'user.'..accName, aclGetGroup ( getAllowed ( ) ) ) then if getElementData ( element, 'Group' ) == "Grim" then end end ) addEventHandler ( 'onPlayerLogout', root, function ( ) if getElementData ( element, 'Group' ) == "Grim" then end ) addEvent ( 'onVehicleCreate', true ) addEventHandler ( 'onVehicleCreate', root, function ( id ) local x, y, z = getElementPosition ( source ) if isElement ( car ) then destroyElement ( car ) end car = createVehicle ( id, x, y, z ) warpPedIntoVehicle ( source, car ) setVehicleDamageProof ( car, false ) setElementData ( car, 'fromMarker', true ) setElementData ( car, 'owner', getPlayerSerial ( source ) ) end ) addEventHandler ( 'onPlayerQuit', root, function ( ) local veh = getPedOccupiedVehicle ( source ) if veh then destroyElement ( veh ) end for k,v in ipairs( getElementsByType ( 'vehicle' ) ) do if getElementData ( v, 'fromMarker' ) then if getPlayerSerial ( source ) == getElementData ( v, 'owner' ) then destroyElement ( v ) end end end end ) addEventHandler ( 'onVehicleStartEnter', root, function ( player, seat ) if getElementData ( source, 'fromMarker' ) then if seat == 0 then local acc = getPlayerAccount ( player ) if isGuestAccount ( acc ) then cancelEvent ( ) return outputChatBox ( '!You must be Grim', player ) end local accName = getAccountName ( acc ) cancelEvent ( ) return outputChatBox ( '!You must be Grim', player ) end end end end ) Edited June 12, 2013 by Guest Link to comment
iPrestege Posted June 12, 2013 Share Posted June 12, 2013 اول وظيفة ب السيرفر ماتسوي شيء ( = !؟ وجودها ماله اي معنئ Link to comment
SmoKing Posted June 12, 2013 Author Share Posted June 12, 2013 طيب الحين انت عدله وانا بمسح الي فوق Link to comment
K1NG Posted June 12, 2013 Share Posted June 12, 2013 ههههههههههه ، أنت تبي تسوي لوحة سيارات عشان المقر بسيرفر بسول صح ؟ أول شي الكود نصه غلط ، ثاني شي سيرفر بسول ماتقدر تسجل خروج فيه وأول ما تدخل لازم تسجل دخول يعني ما يحتاج تتحقق ، ثالث شي إمسح الكود كامل .. لأنه لما تعطي بسول المقر هو يسوي لوحة السيارات ، أنت بس عليكـ تسوي جدول بأيديهات السيارات الي تبيها مثآل : Cars = { 412, 432, 434, 435, 456, ..., ... } حط الجدول بمفكرة خارجية وحطه بمجلد الماب حق المقر وإرسله لبسول وهو يسوي الباقي . Link to comment
SmoKing Posted June 12, 2013 Author Share Posted June 12, 2013 لا مو عشان سيرفر بسول بس صلحها -_-" Link to comment
iPrestege Posted June 12, 2013 Share Posted June 12, 2013 getAllowed ( ) = ? و كودك للآسف اخطائـه كثيرهـ جدا .. Link to comment
SmoKing Posted June 12, 2013 Author Share Posted June 12, 2013 ياخي هي شغال بس يوم اضغط سيلكت مايجي السياره بس Link to comment
iPrestege Posted June 12, 2013 Share Posted June 12, 2013 السيرفر اخطائهـ كثيرهـ اقولك ثلاث ارباعه اخطاء .. 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