K̷i̷n̷g̷ x̷D̷ツ Posted May 27, 2017 Share Posted May 27, 2017 السلام عليكم ورحمة الله وبركاته رمضانكم مبارك معي مشكله مدري وين غلطان المود باللوحه اف3 يضهر سيارات اشخاص ثانيين مو سيارات انا شريتها المود client side local Key = 'F3' vehiclesTable = { { 'Super GT', 506, 200000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Windsor', 555, 52000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'NRG-500', 522, 2500000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'FCR-900', 521, 300000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Freeway', 463, 120000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'PCJ-600', 461, 230000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Pizza Boy', 448, 10000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Sanchez', 468, 300000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Euros', 587, 25000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Feltzer', 533, 6000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Hustler', 545, 25000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Stretch', 409, 100000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Virgo', 491, 20000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Club', 589, 35000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Manana', 410, 20000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Alpha', 602, 100000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Bravura', 401, 10000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Cadrona', 527, 20000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Towtruck', 525, 50000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Baggage', 485, 2500, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Bus', 431, 40000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Roadtrain', 515, 45000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Dozer', 486, 25000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Packer', 443, 25000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Phoenix', 603, 150000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Savanna', 567, 50000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Hotknife', 434, 50000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Flash', 565, 40000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Elgy', 562, 67000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Infernus', 411, 3000000, {-1655.719,1207.971,22.5,-1648.8270,1206.953,21.186} }, { 'Jester', 559, 55000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Sultan', 560, 60000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Turismo', 451, 1500000, {-1655.719,1207.971,22.5,-1648.8270,1206.953,21.186} }, { 'ZR-350', 477, 1000000, {-1655.719,1207.971,22.5,-1648.8270,1206.953,21.186} }, { 'Uranus', 558, 40000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Bullet', 541, 900000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Ferarri', 429, 5000000, {-1655.719,1207.971,22.5,-1648.8270,1206.953,21.186} }, { 'Cheetah', 415, 1200000, {-1655.719,1207.971,22.5,-1648.8270,1206.953,21.186} }, { 'Comet', 480, 900000, {-1655.719,1207.971,22.5,-1648.8270,1206.953,21.186} }, { 'Caddy', 457, 1000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Bandito', 568, 25000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'BF Injection', 424, 20000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Monster 3', 557, 1200000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Monster 2', 556, 900000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Monster', 444, 800000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Sandking', 495, 1000000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Mesa', 500, 320000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Quadbike', 471, 30000, {-1667.31152, 1213.07727, 15.87188, -1663.62793, 1208.41748, 13.67809} }, { 'Hunter', 425, 4000000, {-1665.27,1229.308,35,-1666.12,1217.4,32.9} }, { 'Cargobob', 548, 1000000, {-1665.27,1229.308,35,-1666.12,1217.4,33.5} }, { 'Maverick', 487, 3000000, {-1665.27,1229.308,35,-1666.12,1217.4,32.9} }, { 'Sparrow', 469, 800000, {-1665.27,1229.308,35,-1666.12,1217.4,32.9} }, { 'Rhino', 432, 3500000, {-1665.27,1229.308,35,-1666.12,1217.4,32.9} }, { 'Hydra', 520, 7500000, {-1665.27,1229.308,35,-1666.12,1217.4,32.9} }, }; local buyingMarker = createMarker( -1657.838, 1210.947, 6.5, 'cylinder', 1.2, 255, 0, 0, 255 ) Cplayer = getLocalPlayer( ) setElementData( Cplayer, 'VehiclesSystem;WarpToVehicle', nil ) setElementData( root, 'vehiclesSystem;dimension', 1 ) function centerWindow (center_window) local screenW, screenH = guiGetScreenSize() local windowW, windowH = guiGetSize(center_window, false) local x, y = (screenW - windowW) /2,(screenH - windowH) /2 return guiSetPosition(center_window, x, y, false) end function LeftWindow(wnd) local sx,sy = guiGetScreenSize() local w,h = guiGetSize(wnd,false) local x,y = 0,(sy - h)/2 guiSetPosition(wnd,x,y,false) end GUIEditor = { checkbox = {}, label = {}, button = {}, window = {}, gridlist = {} } GUIEditor.window[1] = guiCreateWindow(575, 377, 506, 514, ". Z.P: Vehicles System :Z.P .", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) guiSetVisible(GUIEditor.window[1],false) centerWindow(GUIEditor.window[1]) GUIEditor.gridlist[1] = guiCreateGridList(10, 32, 487, 296, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "ID", 0.2) guiGridListAddColumn(GUIEditor.gridlist[1], "Vehicle", 0.2) guiGridListAddColumn(GUIEditor.gridlist[1], "Price", 0.2) guiGridListAddColumn(GUIEditor.gridlist[1], "Subscription", 0.2) guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "506", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 2, "Super GT", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 3, "5,000$", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 4, "Permanent", false, false) GUIEditor.button[1] = guiCreateButton(10, 338, 156, 24, "Create Vehicle", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFEFB00") GUIEditor.button[2] = guiCreateButton(176, 338, 156, 24, "Destroy Vehicle", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFEFB00") GUIEditor.button[3] = guiCreateButton(10, 385, 156, 24, "Lock/Unlock Vehicle", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF00ADFE") GUIEditor.button[4] = guiCreateButton(176, 385, 156, 24, "On/Off Engine", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF00ADFE") GUIEditor.button[5] = guiCreateButton(342, 338, 155, 24, "On/Off Lights", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FF00ADFE") GUIEditor.button[6] = guiCreateButton(176, 440, 155, 24, "Warp To Buy Place", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFFE7100") GUIEditor.button[7] = guiCreateButton(84, 484, 346, 21, "X", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFFE0000") GUIEditor.button[8] = guiCreateButton(342, 385, 154, 24, "Sell Vehicle", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[8], "NormalTextColour", "FFFE7100") GUIEditor.checkbox[1] = guiCreateCheckBox(188, 414, 133, 21, "Warp To Vehicle", false, false, GUIEditor.window[1]) guiSetProperty(GUIEditor.checkbox[1], "NormalTextColour", "FFF9F000") cvehhh = guiCreateButton(14, 434, 134, 30, "Vehicle Controls", false, GUIEditor.window[1]) guiSetProperty(cvehhh, "NormalTextColour", "FFF9F000") ar = guiCreateButton(440, 484, 53, 21, "عربي", false, GUIEditor.window[1]) eng = guiCreateButton(19, 484, 55, 21, "english", false, GUIEditor.window[1]) ----------#Window2 buyplace = guiCreateWindow(0, 334, 266, 491, ". Z.P: Vehicles System :Z.P .", false) guiWindowSetSizable(buyplace, false) guiSetAlpha(buyplace, 1.00) guiSetVisible(buyplace, false) LeftWindow(buyplace) list_buyplace = guiCreateGridList(10, 29, 246, 313, false, buyplace) guiGridListSetSortingEnabled(list_buyplace, false) guiGridListAddColumn(list_buyplace, "#", 0.11) guiGridListAddColumn(list_buyplace, "Vehicle", 0.5) guiGridListAddColumn(list_buyplace, "Price", 0.5) buy_buyplace = guiCreateButton(46, 352, 172, 22, "Buy Vehicle", false, buyplace) guiSetProperty(buy_buyplace, "NormalTextColour", "FF00FE00") rent_buyplace = guiCreateButton(46, 423, 172, 22, "Rent Vehicle", false, buyplace) guiSetProperty(rent_buyplace, "NormalTextColour", "FFF5FD00") label_buyplace = guiCreateLabel(10, 384, 246, 29, "Note : You Can Also Rent Vehicle,\nRent Time : 5 Minutes, Price : 10,000$ .", false, buyplace) guiLabelSetColor(label_buyplace, 254, 84, 0) guiLabelSetHorizontalAlign(label_buyplace, "center", false) x_buyplace = guiCreateButton(46, 455, 172, 22, "X", false, buyplace) guiSetProperty(x_buyplace, "NormalTextColour", "FFFE0005") ara = guiCreateButton(226, 456, 30, 21, "ar", false, buyplace) enge = guiCreateButton(10, 456, 30, 21, "eng", false, buyplace) function addCarsToBuy( ) guiGridListClear( list_buyplace ) for _, vehicle in ipairs( vehiclesTable ) do local Price, value = string.gsub( vehicle[3], '^(-?%d+)(%d%d%d)', '%1,%2' ) local item = guiGridListAddRow( list_buyplace ) local cN = guiGridListSetItemText( list_buyplace, item, 2, vehicle[1], false, false ) local cP = guiGridListSetItemText( list_buyplace, item, 3, Price..'$', false, false ) local num = guiGridListSetItemText( list_buyplace, item, 1, _..'-', false, false ) local cD1 = guiGridListSetItemData( list_buyplace, item, 1, vehicle[4] ) local cD2 = guiGridListSetItemData( list_buyplace, item, 2, vehicle[2] ) local cD3 = guiGridListSetItemData( list_buyplace, item, 3, vehicle[3] ) guiGridListSetItemColor( list_buyplace, item, 2, 200, 200, 50 ) guiGridListSetItemColor( list_buyplace, item, 3, 50, 200, 200 ) guiGridListSetItemColor( list_buyplace, item, 1, 200, 100, 0 ) end end addCarsToBuy( ) function clickElements( ) if ( source == GUIEditor.button[7] ) then guiSetVisible( GUIEditor.window[1], false ) showCursor( false ) elseif ( source == GUIEditor.checkbox[1] ) then local Sel = guiCheckBoxGetSelected( GUIEditor.checkbox[1] ) if ( Sel == true ) then setElementData( Cplayer, 'VehiclesSystem;WarpToVehicle', 'Enabled' ) else setElementData( Cplayer, 'VehiclesSystem;WarpToVehicle', nil ) end elseif ( source == x_buyplace ) then fadeCamera( false ) setTimer( fadeCamera, 1500, 1, true ) guiSetVisible( buyplace, false ) showCursor( false ) setTimer( setCameraTarget, 1500, 1, Cplayer ) triggerServerEvent( 'VehiclesSystem;createViewVehicle', Cplayer, nil, nil, nil, nil, 'close' ) setElementDimension( Cplayer, 0 ) addCarsToBuy( ) elseif ( source == list_buyplace ) then local Sel = guiGridListGetSelectedItem( list_buyplace ) if ( Sel == -1 ) then return end local Data = guiGridListGetItemData( list_buyplace, Sel, 1 ) local x1, y1, z1, x2, y2, z2 = unpack( Data ) setCameraMatrix( x1, y1, z1, x2, y2, z2 ) if ( isElement( viewvehicle ) ) then if ( getElementModel( viewvehicle ) ) == guiGridListGetItemData( list_buyplace, Sel, 2 ) then return end destroyElement( viewvehicle ) end triggerServerEvent( 'VehiclesSystem;createViewVehicle', Cplayer, guiGridListGetItemData( list_buyplace, Sel, 2 ), x2, y2, z2, 'view' ) elseif ( source == rent_buyplace ) then local Sel = guiGridListGetSelectedItem( list_buyplace ) if ( Sel == -1 ) then outputChatBox( '#FFFFFFError, Please select vehicle #FF0000!', 255, 255, 255, true ) return end local ID = guiGridListGetItemData( list_buyplace, Sel, 2 ) if ( getPlayerMoney( Cplayer ) < 10000 ) then outputChatBox( '#FFFFFFError, You don\'t have enough money #FF0000!', 255, 255, 255, true ) return end guiSetVisible( buyplace, false ) showCursor( false ) setTimer( setCameraTarget, 1500, 1, Cplayer ) triggerServerEvent( 'VehiclesSystem;createRentVehicle', Cplayer, ID, guiGridListGetItemText( list_buyplace, Sel, 2 ) ) triggerServerEvent( 'VehiclesSystem;createViewVehicle', Cplayer, nil, nil, nil, nil, 'close' ) elseif ( source == buy_buyplace ) then local Sel = guiGridListGetSelectedItem( list_buyplace ) if ( Sel == -1 ) then outputChatBox( '#FFFFFFError, Please select vehicle #FF0000!', 255, 255, 255, true ) return end local ID = guiGridListGetItemData( list_buyplace, Sel, 2 ) local vN = guiGridListGetItemText( list_buyplace, Sel, 2 ) local Pr = guiGridListGetItemData( list_buyplace, Sel, 3 ) if ( getPlayerMoney( Cplayer ) < Pr ) then outputChatBox( '#FFFFFFError, You don\'t have enough money #FF0000!', 255, 255, 255, true ) return end triggerServerEvent( 'VehiclesSystem;buyCurrentCar', Cplayer, ID, vN, Pr ) elseif ( source == GUIEditor.button[1] ) then local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] ) if ( Sel == -1 ) then outputChatBox( '#FFFFFFError, Please select vehicle #FF0000!', 255, 255, 255, true ) return end local ID = guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) triggerServerEvent( 'VehiclesSystem;createPersonalVehicle', Cplayer, ID ) guiSetVisible( GUIEditor.window[1], false ) showCursor( false ) guiSetEnabled( GUIEditor.button[1], false ) setTimer( guiSetEnabled, 2000, 1, GUIEditor.button[1], true ) elseif ( source == GUIEditor.button[2] ) then triggerServerEvent( 'VehiclesSystem;destroyPersonalVehicle', Cplayer ) guiSetEnabled( GUIEditor.button[2], false ) setTimer( guiSetEnabled, 2000, 1, GUIEditor.button[2], true ) elseif ( source == GUIEditor.button[3] ) then triggerServerEvent( 'VehiclesSystem;lock/unlockPersonalVehicle', Cplayer ) guiSetEnabled( GUIEditor.button[3], false ) setTimer( guiSetEnabled, 2000, 1, GUIEditor.button[3], true ) elseif ( source == GUIEditor.button[4] ) then triggerServerEvent( 'VehiclesSystem;off/onPersonalVehicle', Cplayer ) guiSetEnabled( GUIEditor.button[4], false ) setTimer( guiSetEnabled, 2000, 1, GUIEditor.button[4], true ) elseif ( source == GUIEditor.button[5] ) then triggerServerEvent( 'VehiclesSystem;off/onLightsPersonalVehicle', Cplayer ) guiSetEnabled( GUIEditor.button[5], false ) setTimer( guiSetEnabled, 2000, 1, GUIEditor.button[5], true ) elseif ( source == GUIEditor.button[8] ) then local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] ) if ( Sel == -1 ) then outputChatBox( '#FFFFFFError, Please select vehicle #FF0000!', 255, 255, 255, true ) return end local ID = guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) triggerServerEvent( 'VehiclesSystem;sellMyPersonalVehicle', Cplayer, tonumber(ID), guiGridListGetItemData( GUIEditor.gridlist[1], Sel, 3 ) ) guiSetEnabled( GUIEditor.button[8], false ) setTimer( guiSetEnabled, 2000, 1, GUIEditor.button[8], true ) elseif ( source == GUIEditor.button[6] ) then fadeCamera( false ) setTimer( fadeCamera, 1500, 1, true ) setTimer( setElementPosition, 1500, 1, Cplayer, -1639.25244, 1203.28857, 8.22800 ) guiSetVisible( GUIEditor.window[1], false ) showCursor( false ) end end addEventHandler( 'onClientGUIClick', root, clickElements ) function refreshMyList( Table ) guiGridListClear( GUIEditor.gridlist[1] ) for i, _ in ipairs( Table ) do local Price, value = string.gsub( Table[i].vehPrice / 2, '^(-?%d+)(%d%d%d)', '%1,%2' ) local item = guiGridListAddRow( GUIEditor.gridlist[1] ) guiGridListSetItemText( GUIEditor.gridlist[1], item, 1, Table[i].vehID, false, false ) guiGridListSetItemText( GUIEditor.gridlist[1], item, 2, Table[i].vehName, false, false ) guiGridListSetItemText( GUIEditor.gridlist[1], item, 3, Price..'$', false, false ) guiGridListSetItemText( GUIEditor.gridlist[1], item, 4, Table[i].Subscription, false, false ) guiGridListSetItemData( GUIEditor.gridlist[1], item, 3, Table[i].vehPrice / 2 ) end end addEvent( 'VehiclesSystem;putMyVehicles', true ) addEventHandler( 'VehiclesSystem;putMyVehicles', root, refreshMyList ) addEvent( 'VehiclesSystem;gridListAddRent', true ) addEventHandler( 'VehiclesSystem;gridListAddRent', root, function( ID, veh ) rentRow = guiGridListAddRow( GUIEditor.gridlist[1] ) guiGridListSetItemText( GUIEditor.gridlist[1], rentRow, 1, ID, false, false ) guiGridListSetItemText( GUIEditor.gridlist[1], rentRow, 2, veh, false, false ) guiGridListSetItemText( GUIEditor.gridlist[1], rentRow, 3, '1,000$', false, false ) guiGridListSetItemText( GUIEditor.gridlist[1], rentRow, 4, '5 Minutes', false, false ) guiSetEnabled( buy_buyplace, false ) guiSetEnabled( rent_buyplace, false ) guiSetEnabled( list_buyplace, false ) setTimer( function( ) guiGridListRemoveRow( GUIEditor.gridlist[1], rentRow ) guiSetEnabled( buy_buyplace, true ) guiSetEnabled( rent_buyplace, true ) guiSetEnabled( list_buyplace, true ) end, 300000, 1 ) end ) addEvent( 'VehiclesSystem;hideBuyWindow', true ) addEventHandler( 'VehiclesSystem;hideBuyWindow', root, function( ) guiSetVisible( buyplace, false ) showCursor( false ) end ) addEvent( 'VehiclesSystem;emptyMyList', true ) addEventHandler( 'VehiclesSystem;emptyMyList', root, function( ) guiGridListClear( GUIEditor.gridlist[1] ) end ) addEventHandler( 'onClientResourceStart', resourceRoot, function( ) triggerServerEvent( 'refreshMyListS', Cplayer ) end ) addEventHandler( 'onClientMarkerHit', buyingMarker, function( hitElement ) if ( hitElement == Cplayer and getElementDimension( hitElement ) == 0 ) then local x, y, z = getElementPosition( Cplayer ) if ( z <= 7.25465 ) then guiGridListSetSelectedItem( list_buyplace, 0, 1 ) local Sel = guiGridListGetSelectedItem( list_buyplace ) if ( Sel == -1 ) then return end local Data = guiGridListGetItemData( list_buyplace, Sel, 1 ) local x1, y1, z1, x2, y2, z2 = unpack( Data ) fadeCamera( false ) setTimer( fadeCamera, 1500, 1, true ) setTimer( setCameraMatrix, 1500, 1, x1, y1, z1, x2, y2, z2 ) if ( isElement( viewvehicle ) ) then if ( getElementModel( viewvehicle ) ) == guiGridListGetItemData( list_buyplace, Sel, 2 ) then return end destroyElement( viewvehicle ) end triggerServerEvent( 'VehiclesSystem;createViewVehicle', Cplayer, guiGridListGetItemData( list_buyplace, Sel, 2 ), x2, y2, z2, 'view' ) setTimer( guiSetVisible, 1500, 1, buyplace, not guiGetVisible( buyplace ) ) setTimer( showCursor, 1500, 1, not isCursorShowing( ) ) end end end, false ) bindKey( Key, 'down', function( ) guiSetVisible( GUIEditor.window[1], not guiGetVisible( GUIEditor.window[1] ) ) showCursor( not isCursorShowing( ) ) end ) addEventHandler ("onClientGUIClick",root,function () if ( source == ar ) then guiSetText(GUIEditor.button[1],"انشاء السياره") guiSetText(GUIEditor.button[2],"سحب السياره") guiSetText(GUIEditor.button[3],"قفل/فتح السياره") guiSetText(GUIEditor.button[4],"تشغيل/ايقاف المحرك") guiSetText(GUIEditor.button[5],"تشغيل/ايقاف المصابيح") guiSetText(GUIEditor.button[6],"الانتقال للمعرض") guiSetText(GUIEditor.button[8],"بيع السياره") guiSetText(GUIEditor.checkbox[1],"الانتقال للسياره") end end ) addEventHandler ("onClientGUIClick",root,function () if ( source == eng ) then guiSetText(GUIEditor.button[1],"Create Vehicle") guiSetText(GUIEditor.button[2],"Destroy Vehicle") guiSetText(GUIEditor.button[3],"Lock/Unlock Vehicle") guiSetText(GUIEditor.button[4],"On/Off Engine") guiSetText(GUIEditor.button[5],"On/Off Lights") guiSetText(GUIEditor.button[6],"Warp To Buy Place") guiSetText(GUIEditor.button[8],"Sell Vehicle") guiSetText(GUIEditor.checkbox[1],"Warp To Vehicle") end end ) addEventHandler ("onClientGUIClick",root,function () if ( source == ara ) then guiSetText(buy_buyplace,"شراء السياره") guiSetText(rent_buyplace,"استئجار السياره") guiSetText(label_buyplace,"ملاحظة : تستطيع ايضاً استئجار سياره مدة \nالاستئجار : 5 دقائق / سعر الاستئجار : 10000 .") guiSetText(cvehhh,"التحكم بالسياره") end end ) addEventHandler ("onClientGUIClick",root,function () if ( source == enge ) then guiSetText(buy_buyplace,"Buy Vehicle") guiSetText(rent_buyplace,"Rent Vehicle") guiSetText(label_buyplace,"Note : You Can Also Rent Vehicle,\nRent Time : 5 Minutes, Price : 10,000$ .") guiSetText(cvehhh,"Vehicle Controls") end end ) --------------------- --controls panel-- GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Scrollbar = {} GUIEditor_Window[33] = guiCreateWindow(709,236,272,288,"Vehicle Control",false) LeftWindow(GUIEditor_Window[33]) GUIEditor_Scrollbar[1] = guiCreateScrollBar(24,49,225,17,true,false,GUIEditor_Window[33]) GUIEditor_Label[1] = guiCreateLabel(86,30,135,15,"Hood Open Ratio",false,GUIEditor_Window[33]) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(74,72,135,15,"First Door Open Ratio",false,GUIEditor_Window[33]) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Scrollbar[2] = guiCreateScrollBar(24,91,225,17,true,false,GUIEditor_Window[33]) GUIEditor_Label[3] = guiCreateLabel(68,112,135,15,"Second Door Open Ratio",false,GUIEditor_Window[33]) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Scrollbar[3] = guiCreateScrollBar(24,130,225,17,true,false,GUIEditor_Window[33]) GUIEditor_Label[4] = guiCreateLabel(71,151,135,15,"Third Door Open Ratio",false,GUIEditor_Window[33]) guiSetFont(GUIEditor_Label[4],"default-bold-small") GUIEditor_Scrollbar[4] = guiCreateScrollBar(24,168,225,17,true,false,GUIEditor_Window[33]) GUIEditor_Label[5] = guiCreateLabel(68,189,135,15,"Fourth Door Open Ratio",false,GUIEditor_Window[33]) guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Scrollbar[5] = guiCreateScrollBar(24,206,225,17,true,false,GUIEditor_Window[33]) GUIEditor_Label[6] = guiCreateLabel(83,226,135,15,"Trunk Open Ratio",false,GUIEditor_Window[33]) guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Scrollbar[6] = guiCreateScrollBar(24,243,225,17,true,false,GUIEditor_Window[33]) GUIEditor_Button[1] = guiCreateButton(23,265,230,14,"close window",false,GUIEditor_Window[33]) guiSetFont(GUIEditor_Button[1],"default-small") guiWindowSetSizable ( GUIEditor_Window[33], false ) setElementData(GUIEditor_Scrollbar[1], "Type", 0) setElementData(GUIEditor_Scrollbar[2], "Type", 2) setElementData(GUIEditor_Scrollbar[3], "Type", 3) setElementData(GUIEditor_Scrollbar[4], "Type", 4) setElementData(GUIEditor_Scrollbar[5], "Type", 5) setElementData(GUIEditor_Scrollbar[6], "Type", 1) guiSetVisible(GUIEditor_Window[33], false) ---------------------------------------------------- addEventHandler ("onClientGUIClick",root,function () if ( source == cveh ) then if guiGetVisible(GUIEditor_Window[33]) == false then guiSetVisible(GUIEditor_Window[33], true) else guiSetVisible(GUIEditor_Window[33], false) end end end ) function closeButton() guiSetVisible(GUIEditor_Window[33], false) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], closeButton, false ) function updateRatio(Scrolled) local position = guiScrollBarGetScrollPosition(Scrolled) local door = getElementData(Scrolled, "Type") triggerServerEvent("moveThis:~", getLocalPlayer(), door, position) end addEventHandler("onClientGUIScroll", getRootElement(), updateRatio) server side createBlip ( -1657.838, 1210.947, 6.5, 55, 2, 0, 0, 0, 255, 0, 99999.0, getRootElement( ) ) local vehDB = dbConnect( 'sqlite', 'Vehicles System - Database.db' ) dbExec( vehDB, ' CREATE TABLE IF NOT EXISTS `VehiclesSystem_Players` (pSerial, vehID, vehName, vehPrice, Subscription) ' ) --dbExec( vehDB, ' DROP TABLE `VehiclesSystem_Players` ' ) vehPers = { }; vehview = { }; function refreshMyList( ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players` ' ) local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then triggerClientEvent( root, 'VehiclesSystem;emptyMyList', root ) return end triggerClientEvent( root, 'VehiclesSystem;putMyVehicles', root, results ) end addEvent( 'refreshMyListS', true ) addEventHandler( 'refreshMyListS', root, refreshMyList ) function viewVehiclex( ID, x, y, z, state ) if ( state == 'close' ) then if ( isElement( vehview[source] ) ) then destroyElement( vehview[source] ) end elseif ( state == 'view' ) then if ( isElement( vehview[source] ) ) then if ( getElementModel( vehview[source] ) ) == ID then return end destroyElement( vehview[source] ) end vehview[source] = createVehicle( ID, x, y, z + 0.2, 0, 0, 10 ) setElementDimension( vehview[source], getElementData( root, 'vehiclesSystem;dimension' ) or 1 ) setElementDimension( source, getElementData( root, 'vehiclesSystem;dimension' ) or 1 ) setElementData( root, 'vehiclesSystem;dimension', getElementData( root, 'vehiclesSystem;dimension' ) + 1 or 1 ) end end addEvent( 'VehiclesSystem;createViewVehicle', true ) addEventHandler( 'VehiclesSystem;createViewVehicle', root, viewVehiclex ) addEvent( 'VehiclesSystem;destroyPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;destroyPersonalVehicle', root, function( ) if ( isElement( vehPers[source] ) ) then destroyElement( vehPers[source] ) end end ) addEvent( 'VehiclesSystem;createRentVehicle', true ) addEventHandler( 'VehiclesSystem;createRentVehicle', root, function( ID, vehName ) if ( isElement( vehPers[source] ) ) then destroyElement( vehPers[source] ) end vehPers[source] = createVehicle( ID, -1633.87439, 1208.09277, 7.03906 + 1, -0, 0, 224.5189666748 ) fadeCamera( source, false ) setTimer( fadeCamera, 1500, 1, source, true ) takePlayerMoney( source, 10000 ) setElementDimension( vehPers[source], 0 ) setElementDimension( source, 0 ) setTimer( warpPedIntoVehicle, 1500, 1, source, vehPers[source] ) setTimer( destroyElement, 300000, 1, vehPers[source] ) setTimer( function( ) outputChatBox( '#FFFFFFWarning, Your subscription has been ended #FF0000!', source, 255, 255, 255, true ) end, 300000, 1 ) triggerClientEvent( source, 'VehiclesSystem;gridListAddRent', source, ID, vehName ) end ) addEvent( 'VehiclesSystem;lock/unlockPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;lock/unlockPersonalVehicle', root, function( ) if ( not isElement( vehPers[source] ) ) then outputChatBox( '#FFFFFFError, You don\'t have vehicle #FF0000!', source, 255, 255, 255, true ) return end if ( isVehicleLocked( vehPers[source] ) == true ) then setVehicleLocked( vehPers[source], false ) outputChatBox( '#FFFFFFSuccess, Your vehicle has been unlocked #2BFF00!', source, 255, 255, 255, true ) else setVehicleLocked( vehPers[source], true ) outputChatBox( '#FFFFFFSuccess, Your vehicle has been locked #2BFF00!', source, 255, 255, 255, true ) end end ) addEvent( 'VehiclesSystem;off/onPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;off/onPersonalVehicle', root, function( ) if ( not isElement( vehPers[source] ) ) then outputChatBox( '#FFFFFFError, You don\'t have vehicle #FF0000!', source, 255, 255, 255, true ) return end if ( getVehicleEngineState( vehPers[source] ) == true ) then setVehicleEngineState( vehPers[source], false ) outputChatBox( '#FFFFFFSuccess, Your vehicle has been turned off #2BFF00!', source, 255, 255, 255, true ) else setVehicleEngineState( vehPers[source], true ) outputChatBox( '#FFFFFFSuccess, Your vehicle has been turned on #2BFF00!', source, 255, 255, 255, true ) end end ) addEvent( 'VehiclesSystem;off/onLightsPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;off/onLightsPersonalVehicle', root, function( ) if ( not isElement( vehPers[source] ) ) then outputChatBox( '#FFFFFFError, You don\'t have vehicle #FF0000!', source, 255, 255, 255, true ) return end if ( getVehicleLightState( vehPers[source], 0 ) == 0 and getVehicleLightState( vehPers[source], 1 ) == 0 ) then setVehicleLightState( vehPers[source], 0, 1 ) setVehicleLightState( vehPers[source], 1, 1 ) setVehicleLightState( vehPers[source], 2, 1 ) setVehicleLightState( vehPers[source], 3, 1 ) outputChatBox( '#2BFF00*#FFFF00 Vehicles System #2BFF00 : #FFFFFFSuccess, Your vehicle lights turned off #2BFF00!', source, 255, 255, 255, true ) else setVehicleLightState( vehPers[source], 0, 0 ) setVehicleLightState( vehPers[source], 1, 0 ) setVehicleLightState( vehPers[source], 2, 0 ) setVehicleLightState( vehPers[source], 3, 0 ) outputChatBox( '#2BFF00*#FFFF00 Vehicles System #2BFF00 : #FFFFFFSuccess, Your vehicle lights turned on #2BFF00!', source, 255, 255, 255, true ) end end ) addEvent( 'VehiclesSystem;sellMyPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;sellMyPersonalVehicle', root, function( ID, price ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players` WHERE pSerial = ? AND vehID = ? ', getPlayerSerial( source ), ID ) local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then outputChatBox( '#FFFFFFError, This vehicle is not permanently for you, You cannot sell it #FF0000!', source, 255, 255, 255, true ) return end if ( isElement( vehPers[source] ) ) then destroyElement( vehPers[source] ) end dbExec( vehDB, ' DELETE FROM `VehiclesSystem_Players` WHERE pSerial = ? AND vehID = ? ', getPlayerSerial( source ), ID ) refreshMyList( ) givePlayerMoney( source, price ) outputChatBox( '#FFFFFFSuccess, Your vehicle has been sold successfully #2BFF00!', source, 255, 255, 255, true ) end ) addEvent( 'VehiclesSystem;createPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;createPersonalVehicle', root, function( ID ) local x, y, z = getElementPosition( source ) if ( isElement( vehPers[source] ) ) then destroyElement( vehPers[source] ) end vehPers[source] = createVehicle( ID, x + 2, y + 2, z + 1 ) if ( getElementData( source, 'VehiclesSystem;WarpToVehicle' ) == 'Enabled' ) then warpPedIntoVehicle( source, vehPers[source] ) setElementData( vehPers[source], 'myPersVehicle', getPlayerName( source ) ) end end ) addEvent( 'VehiclesSystem;buyCurrentCar', true ) addEventHandler( 'VehiclesSystem;buyCurrentCar', root, function( ID, Name, Price ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players` WHERE pSerial = ? AND vehID = ? ', getPlayerSerial( source ), ID ) local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then dbExec( vehDB, ' INSERT INTO `VehiclesSystem_Players` VALUES(?,?,?,?,?) ', getPlayerSerial( source ), tonumber(ID), Name, Price, 'Permanent Subscription' ) vehPers[source] = createVehicle( ID, -1633.87439, 1208.09277, 7.03906 + 1, -0, 0, 224.5189666748 ) warpPedIntoVehicle( source, vehPers[source] ) takePlayerMoney( source, Price ) setTimer(setCameraTarget, 1500, 1, source ) setElementDimension( vehPers[source], 0 ) setElementDimension( source, 0 ) fadeCamera( source, false ) setTimer( fadeCamera, 1500, 1, source, true ) triggerClientEvent( source, 'VehiclesSystem;hideBuyWindow', source ) viewVehiclex( nil, nil, nil, nil, 'close' ) refreshMyList( ) else outputChatBox( '#FFFFFFError, This vehicle is already exists in your list #FF0000!', source, 255, 255, 255, true ) return end end ) ------------------------ --vehicle controls serverside-- function openDoor(door, position) local vehicle = getPedOccupiedVehicle(source) if getPedOccupiedVehicleSeat(source) == 0 then if door == 0 then if position==0 then setVehicleDoorOpenRatio(vehicle, 0, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 0, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 0, position/100, 0.5) end end if door == 1 then if position==0 then setVehicleDoorOpenRatio(vehicle, 1, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 1, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 1, position/100, 0.5) end end if door == 2 then if position==0 then setVehicleDoorOpenRatio(vehicle, 2, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 2, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 2, position/100, 0.5) end end if door == 3 then if position==0 then setVehicleDoorOpenRatio(vehicle, 3, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 3, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 3, position/100, 0.5) end end if door == 4 then if position==0 then setVehicleDoorOpenRatio(vehicle, 4, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 4, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 4, position/100, 0.5) end end if door == 5 then if position==0 then setVehicleDoorOpenRatio(vehicle, 5, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 5, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 5, position/100, 0.5) end end end end addEvent("moveThis:~", true) addEventHandler("moveThis:~", getRootElement(), openDoor) Link to comment
' A F . Posted May 27, 2017 Share Posted May 27, 2017 createBlip ( -1657.838, 1210.947, 6.5, 55, 2, 0, 0, 0, 255, 0, 99999.0, getRootElement( ) ) local vehDB = dbConnect( 'sqlite', 'Vehicles System - Database.db' ) dbExec( vehDB, ' CREATE TABLE IF NOT EXISTS `VehiclesSystem_Players` (pSerial, vehID, vehName, vehPrice, Subscription) ' ) --dbExec( vehDB, ' DROP TABLE `VehiclesSystem_Players` ' ) vehPers = { }; vehview = { }; function refreshMyList( ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players` WHERE pSerial=?',tostring(getPlayerSerial(source)) ); local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then triggerClientEvent( root, 'VehiclesSystem;emptyMyList', root ) return end triggerClientEvent( root, 'VehiclesSystem;putMyVehicles', root, results ) end addEvent( 'refreshMyListS', true ) addEventHandler( 'refreshMyListS', root, refreshMyList ) function viewVehiclex( ID, x, y, z, state ) if ( state == 'close' ) then if ( isElement( vehview[source] ) ) then destroyElement( vehview[source] ) end elseif ( state == 'view' ) then if ( isElement( vehview[source] ) ) then if ( getElementModel( vehview[source] ) ) == ID then return end destroyElement( vehview[source] ) end vehview[source] = createVehicle( ID, x, y, z + 0.2, 0, 0, 10 ) setElementDimension( vehview[source], getElementData( root, 'vehiclesSystem;dimension' ) or 1 ) setElementDimension( source, getElementData( root, 'vehiclesSystem;dimension' ) or 1 ) setElementData( root, 'vehiclesSystem;dimension', getElementData( root, 'vehiclesSystem;dimension' ) + 1 or 1 ) end end addEvent( 'VehiclesSystem;createViewVehicle', true ) addEventHandler( 'VehiclesSystem;createViewVehicle', root, viewVehiclex ) addEvent( 'VehiclesSystem;destroyPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;destroyPersonalVehicle', root, function( ) if ( isElement( vehPers[source] ) ) then destroyElement( vehPers[source] ) end end ) addEvent( 'VehiclesSystem;createRentVehicle', true ) addEventHandler( 'VehiclesSystem;createRentVehicle', root, function( ID, vehName ) if ( isElement( vehPers[source] ) ) then destroyElement( vehPers[source] ) end vehPers[source] = createVehicle( ID, -1633.87439, 1208.09277, 7.03906 + 1, -0, 0, 224.5189666748 ) fadeCamera( source, false ) setTimer( fadeCamera, 1500, 1, source, true ) takePlayerMoney( source, 10000 ) setElementDimension( vehPers[source], 0 ) setElementDimension( source, 0 ) setTimer( warpPedIntoVehicle, 1500, 1, source, vehPers[source] ) setTimer( destroyElement, 300000, 1, vehPers[source] ) setTimer( function( ) outputChatBox( '#FFFFFFWarning, Your subscription has been ended #FF0000!', source, 255, 255, 255, true ) end, 300000, 1 ) triggerClientEvent( source, 'VehiclesSystem;gridListAddRent', source, ID, vehName ) end ) addEvent( 'VehiclesSystem;lock/unlockPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;lock/unlockPersonalVehicle', root, function( ) if ( not isElement( vehPers[source] ) ) then outputChatBox( '#FFFFFFError, You don\'t have vehicle #FF0000!', source, 255, 255, 255, true ) return end if ( isVehicleLocked( vehPers[source] ) == true ) then setVehicleLocked( vehPers[source], false ) outputChatBox( '#FFFFFFSuccess, Your vehicle has been unlocked #2BFF00!', source, 255, 255, 255, true ) else setVehicleLocked( vehPers[source], true ) outputChatBox( '#FFFFFFSuccess, Your vehicle has been locked #2BFF00!', source, 255, 255, 255, true ) end end ) addEvent( 'VehiclesSystem;off/onPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;off/onPersonalVehicle', root, function( ) if ( not isElement( vehPers[source] ) ) then outputChatBox( '#FFFFFFError, You don\'t have vehicle #FF0000!', source, 255, 255, 255, true ) return end if ( getVehicleEngineState( vehPers[source] ) == true ) then setVehicleEngineState( vehPers[source], false ) outputChatBox( '#FFFFFFSuccess, Your vehicle has been turned off #2BFF00!', source, 255, 255, 255, true ) else setVehicleEngineState( vehPers[source], true ) outputChatBox( '#FFFFFFSuccess, Your vehicle has been turned on #2BFF00!', source, 255, 255, 255, true ) end end ) addEvent( 'VehiclesSystem;off/onLightsPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;off/onLightsPersonalVehicle', root, function( ) if ( not isElement( vehPers[source] ) ) then outputChatBox( '#FFFFFFError, You don\'t have vehicle #FF0000!', source, 255, 255, 255, true ) return end if ( getVehicleLightState( vehPers[source], 0 ) == 0 and getVehicleLightState( vehPers[source], 1 ) == 0 ) then setVehicleLightState( vehPers[source], 0, 1 ) setVehicleLightState( vehPers[source], 1, 1 ) setVehicleLightState( vehPers[source], 2, 1 ) setVehicleLightState( vehPers[source], 3, 1 ) outputChatBox( '#2BFF00*#FFFF00 Vehicles System #2BFF00 : #FFFFFFSuccess, Your vehicle lights turned off #2BFF00!', source, 255, 255, 255, true ) else setVehicleLightState( vehPers[source], 0, 0 ) setVehicleLightState( vehPers[source], 1, 0 ) setVehicleLightState( vehPers[source], 2, 0 ) setVehicleLightState( vehPers[source], 3, 0 ) outputChatBox( '#2BFF00*#FFFF00 Vehicles System #2BFF00 : #FFFFFFSuccess, Your vehicle lights turned on #2BFF00!', source, 255, 255, 255, true ) end end ) addEvent( 'VehiclesSystem;sellMyPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;sellMyPersonalVehicle', root, function( ID, price ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players` WHERE pSerial = ? AND vehID = ? ', getPlayerSerial( source ), ID ) local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then outputChatBox( '#FFFFFFError, This vehicle is not permanently for you, You cannot sell it #FF0000!', source, 255, 255, 255, true ) return end if ( isElement( vehPers[source] ) ) then destroyElement( vehPers[source] ) end dbExec( vehDB, ' DELETE FROM `VehiclesSystem_Players` WHERE pSerial = ? AND vehID = ? ', getPlayerSerial( source ), ID ) refreshMyList( ) givePlayerMoney( source, price ) outputChatBox( '#FFFFFFSuccess, Your vehicle has been sold successfully #2BFF00!', source, 255, 255, 255, true ) end ) addEvent( 'VehiclesSystem;createPersonalVehicle', true ) addEventHandler( 'VehiclesSystem;createPersonalVehicle', root, function( ID ) local x, y, z = getElementPosition( source ) if ( isElement( vehPers[source] ) ) then destroyElement( vehPers[source] ) end vehPers[source] = createVehicle( ID, x + 2, y + 2, z + 1 ) if ( getElementData( source, 'VehiclesSystem;WarpToVehicle' ) == 'Enabled' ) then warpPedIntoVehicle( source, vehPers[source] ) setElementData( vehPers[source], 'myPersVehicle', getPlayerName( source ) ) end end ) addEvent( 'VehiclesSystem;buyCurrentCar', true ) addEventHandler( 'VehiclesSystem;buyCurrentCar', root, function( ID, Name, Price ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players` WHERE pSerial = ? AND vehID = ? ', getPlayerSerial( source ), ID ) local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then dbExec( vehDB, ' INSERT INTO `VehiclesSystem_Players` VALUES(?,?,?,?,?) ', getPlayerSerial( source ), tonumber(ID), Name, Price, 'Permanent Subscription' ) vehPers[source] = createVehicle( ID, -1633.87439, 1208.09277, 7.03906 + 1, -0, 0, 224.5189666748 ) warpPedIntoVehicle( source, vehPers[source] ) takePlayerMoney( source, Price ) setTimer(setCameraTarget, 1500, 1, source ) setElementDimension( vehPers[source], 0 ) setElementDimension( source, 0 ) fadeCamera( source, false ) setTimer( fadeCamera, 1500, 1, source, true ) triggerClientEvent( source, 'VehiclesSystem;hideBuyWindow', source ) viewVehiclex( nil, nil, nil, nil, 'close' ) refreshMyList( ) else outputChatBox( '#FFFFFFError, This vehicle is already exists in your list #FF0000!', source, 255, 255, 255, true ) return end end ) ------------------------ --vehicle controls serverside-- function openDoor(door, position) local vehicle = getPedOccupiedVehicle(source) if getPedOccupiedVehicleSeat(source) == 0 then if door == 0 then if position==0 then setVehicleDoorOpenRatio(vehicle, 0, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 0, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 0, position/100, 0.5) end end if door == 1 then if position==0 then setVehicleDoorOpenRatio(vehicle, 1, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 1, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 1, position/100, 0.5) end end if door == 2 then if position==0 then setVehicleDoorOpenRatio(vehicle, 2, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 2, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 2, position/100, 0.5) end end if door == 3 then if position==0 then setVehicleDoorOpenRatio(vehicle, 3, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 3, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 3, position/100, 0.5) end end if door == 4 then if position==0 then setVehicleDoorOpenRatio(vehicle, 4, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 4, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 4, position/100, 0.5) end end if door == 5 then if position==0 then setVehicleDoorOpenRatio(vehicle, 5, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 5, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 5, position/100, 0.5) end end end end addEvent("moveThis:~", true) addEventHandler("moveThis:~", getRootElement(), openDoor) Server side 1 Link to comment
K̷i̷n̷g̷ x̷D̷ツ Posted May 27, 2017 Author Share Posted May 27, 2017 (edited) نفس الشي @Master_MTA يالاخو ممكن تساعدني هنا @#Soking @Default Edited May 27, 2017 by K̷i̷n̷g̷ x̷D̷ツ Link to comment
Master_MTA Posted May 27, 2017 Share Posted May 27, 2017 شف يقلبي انا بعطيك مثال وطبقه على اكوادك لان اكوادك واجد addEvent('refreshh',true) addEventHandler('refreshh',root,function() local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players`' ); local results = dbPoll( check, -1 ) if #result~=0 then triggerClientEvent(source,'mygrid',source,getPlayerSerial(source)) end end) --------client bindKey('f3','down',function()-----------التراقر بامر فتح اللوحه حقة السيارات triggerServerEvent('refreshh',localPlayer) end) addEvent('mygrid',true) addEventHandler('mygrid',root,function(res,serial) for k,v in ipairs(res)do if serial==res[k].pSerial then guiGridListSetIteamText(grid,row,1,res[k].اللي تبي,false,false)-------بدله بالبيانات اللي تبي end end end) بالتوفيق يا غالي 2 hours ago, K̷i̷n̷g̷ x̷D̷ツ said: نفس الشي @Master_MTA يالاخو ممكن تساعدني هنا @#Soking @Default Link to comment
K̷i̷n̷g̷ x̷D̷ツ Posted May 27, 2017 Author Share Posted May 27, 2017 2 hours ago, Master_MTA said: شف يقلبي انا بعطيك مثال وطبقه على اكوادك لان اكوادك واجد addEvent('refreshh',true)addEventHandler('refreshh',root,function()local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players`' ); local results = dbPoll( check, -1 ) if #result~=0 then triggerClientEvent(source,'mygrid',source,getPlayerSerial(source)) end end)--------clientbindKey('f3','down',function()-----------التراقر بامر فتح اللوحه حقة السيارات triggerServerEvent('refreshh',localPlayer) end)addEvent('mygrid',true)addEventHandler('mygrid',root,function(res,serial) for k,v in ipairs(res)do if serial==res[k].pSerial then guiGridListSetIteamText(grid,row,1,res[k].اللي تبي,false,false)-------بدله بالبيانات اللي تبي end end end) بالتوفيق يا غالي ترا تمام سويته تلخبطت بدال ما احط التعريف source حطيته الكل روت Link to comment
Master_MTA Posted May 27, 2017 Share Posted May 27, 2017 6 minutes ago, K̷i̷n̷g̷ x̷D̷ツ said: ترا تمام سويته تلخبطت بدال ما احط التعريف source حطيته الكل روت اهم شي زبط؟ Link to comment
K̷i̷n̷g̷ x̷D̷ツ Posted May 27, 2017 Author Share Posted May 27, 2017 (edited) 2 hours ago, Master_MTA said: اهم شي زبط؟ يب تمام انا ما كنت منتبه شكراً على كل حال احياناً كلمه بسيطه ممكن تخرب كل المود 2 hours ago, Master_MTA said: اهم شي زبط؟ بعده مو تمام نفس المشكله ساعدني @Master_MTA @#Soking @Default Edited May 27, 2017 by K̷i̷n̷g̷ x̷D̷ツ Link to comment
' A F . Posted May 27, 2017 Share Posted May 27, 2017 قبل كم يوم ساعدت واحد بنفس طلبك ابحث وتلاقية اسم الي طلب w7sH دور بالمواضيع حقته 1 Link to comment
K̷i̷n̷g̷ x̷D̷ツ Posted May 27, 2017 Author Share Posted May 27, 2017 (edited) function refreshMyList( ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players2` WHERE pSerial=?',tostring(getPlayerSerial(source)) ); local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then triggerClientEvent( source, 'VehiclesSystem;emptyMyList', source ) return end triggerClientEvent( source, 'VehiclesSystem;putMyVehicles', source, results ) end addEvent( 'refreshMyListS', true ) addEventHandler( 'refreshMyListS', root, refreshMyList ) 1 hour ago, Default said: قبل كم يوم ساعدت واحد بنفس طلبك ابحث وتلاقية اسم الي طلب w7sH دور بالمواضيع حقته تراني مسوي نفس الشي ومو زابط فيه مشكله السيارات ما تبين في اف3 @Default #Edit: 1 hour ago, K̷i̷n̷g̷ x̷D̷ツ said: function refreshMyList( ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players2` WHERE pSerial=?',tostring(getPlayerSerial(source)) ); local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then triggerClientEvent( source, 'VehiclesSystem;emptyMyList', source ) return end triggerClientEvent( source, 'VehiclesSystem;putMyVehicles', source, results )endaddEvent( 'refreshMyListS', true ) addEventHandler( 'refreshMyListS', root, refreshMyList ) تراني مسوي نفس الشي ومو زابط فيه مشكله السيارات ما تبين في اف3 @Default اسف كنت غلطان بشي بسيط كتبت رقم 2 بالغلط مو مهم الكود ذا تمام وزبط function refreshMyList( ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players` WHERE pSerial=?',tostring(getPlayerSerial(source)) ); local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then triggerClientEvent( source, 'VehiclesSystem;emptyMyList', source ) return end triggerClientEvent( source, 'VehiclesSystem;putMyVehicles', source, results ) end addEvent( 'refreshMyListS', true ) addEventHandler( 'refreshMyListS', root, refreshMyList ) Edited May 27, 2017 by K̷i̷n̷g̷ x̷D̷ツ Link to comment
w7sH Posted May 28, 2017 Share Posted May 28, 2017 23 hours ago, K̷i̷n̷g̷ x̷D̷ツ said: function refreshMyList( ) local check = dbQuery( vehDB, ' SELECT * FROM `VehiclesSystem_Players2` WHERE pSerial=?',tostring(getPlayerSerial(source)) ); local results = dbPoll( check, -1 ) if ( type( results ) == 'table' and #results == 0 or not results ) then triggerClientEvent( source, 'VehiclesSystem;emptyMyList', source ) return end triggerClientEvent( source, 'VehiclesSystem;putMyVehicles', source, results )endaddEvent( 'refreshMyListS', true ) addEventHandler( 'refreshMyListS', root, refreshMyList ) ضبط هذا الكود ولا باقي؟ Link to comment
K̷i̷n̷g̷ x̷D̷ツ Posted May 29, 2017 Author Share Posted May 29, 2017 21 hours ago, w7sH said: ضبط هذا الكود ولا باقي؟ ضبط تمام 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