Mr.Hugin Posted August 31, 2020 Share Posted August 31, 2020 (edited) السلام عليكم شباب عندي مشكلة طبعن بمود بدي يشتغل دي اكس مع ازرار دي اكس ولكن مو راضيه تضبط هو المود عباره عن تحكم بالمركبة وهاذي الكودات ------------------------------------------------- local screenW, screenH = guiGetScreenSize() bool = false ------------------------------------------------- function F3() if bool == true then dxDrawLine((screenW * 0.2533) - 1, (screenH * 0.2305) - 1, (screenW * 0.2533) - 1, screenH * 0.7578, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7716, (screenH * 0.2305) - 1, (screenW * 0.2533) - 1, (screenH * 0.2305) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.2533) - 1, screenH * 0.7578, screenW * 0.7716, screenH * 0.7578, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7716, screenH * 0.7578, screenW * 0.7716, (screenH * 0.2305) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.2533, screenH * 0.2305, screenW * 0.5183, screenH * 0.5273, tocolor(0, 0, 0, 182), false) dxDrawLine((screenW * 0.2540) - 1, (screenH * 0.1849) - 1, (screenW * 0.2540) - 1, screenH * 0.2174, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7716, (screenH * 0.1849) - 1, (screenW * 0.2540) - 1, (screenH * 0.1849) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.2540) - 1, screenH * 0.2174, screenW * 0.7716, screenH * 0.2174, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7716, screenH * 0.2174, screenW * 0.7716, (screenH * 0.1849) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.2540, screenH * 0.1849, screenW * 0.5176, screenH * 0.0326, tocolor(0, 0, 0, 182), false) dxDrawText(" 亗 『 Control the Vehicle 』 亗", screenW * 0.1501, screenH * 0.1823, screenW * 0.7716, screenH * 0.2174, tocolor(9, 242, 168, 255), 1.50, "default-bold", "center", "center", false, false, false, false, false) dxDrawLine((screenW * 0.4707) - 1, (screenH * 0.2435) - 1, (screenW * 0.4707) - 1, screenH * 0.2839, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.5564, (screenH * 0.2435) - 1, (screenW * 0.4707) - 1, (screenH * 0.2435) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.4707) - 1, screenH * 0.2839, screenW * 0.5564, screenH * 0.2839, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.5564, screenH * 0.2839, screenW * 0.5564, (screenH * 0.2435) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.4707, screenH * 0.2435, screenW * 0.0857, screenH * 0.0404, tocolor(0, 0, 0, 158), false) dxDrawLine((screenW * 0.5747) - 1, (screenH * 0.2435) - 1, (screenW * 0.5747) - 1, screenH * 0.2839, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.6603, (screenH * 0.2435) - 1, (screenW * 0.5747) - 1, (screenH * 0.2435) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.5747) - 1, screenH * 0.2839, screenW * 0.6603, screenH * 0.2839, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.6603, screenH * 0.2839, screenW * 0.6603, (screenH * 0.2435) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.5747, screenH * 0.2435, screenW * 0.0857, screenH * 0.0404, tocolor(0, 0, 0, 158), false) dxDrawLine((screenW * 0.6786) - 1, (screenH * 0.2435) - 1, (screenW * 0.6786) - 1, screenH * 0.2839, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7643, (screenH * 0.2435) - 1, (screenW * 0.6786) - 1, (screenH * 0.2435) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.6786) - 1, screenH * 0.2839, screenW * 0.7643, screenH * 0.2839, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7643, screenH * 0.2839, screenW * 0.7643, (screenH * 0.2435) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.6786, screenH * 0.2435, screenW * 0.0857, screenH * 0.0404, tocolor(0, 0, 0, 158), false) dxDrawLine((screenW * 0.4707) - 1, (screenH * 0.3216) - 1, (screenW * 0.4707) - 1, screenH * 0.3620, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.5564, (screenH * 0.3216) - 1, (screenW * 0.4707) - 1, (screenH * 0.3216) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.4707) - 1, screenH * 0.3620, screenW * 0.5564, screenH * 0.3620, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.5564, screenH * 0.3620, screenW * 0.5564, (screenH * 0.3216) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.4707, screenH * 0.3216, screenW * 0.0857, screenH * 0.0404, tocolor(0, 0, 0, 158), false) dxDrawLine((screenW * 0.5747) - 1, (screenH * 0.3216) - 1, (screenW * 0.5747) - 1, screenH * 0.3620, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.6603, (screenH * 0.3216) - 1, (screenW * 0.5747) - 1, (screenH * 0.3216) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.5747) - 1, screenH * 0.3620, screenW * 0.6603, screenH * 0.3620, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.6603, screenH * 0.3620, screenW * 0.6603, (screenH * 0.3216) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.5747, screenH * 0.3216, screenW * 0.0857, screenH * 0.0404, tocolor(0, 0, 0, 158), false) dxDrawLine((screenW * 0.6786) - 1, (screenH * 0.3216) - 1, (screenW * 0.6786) - 1, screenH * 0.3620, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7643, (screenH * 0.3216) - 1, (screenW * 0.6786) - 1, (screenH * 0.3216) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.6786) - 1, screenH * 0.3620, screenW * 0.7643, screenH * 0.3620, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7643, screenH * 0.3620, screenW * 0.7643, (screenH * 0.3216) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.6786, screenH * 0.3216, screenW * 0.0857, screenH * 0.0404, tocolor(0, 0, 0, 158), false) dxDrawLine((screenW * 0.4707) - 1, (screenH * 0.4023) - 1, (screenW * 0.4707) - 1, screenH * 0.4427, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.5564, (screenH * 0.4023) - 1, (screenW * 0.4707) - 1, (screenH * 0.4023) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.4707) - 1, screenH * 0.4427, screenW * 0.5564, screenH * 0.4427, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.5564, screenH * 0.4427, screenW * 0.5564, (screenH * 0.4023) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.4707, screenH * 0.4023, screenW * 0.0857, screenH * 0.0404, tocolor(0, 0, 0, 158), false) dxDrawLine((screenW * 0.5747) - 1, (screenH * 0.4023) - 1, (screenW * 0.5747) - 1, screenH * 0.4427, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.6603, (screenH * 0.4023) - 1, (screenW * 0.5747) - 1, (screenH * 0.4023) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.5747) - 1, screenH * 0.4427, screenW * 0.6603, screenH * 0.4427, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.6603, screenH * 0.4427, screenW * 0.6603, (screenH * 0.4023) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.5747, screenH * 0.4023, screenW * 0.0857, screenH * 0.0404, tocolor(0, 0, 0, 158), false) dxDrawLine((screenW * 0.6786) - 1, (screenH * 0.4023) - 1, (screenW * 0.6786) - 1, screenH * 0.4427, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7643, (screenH * 0.4023) - 1, (screenW * 0.6786) - 1, (screenH * 0.4023) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.6786) - 1, screenH * 0.4427, screenW * 0.7643, screenH * 0.4427, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7643, screenH * 0.4427, screenW * 0.7643, (screenH * 0.4023) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.6786, screenH * 0.4023, screenW * 0.0857, screenH * 0.0404, tocolor(0, 0, 0, 158), false) dxDrawLine((screenW * 0.4707) - 1, (screenH * 0.4831) - 1, (screenW * 0.4707) - 1, screenH * 0.5234, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.5564, (screenH * 0.4831) - 1, (screenW * 0.4707) - 1, (screenH * 0.4831) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.4707) - 1, screenH * 0.5234, screenW * 0.5564, screenH * 0.5234, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.5564, screenH * 0.5234, screenW * 0.5564, (screenH * 0.4831) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.4707, screenH * 0.4831, screenW * 0.0857, screenH * 0.0404, tocolor(0, 0, 0, 158), false) dxDrawLine((screenW * 0.5747) - 1, (screenH * 0.4831) - 1, (screenW * 0.5747) - 1, screenH * 0.5234, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.6603, (screenH * 0.4831) - 1, (screenW * 0.5747) - 1, (screenH * 0.4831) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.5747) - 1, screenH * 0.5234, screenW * 0.6603, screenH * 0.5234, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.6603, screenH * 0.5234, screenW * 0.6603, (screenH * 0.4831) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.5747, screenH * 0.4831, screenW * 0.0857, screenH * 0.0404, tocolor(0, 0, 0, 158), false) dxDrawLine((screenW * 0.6786) - 1, (screenH * 0.4831) - 1, (screenW * 0.6786) - 1, screenH * 0.5234, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7643, (screenH * 0.4831) - 1, (screenW * 0.6786) - 1, (screenH * 0.4831) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.6786) - 1, screenH * 0.5234, screenW * 0.7643, screenH * 0.5234, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7643, screenH * 0.5234, screenW * 0.7643, (screenH * 0.4831) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.6786, screenH * 0.4831, screenW * 0.0857, screenH * 0.0404, tocolor(0, 0, 0, 158), false) dxDrawLine((screenW * 0.4707) - 1, (screenH * 0.5547) - 1, (screenW * 0.4707) - 1, screenH * 0.5859, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7643, (screenH * 0.5547) - 1, (screenW * 0.4707) - 1, (screenH * 0.5547) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawLine((screenW * 0.4707) - 1, screenH * 0.5859, screenW * 0.7643, screenH * 0.5859, tocolor(9, 242, 168, 255), 1, false) dxDrawLine(screenW * 0.7643, screenH * 0.5859, screenW * 0.7643, (screenH * 0.5547) - 1, tocolor(9, 242, 168, 255), 1, false) dxDrawRectangle(screenW * 0.4707, screenH * 0.5547, screenW * 0.2936, screenH * 0.0313, tocolor(0, 0, 0, 158), false) dxDrawLine(screenW * 0.4561, screenH * 0.5417, screenW * 0.7709, screenH * 0.5417, tocolor(9, 242, 168, 255), 1, false) dxDrawText("x[ اظهار المركبة ]x", screenW * 0.4685, screenH * 0.2409, screenW * 0.5564, screenH * 0.2839, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("x[ اخفاء المركبة ]x", screenW * 0.5739, screenH * 0.2409, screenW * 0.6618, screenH * 0.2839, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("x[ اقفال المركبة ]x", screenW * 0.6772, screenH * 0.2409, screenW * 0.7650, screenH * 0.2839, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("x[ اصلاح المركبة ]x", screenW * 0.4685, screenH * 0.3203, screenW * 0.5564, screenH * 0.3633, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("x[ احضار المركبة ]x", screenW * 0.5725, screenH * 0.3203, screenW * 0.6603, screenH * 0.3633, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("x[ الذهاب الى المركبة ]x", screenW * 0.6779, screenH * 0.3203, screenW * 0.7657, screenH * 0.3633, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("x[ مراقبة المركبة ]x", screenW * 0.4693, screenH * 0.3997, screenW * 0.5571, screenH * 0.4427, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("x[ تعديل اسم المركبة ]x", screenW * 0.5747, screenH * 0.3997, screenW * 0.6625, screenH * 0.4427, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("x[ الوان عشوائيه للمركبة ]x", screenW * 0.6772, screenH * 0.3997, screenW * 0.7650, screenH * 0.4427, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("x[ اضافة سهم ]x", screenW * 0.4707, screenH * 0.4831, screenW * 0.5586, screenH * 0.5260, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("x[ دخان المركبة ]x", screenW * 0.5725, screenH * 0.4831, screenW * 0.6603, screenH * 0.5260, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("x[ الذهاب الى المعرض ]x", screenW * 0.6772, screenH * 0.4831, screenW * 0.7650, screenH * 0.5260, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("Xx[ بــــــــيــــــــع الــــــــــمـــــــركــــــــبــــــــة ]xX", screenW * 0.4693, screenH * 0.5534, screenW * 0.7650, screenH * 0.5859, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) dxDrawLine(screenW * 0.4561, screenH * 0.5990, screenW * 0.7709, screenH * 0.5990, tocolor(9, 242, 168, 255), 1, false) dxDrawText("ســـــيـــرفـــر بــــاتـــل فــــيـــلـــد لـــلـــحـــرب وزومــــــــبــــي", screenW * 0.4641, screenH * 0.6289, screenW * 0.7635, screenH * 0.7005, tocolor(254, 11, 11, 254), 1.30, "default", "center", "center", false, false, false, false, false) dxDrawLine(screenW * 0.4561, screenH * 0.2409, screenW * 0.4561, screenH * 0.7448, tocolor(9, 242, 168, 255), 1, true) dxDrawLine(screenW * 0.2613, screenH * 0.2409, screenW * 0.4561, screenH * 0.2409, tocolor(9, 242, 168, 255), 1, true) dxDrawLine(screenW * 0.2613, screenH * 0.7448, screenW * 0.4561, screenH * 0.7448, tocolor(9, 242, 168, 255), 1, true) dxDrawLine(screenW * 0.2606, screenH * 0.2409, screenW * 0.2606, screenH * 0.7448, tocolor(9, 242, 168, 255), 1, true) end end ------------------------------------------------- local marker = createMarker ( -1634.33997,1212.87451,7.03906, "arrow",2,0,200,0,50) --- WINDOWS local screenW, screenH = guiGetScreenSize() Window2 = guiCreateWindow(10, (screenH - 460) / 2, 260, 460, "[ معرض المركبات ]", false) guiWindowSetSizable(Window2,false) Carss = guiCreateGridList(9, 24, 241, 364, false, Window2) guiGridListAddColumn ( Carss, "#", 0.15 ) guiGridListAddColumn ( Carss, "الرقم :", 0.15 ) guiGridListAddColumn ( Carss, "المركبة :", 0.3 ) guiGridListAddColumn ( Carss, "السعر :", 0.3 ) guiSetFont(Carss, "default-bold-small") for i, v in ipairs ( Car ) do local row = guiGridListAddRow ( Carss ) guiGridListSetItemText ( Carss, row, 1, i, false, false ) guiGridListSetItemText ( Carss, row, 2, v[1], false, false ) guiGridListSetItemText ( Carss, row, 3, getVehicleNameFromModel ( v[1] ), false, false ) guiGridListSetItemText ( Carss, row, 4, v[2], false, false ) end Button16 = guiCreateButton(9, 395, 115, 29, "شراء المركبة", false, Window2) guiSetFont(Button16, "default-bold-small") guiSetProperty(Button16, "NormalTextColour", "C8FFFFFF") Button15 = guiCreateButton(135, 395, 115, 29, "عرض المركبة", false, Window2) guiSetFont(Button15, "default-bold-small") guiSetProperty(Button15, "NormalTextColour", "C8FFFFFF") X = guiCreateButton(14, 428, 221, 22, "X", false, Window2) guiSetFont(X, "default-bold-small") guiSetProperty(X, "NormalTextColour", "FFFF0000") Window3 = guiCreateWindow((screenW - 311) / 2, (screenH - 138) / 2, 311, 138, "F.d | Enter new name", false) guiWindowSetSizable(Window3, false) name = guiCreateEdit(28, 36, 255, 31, "", false, Window3) guiEditSetMaxLength ( name, 7 ) guiSetFont(name, "default-bold-small") Button17 = guiCreateButton(191, 84, 102, 30, "تعديل الاسم", false, Window3) guiSetFont(Button17, "default-bold-small") guiSetProperty(Button17, "NormalTextColour", "C8FFFFFF") Button18 = guiCreateButton(18, 84, 102, 30, "اغلاق", false, Window3) guiSetFont(Button18, "default-bold-small") guiSetProperty(Button18, "NormalTextColour", "C8FFFFFF") local screenW, screenH = guiGetScreenSize() Exit = guiCreateButton(screenW - 302 - 10, (screenH - 61) / 2, 302, 61, "اغلاق", false) guiSetFont(Exit, "default-bold-small") guiSetProperty(Exit, "NormalTextColour", "FFFF0000") guiSetVisible ( Exit, false ) guiWindowSetMovable(CarShow, false) guiWindowSetSizable(CarShow, false) guiWindowSetSizable(Window2, false) guiWindowSetSizable(Window3, false) -- guiSetVisible ( Button1, false ) guiSetVisible ( Button3, false ) guiSetVisible ( Button6, false ) guiSetVisible ( Button2, false ) guiSetVisible ( Button7, false ) guiSetVisible ( Button8, false ) guiSetVisible ( Button9, false ) guiSetVisible ( Button10, false ) guiSetVisible ( Button11, false ) guiSetVisible ( Button12, false ) guiSetVisible ( Button13, false ) guiSetVisible ( Button14, false ) -- guiSetVisible ( Exit, false ) guiSetVisible ( CarShow, false ) guiSetVisible ( Window2, false ) guiSetVisible ( Window3, false ) -- function randomColor ( speed ) function iColor ( ) iC1, iC2, iC3, iC4, iC5, iC = iC1 or 255, iC2 or 255, iC3 or 255, iC4 or 255, iC5 or 255, math.random ( 1, 10 ) end iC1, iC2, iC3, iC4, iC5, iC = iC1 or 255, iC2 or 255, iC3 or 255, iC4 or 255, iC5 or 255, iC or math.random ( 1, 10 ) if iC == 1 then iC1 = iC1 + speed if iC1 >= 255 then iColor ( ) iC1 = 255 end elseif iC == 2 then iC1 = iC1 - speed if iC1 <= 0 then iColor ( ) iC1 = 0 end elseif iC == 3 then iC2 = iC2 + speed if iC2 >= 255 then iColor ( ) iC2 = 255 end elseif iC == 4 then iC2 = iC2 - speed if iC2 <= 0 then iColor ( ) iC2 = 0 end elseif iC == 5 then iC3 = iC3 + speed if iC3 >= 255 then iColor ( ) iC3 = 255 end elseif iC == 6 then iC3 = iC3 - speed if iC3 <= 0 then iColor ( ) iC3 = 0 end elseif iC == 7 then iC4 = iC4 + speed if iC4 >= 255 then iColor ( ) iC4 = 255 end elseif iC == 8 then iC4 = iC4 - speed if iC4 <= 0 then iColor ( ) iC4 = 0 end elseif iC == 9 then iC5 = iC5 + speed if iC5 >= 255 then iColor ( ) iC5 = 255 end elseif iC == 10 then iC5 = iC5 - speed if iC5 <= 0 then iColor ( ) iC5 = 0 end end return iC1, iC2, iC3, iC4, iC5 end function keys ( key ) if string.find ( key, "F" ) then cancelEvent ( ) end end function getIndex ( tablee, value ) for i, v in pairs ( tablee ) do if v[1] == value then return i end end end function Toggle ( bool ) if #getEventHandlers ( "onClientKey", localPlayer ) > 1 then for i, v in getEventHandlers ( "onClientKey", localPlayer ) do if v == keys then removeEventHandler ( "onClientKey", localPlayer, keys ) end end elseif #getEventHandlers ( "onClientKey", localPlayer ) == 1 then removeEventHandler ( "onClientKey", localPlayer, keys ) end if bool == true then addEventHandler ( "onClientKey", localPlayer, keys ) toggleAllControls ( false ) else toggleAllControls ( true ) end end -- color = { } arrow = { } Cars = { } -- addEvent ( "Add:Vehicle", true ) addEvent ( "refresh:vehicles", true ) addEventHandler ( "refresh:vehicles", root, function ( Table ) guiGridListClear ( MyCars ) for i, v in pairs ( Table ) do local row = guiGridListAddRow ( MyCars ) guiGridListSetItemText ( MyCars, row, 1, i, false, false ) guiGridListSetItemText ( MyCars, row, 2, v.name, false, false ) guiGridListSetItemText ( MyCars, row, 3, v.vehicle, false, false ) guiGridListSetItemText ( MyCars, row, 4, v.id, false, false ) end end ) addEventHandler ( "onClientRender", root, function ( ) if #Cars == 0 then return end rc1, rc2, rc3, rc4, rc5 = randomColor ( 8 ) for i=1,#Cars do if color[ Cars[ i ] ] then setVehicleColor( Cars[ i ],rc1,rc2,rc3,rc4,rc5,rc1,rc2,rc3,rc4,rc5,rc1,rc2 ) end end end ) addEventHandler ( "onClientResourceStart", root, function ( ) triggerServerEvent ( "Check:s", localPlayer, localPlayer) end ) addEventHandler ( "onClientMarkerHit", marker, function ( hitter ) if hitter ~= localPlayer then return end guiSetVisible ( Window2, true ) showCursor ( true ) end ) addEventHandler ( "onClientGUIClick", root, function ( ) -- If He want to close window ? if source == X then -- Invisible Window2 guiSetVisible ( Window2, false ) showCursor ( false ) -- If He want to go car show ? elseif source == Button12 then -- Warp setElementPosition ( localPlayer, -1640.12500, 1203.06262, 7.23448 ) -- If He Want to create vehicle ? elseif source == Button1 then -- Check if he had a cars ? if ( guiGridListGetRowCount ( MyCars ) == 0 ) then return outputChatBox ( "You don't Have a vehicle ", 255, 255, 0 ) end -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end guiSetVisible ( Button4, false ) guiSetVisible ( Button3, false ) guiSetVisible ( Button6, false ) guiSetVisible ( Button2, false ) guiSetVisible ( Button7, false ) guiSetVisible ( Button8, false ) guiSetVisible ( Button9, false ) guiSetVisible ( Button10, false ) guiSetVisible ( Button11, false ) guiSetVisible ( Button12, false ) guiSetVisible ( Button13, false ) guiSetVisible ( Button14, false ) -- Check if car has shown if ( Cars[ row + 1 ] ) then return outputChatBox ( "You Can not Create A vehicle, while vehicle already created", 255, 255, 0 ) end -- CREATE CAR IF THERE NO PROBLEM .. local carID = guiGridListGetItemText ( MyCars, row, 4 ) triggerServerEvent ( "Refresh:Me", localPlayer ) triggerServerEvent ( "Create:Vehicle", localPlayer, tonumber(carID), row + 1 ) -- If he want to destroy a car ? elseif source == Button7 then -- Check if he had a cars ? if ( guiGridListGetRowCount ( MyCars ) == 0 ) then return outputChatBox ( "You don't Have a vehicle ", 255, 255, 0 ) end -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end local row = row + 1 -- Check if car has not shown if ( not Cars[ row ] ) then return outputChatBox ( "You Can not Destroy A vehicle, while vehicle already invisibale ", 255, 255, 0 ) end guiSetVisible ( Button4, false ) guiSetVisible ( Button3, false ) guiSetVisible ( Button6, false ) guiSetVisible ( Button2, false ) guiSetVisible ( Button7, false ) guiSetVisible ( Button8, false ) guiSetVisible ( Button9, false ) guiSetVisible ( Button10, false ) guiSetVisible ( Button11, false ) guiSetVisible ( Button12, false ) guiSetVisible ( Button13, false ) guiSetVisible ( Button14, false ) -- DESTROY CAR IF THERE NO PROBLEM . triggerServerEvent ( "Refresh:Me", localPlayer ) triggerServerEvent ( "Destroy:Veh", localPlayer, Cars[ row ] ) Cars[ row ] = nil; -- If He want to rename a car ? elseif source == Button3 then -- Check if he had a cars ? if ( guiGridListGetRowCount ( MyCars ) == 0 ) then return outputChatBox ( "You don't Have a vehicle ", 255, 255, 0 ) end -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end guiSetVisible ( CarShow, false ) guiSetVisible ( Window3, true ) MyCar = guiGridListGetItemText ( MyCars, row, 4 ); -- If He want to warp to car ? elseif source == Button8 then -- Check if he had a cars ? if ( guiGridListGetRowCount ( MyCars ) == 0 ) then return outputChatBox ( "You don't Have a vehicle ", 255, 255, 0 ) end -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end local row = row + 1 -- Check if car has shown if ( not Cars[ row ] ) then return outputChatBox ( "You Can not Warp to vehicle, while vehicle has not created ", 255, 255, 0 ) end if ( isPedInVehicle ( localPlayer ) ) then return outputChatBox ( "You Can not Warp to vehicle, while your on vehicle ", 255, 255, 0 ) end local x, y, z = getElementPosition ( Cars[ row ] ) setElementPosition ( localPlayer, x, y+3, z ) outputChatBox ( "Successfully Warp to vehicle ", 0, 255, 0 ) -- If He want to warp car to him ? elseif source == Button9 then -- Check if he had a cars ? if ( guiGridListGetRowCount ( MyCars ) == 0 ) then return outputChatBox ( " [ ] : You don't Have a vehicle ", 255, 255, 0 ) end -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end local row = row + 1 -- Check if car has shown if ( not Cars[ row ] ) then return outputChatBox ( "You Can not Warp vehicle to you, while vehicle has not created ", 255, 255, 0 ) end local x, y, z = getElementPosition ( localPlayer ) setElementPosition ( Cars[ row ], x, y+3, z ) outputChatBox ( "Successfully Warp vehicle to you ", 0, 255, 0 ) -- If He want to fix car ? elseif source == Button14 then -- Check if he had a cars ? if ( guiGridListGetRowCount ( MyCars ) == 0 ) then return outputChatBox ( "You don't Have a vehicle ", 255, 255, 0 ) end -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end local row = row + 1 -- Check if car has shown if ( not Cars[ row ] ) then return outputChatBox ( "You Can not Fix vehicle, while vehicle has not created ", 255, 255, 0 ) end fixVehicle ( Cars[ row ] ) outputChatBox ( "Successfully Fix vehicle ", 0, 255, 0 ) -- If He want to Lock/unlock car ? elseif source == Button13 then -- Check if he had a cars ? if ( guiGridListGetRowCount ( MyCars ) == 0 ) then return outputChatBox ( "You don't Have a vehicle ", 255, 255, 0 ) end -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end local row = row + 1 -- Check if car has shown if ( not Cars[ row ] ) then return outputChatBox ( "You Can not Lock/Unlock vehicle, while vehicle has not created ", 255, 255, 0 ) end if ( isVehicleLocked ( Cars[ row ] ) ) then setVehicleLocked ( Cars[ row ], false ) guiSetText ( Button13, "اقفال المركبة" ) outputChatBox ( "Successfully Unlock vehicle ", 0, 255, 0 ) else setVehicleLocked ( Cars[ row ], true ) guiSetText ( Button13, "فتح المركبة" ) outputChatBox ( "Successfully Lock vehicle ", 0, 255, 0 ) end -- If he want to Add/Remove arrow ? elseif source == Button12 then -- Check if he had a cars ? if ( guiGridListGetRowCount ( MyCars ) == 0 ) then return outputChatBox ( "You don't Have a vehicle ", 255, 255, 0 ) end -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end local row = row + 1 -- Check if car has shown if ( not Cars[ row ] ) then return outputChatBox ( "You Can not add/remove arrow above vehicle, while vehicle has not created ", 255, 255, 0 ) end local x, y, z = getElementPosition ( Cars[ row ] ) if ( not arrow[ Cars[ row ] ] ) then outputChatBox ( "Successfully to add arrow ", 0, 255, 0 ) local arrowId = 1318; arrow[ Cars[ row ] ] = createObject ( arrowId, x, y, z+1.5 ) attachElements ( arrow[ Cars[ row ] ], Cars[ row ], 0, 0, 1.5 ) guiSetText ( Button12, "ازالة السهم" ) else outputChatBox ( "Successfully to remove arrow ", 0, 255, 0 ) destroyElement ( arrow[ Cars[ row ] ] ) arrow[ Cars[ row ] ] = nil guiSetText ( Button12, "اضافة سهم" ) end -- If he want to Add/Remove smoke ? elseif source == Button11 then -- HERE I WILL ADD/REMOVE SMOKE -- Check if he had a cars ? if ( guiGridListGetRowCount ( MyCars ) == 0) then return outputChatBox ( "You don't Have a vehicle ", 255, 255, 0 ) end -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end local row = row + 1 -- Check if car has shown if ( not Cars[ row ] ) then return outputChatBox ( "You Can not add/remove smoke under vehicle, while vehicle has not created ", 255, 255, 0 ) end -- If he want to Add/Remove rain bow color ? elseif source == Button10 then -- Check if he had a cars ? if ( guiGridListGetRowCount ( MyCars ) == 0 ) then return outputChatBox ( "You don't Have a vehicle ", 255, 255, 0 ) end -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end local row = row + 1 -- Check if car has shown if ( not Cars[ row ] ) then return outputChatBox ( "You Can not color your vehicle, while vehicle has not created ", 255, 255, 0 ) end if ( not color[ Cars[ row ] ] ) then outputChatBox ( "Successfully to add rainbow color ", 0, 255, 0 ) color[ Cars[ row ] ] = true guiSetText ( Button10, "اطفاء الون العشوائي" ) else outputChatBox ( "Successfully to remove rainbow color ", 0, 255, 0 ) color[ Cars[ row ] ] = nil guiSetText ( Button10, "تشغيل الون العشوائي" ) end -- If he want to Spectate ? elseif source == Button2 then -- Check if he had a cars ? if ( guiGridListGetRowCount ( MyCars ) == 0 ) then return outputChatBox ( "You don't Have a vehicle ", 255, 255, 0 ) end -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end local row = row + 1 -- Check if car has shown if ( not Cars[ row ] ) then return outputChatBox ( "You Can not spectate your vehicle, while vehicle has not created ", 255, 255, 0 ) end if not getVehicleOccupant ( Cars[ row ], 0 ) then local x, y, z = getElementPosition ( Cars[ row ] ) setCameraMatrix ( x, y+10, z+10, x, y, z ) else setCameraTarget ( getVehicleOccupant ( Cars[ row ], 0 ) ) end guiSetVisible ( Exit, true ) guiSetVisible ( CarShow, false ) -- If he want to Exit from Spectate ? elseif source == Exit then local windowtovisible = CarShow if Dim then setElementDimension ( localPlayer, Dim ) destroyElement ( Vehicle ) Dim = false; Had = false; Vehicle = false; windowtovisible = Window2 Toggle ( false ); guiSetVisible ( X, true ) guiSetPosition ( Window2, (screenW - 437) / 2, (screenH - 226) / 2, false ) end setCameraTarget ( localPlayer ) guiSetVisible ( Exit, false ) guiSetVisible ( windowtovisible, true ) elseif source == Button18 then guiSetVisible ( Window3, false ) guiSetVisible ( CarShow, true ) Car = false; -- If he want to rename ? elseif source == Button17 then local edit = guiGetText ( name ) if edit ~= "" then if Car ~= false then triggerServerEvent ( "Change:name", localPlayer, MyCar, edit ) end end -- If he want to Show Car Before buy ? elseif source == Button15 then -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( Carss ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end local Xa,Y,Z = -3383.4404296875,427.45779418945,8.5538206100464 if ( Had ) then destroyElement ( Vehicle ) Vehicle = createVehicle ( guiGridListGetItemText ( Carss, row, 2 ), Xa, Y, Z ) setElementDimension ( Vehicle, getElementDimension ( localPlayer ) ) else Dim = getElementDimension ( localPlayer ) setElementDimension ( localPlayer, 0 ) Had = true setCameraMatrix ( -3375.5383300781, 434.7412109375, 9.940899848938, -3376.1745605469, 434.07504272461, 9.5516166687012 ) Vehicle = createVehicle ( guiGridListGetItemText ( Carss, row, 2 ), Xa, Y, Z ) setElementDimension ( Vehicle, getElementDimension ( localPlayer ) ) guiSetVisible ( X, false ) guiSetVisible ( Exit, true ) guiSetPosition ( Window2, 10, (screenH - 226) / 2, false ) Toggle ( true ); end -- If he want buy ? elseif source == Button16 then -- Chek if he has selected an item ? local row = guiGridListGetSelectedItem ( Carss ) if ( row == -1 ) then return outputChatBox ( "You Should Select a vehicle ", 255, 255, 0 ) end triggerServerEvent ( "Buy:vehicle", localPlayer, guiGridListGetItemText ( Carss, row, 2 ), guiGridListGetItemText ( Carss, row, 4 ) ) -- If he want sell ? elseif source == Button4 then local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then return outputChatBox ( " You Should Select a vehicle ", 255, 255, 0 ) end guiSetVisible ( Button4, false ) guiSetVisible ( Button3, false ) guiSetVisible ( Button6, false ) guiSetVisible ( Button2, false ) guiSetVisible ( Button7, false ) guiSetVisible ( Button8, false ) guiSetVisible ( Button9, false ) guiSetVisible ( Button10, false ) guiSetVisible ( Button11, false ) guiSetVisible ( Button12, false ) guiSetVisible ( Button13, false ) guiSetVisible ( Button14, false ) if ( Cars[ row + 1 ] ) then triggerServerEvent ( "Destroy:Veh", localPlayer, Cars[ row + 1 ] ) end triggerServerEvent ( "Sell:vehicle", localPlayer, guiGridListGetItemText ( MyCars, row, 4 ), Car[ getIndex( Car, tonumber ( guiGridListGetItemText ( MyCars, row, 4 ) ) ) ] [ 2 ] ) else if ( guiGridListGetRowCount ( MyCars ) == 0 ) then return end local row = guiGridListGetSelectedItem ( MyCars ) if ( row == -1 ) then guiSetVisible ( Button4, false ) guiSetVisible ( Button3, false ) guiSetVisible ( Button6, false ) guiSetVisible ( Button2, false ) guiSetVisible ( Button7, false ) guiSetVisible ( Button8, false ) guiSetVisible ( Button9, false ) guiSetVisible ( Button10, false ) guiSetVisible ( Button11, false ) guiSetVisible ( Button12, false ) guiSetVisible ( Button13, false ) guiSetVisible ( Button14, false ) return end guiSetVisible ( Button3, true ) guiSetVisible ( Button4, true ) local row = row + 1; if ( Cars[ row ] ) then if ( arrow[ Cars[ row ] ] ) then guiSetText ( Button12, "ازالة السهم" ) else guiSetText ( Button12, "اضافة سهم" ) end if ( not isVehicleLocked ( Cars[ row ] ) ) then guiSetText ( Button13, "اقفال المركبة" ) else guiSetText ( Button13, "فتح المركبة" ) end if ( color[ Cars[ row ] ] ) then guiSetText ( Button10, "اطفاء الون العشوائي" ) else guiSetText ( Button10, "تشغيل الون العشوائي" ) end guiSetVisible ( Button6, false ) guiSetVisible ( Button7, false ) guiSetVisible ( Button8, false ) guiSetVisible ( Button9, false ) guiSetVisible ( Button10, false ) guiSetVisible ( Button11, false ) guiSetVisible ( Button12, false ) guiSetVisible ( Button13, false ) guiSetVisible ( Button14, false ) guiSetVisible ( Button2, false ) else guiSetVisible ( Button4, false ) guiSetVisible ( Button3, false ) guiSetVisible ( Button6, false ) guiSetVisible ( Button2, false ) guiSetVisible ( Button7, false ) guiSetVisible ( Button8, false ) guiSetVisible ( Button9, false ) guiSetVisible ( Button10, false ) guiSetVisible ( Button11, false ) guiSetVisible ( Button12, false ) guiSetVisible ( Button13, false ) guiSetVisible ( Button14, false ) end end end ) ------------------------------------------------- function F3open() bool = not bool if removeEventHandler("onClientRender",root,F3) then removeEventHandler("onClientRender",root,F3) showCursor(false) else addEventHandler("onClientRender",root,F3) showCursor(true) end end; bindKey ( "F3", "down", F3open ) ------------------------------------------------- وبدي تكون الزرار تشتغل على جريد ليست Edited August 31, 2020 by [T][O][P]CoCo Link to comment
فاّرس Posted August 31, 2020 Share Posted August 31, 2020 وعليكم السلام ورحمة الله وبركاته, ياليت توضح مقصدك لأني مافهمت والكود طويل شوي, وضح مشكلتك وفي أي سطر ونحلها بإذن الله. Link to comment
Mr.Hugin Posted September 1, 2020 Author Share Posted September 1, 2020 (edited) المشكلة اخوي اني بدي اسوي الأزرار دي إكس عرفت هو مود تحكم بسياره يعني إقفال فتح بيع سياره اذهاب إلى المعرض وانا شايف سويت خصايص فا بدي اقدر اسويها ازار دي إكس وتشتغل على جريد ليست؟ Edited September 1, 2020 by [T][O][P]CoCo Link to comment
Scripting Moderators xLive Posted September 1, 2020 Scripting Moderators Share Posted September 1, 2020 الدي اكس عبارة عن رسم ف الضغطات مو جاهزة او لها ايفنت ع طول ف يلي تسويه تستخدم حدث onClientClick ذا الحدث بيشتغل إذا ضغط الماوس واحداثيات وين ضغط تحقق انه ضغط بمكان الزر باستخدام اليوسفيل فنكشن isMouseInPosition وتم Link to comment
فاّرس Posted September 3, 2020 Share Posted September 3, 2020 @xLive إذا مسوي ازار دي اكس وزي كذا, الفكره يبغى لها حسابات أثناء الضغط مثال ما قال لك الأخ أنصحك تستخدم مكتبة دي اكس تكون جاهزه بالأحداث والوظائف وتسهل عليك كثير. 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