jafar Posted February 24, 2013 Share Posted February 24, 2013 onClientGUIClick طيب قول وين نحطها ؟؟؟ كلنت ولا بـ السيرفر ؟ onClient يعني تتوقع اصير سيرفر Link to comment
Rm-Dj Posted February 24, 2013 Share Posted February 24, 2013 GUIEditor_Grid = {} Vehicle = guiCreateWindow(453,218,302,379,"x[ Vehicle Systm ]x",false) guiSetVisible(Vehicle,false) guiSetAlpha (Vehicle, 1) GUIEditor_Button[5] = guiCreateButton (0.0795,0.8575,0.4007,0.1135,"x[ set ]x",true,Vehicle) GUIEditor_Button[4] = guiCreateButton (0.5166,0.8602,0.4007,0.1135,"x[ close ]x",true,Vehicle) GUIEditor_Grid[1] = guiCreateGridList(0.106,0.1214,0.7583,0.6887,true,Vehicle) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) guiGridListAddColumn(GUIEditor_Grid[1],"Vehicle ",0.9) guiSetAlpha(GUIEditor_Grid[1],0.89999997615814) addEventHandler("onClientGUIClick",root, CarsTable = { { "Sultan" }, { "Banshee" }, { "Cheetah" }, { "Admiral" }, } for i, v in ipairs ( CarsTable ) do local row = guiGridListAddRow ( GUIEditor_Grid[1] ) guiGridListSetItemText ( GUIEditor_Grid[1], row, 1, v[1], false, true ) triggerServerEvent("CarsTable",localPlayer) guiSetVisible(Vehicle,false) showCursor(false) end marker = createMarker ( -3583.56934, -3001.66870, 44.00367, "cylinder", 2, 255, 0, 0, 255 ) addEventHandler("onClientMarkerHit",marker, function (player) if (getElementType (player) == "player") and (player == localPlayer) and not isPedInVehicle (player) then guiSetVisible(Vehicle,true) showCursor(true) end end ) خطا ولا صح Link to comment
Rm-Dj Posted February 24, 2013 Share Posted February 24, 2013 ادري انه خطا صححه لي طيب ! Link to comment
iPrestege Posted February 24, 2013 Share Posted February 24, 2013 انـا افضل تسوي اي دي السيارهـ بالجريد ليست ~ بالجدول وسوي عمود زيادهـ ~ تسهل علي ^ Link to comment
3NAD Posted February 24, 2013 Share Posted February 24, 2013 addEventHandler ( "onClientGUIClick", root, function ( ) if source == [ButtonName] then -- Add Your Code. elseif source == [ButtonName] then -- Another Button -- Add Your Code. end end ) Link to comment
iPrestege Posted February 24, 2013 Share Posted February 24, 2013 addEventHandler ( "onClientGUIClick", root, function ( ) if source == [ButtonName] then -- Add Your Code. elseif source == [ButtonName] then -- Another Button -- Add Your Code. end end ) كذا يا عنآد لو يضغط الزر بدون مايشيك ~_~ او يجيب السيارهـ اصلا ماراح يسوي الوظيفة المطلوبة اللي يبيها الاخ ~ Link to comment
Rm-Dj Posted February 24, 2013 Share Posted February 24, 2013 برستيج طيب انت مدامك فاهم عطنا مثال زي عنااد ! Link to comment
iPrestege Posted February 24, 2013 Share Posted February 24, 2013 جرب كذا بـما انك ماسويت لااي دي في الجدول / GUIEditor_Grid = {} GUIEditor_Button = {} Vehicle = guiCreateWindow(453,218,302,379,"x[ Vehicle Systm ]x",false) guiSetVisible(Vehicle,false) guiSetAlpha (Vehicle, 1) GUIEditor_Button[5] = guiCreateButton (0.0795,0.8575,0.4007,0.1135,"x[ set ]x",true,Vehicle) GUIEditor_Button[4] = guiCreateButton (0.5166,0.8602,0.4007,0.1135,"x[ close ]x",true,Vehicle) GUIEditor_Grid[1] = guiCreateGridList(0.106,0.1214,0.7583,0.6887,true,Vehicle) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) local col = guiGridListAddColumn(GUIEditor_Grid[1],"Vehicle ",0.9) guiSetAlpha(GUIEditor_Grid[1],0.89999997615814) CarsTable = { { "Sultan" }, { "Banshee" }, { "Cheetah" }, { "Admiral" }, } for i, v in ipairs ( CarsTable ) do local row = guiGridListAddRow ( GUIEditor_Grid[1] ) guiGridListSetItemText ( GUIEditor_Grid[1], row, 1, v[1], false, true ) end marker = createMarker ( x,y,z, "cylinder", 2, 255, 0, 0, 255 ) addEventHandler("onClientMarkerHit",marker, function (player) if (getElementType (player) == "player") and (player == localPlayer) and not isPedInVehicle (player) then guiSetVisible(Vehicle,true) showCursor(true) end end ) addEventHandler("onClientGUIClick",root, function() if (source == GUIEditor_Button[5]) then local row, col = guiGridListGetSelectedItem ( GUIEditor_Grid[1] ) local get = guiGridListGetItemText(GUIEditor_Grid[1], row, 1 ) if ( row and col and row ~= -1 and col ~= -1 ) then if ( get == "Sultan" ) then triggerServerEvent("Sultan", localPlayer) guiSetVisible(Vehicle,false) showCursor(false) end end end end ) راح يجيب كل كلام الجريد ليست انت سوي elseif ( get == "الكلمة يعني السيارهـ اللي بالجدول") then triggerServerEvent(...) وعلى هذا النحو وهذي السيرفر : addEvent("Sultan",true) addEventHandler("Sultan",root, function () local x,y,z = getElementPosition (source) Sultan = createVehicle (411,x,y,z) warpPedIntoVehicle(source,Sultan) end ) Link to comment
فاّرس Posted February 24, 2013 Share Posted February 24, 2013 يعطيكم العافيهه شرح كافي ووافي بس وش الفايده منهآ ؟ Link to comment
iPrestege Posted February 24, 2013 Share Posted February 24, 2013 تقدر تقول تختصر او او ترتب تجمع..الخ ~ شوف الموضوع اللي بـ دروس البرمجة . Link to comment
Rm-Dj Posted February 24, 2013 Share Posted February 24, 2013 كفوو عليك ي شنب بس هذا المطلوب عاد الباقي خله علي لني بس بشووف الطريقه ويعطيك العافيه + كل الي شااركو Link to comment
Rm-Dj Posted February 24, 2013 Share Posted February 24, 2013 بس ي برستيج الكود حقك يمدي الاعب الواحد يطلع الف موتر ! انا ابيه حده موتر واحد كيف ؟ Link to comment
iPrestege Posted February 24, 2013 Share Posted February 24, 2013 جرب ماجربتة بس المفروض يشتغل ~ addEvent("Sultan",true) addEventHandler("Sultan",root, function() if getElementData ( source, "destroy" ) then destroyElement ( getElementData( source, "destroy" )) end local x,y,z = getElementPosition (source) Sultan = createVehicle (411,x,y,z) warpPedIntoVehicle(source,Sultan) setElementData ( source,"destroy", Sultan ) end ) Link to comment
Rm-Dj Posted February 24, 2013 Share Posted February 24, 2013 ضبط بس اسمع انا حاوللت اضيف كود اغلاق الوحه من زر close ويخرب الكود ليه ! سوه انت لاهنت >< Link to comment
iPrestege Posted February 24, 2013 Share Posted February 24, 2013 جرب ذا addEventHandler("onClientGUIClick",GUIEditor_Button[4], function () guiSetVisible(Vehicle,false) showCursor(false) end,false) Link to comment
Rm-Dj Posted February 24, 2013 Share Posted February 24, 2013 كفووو بس عندي استفسار بسيط كل زر لازم اسويله ادد هندر ؟ Link to comment
iPrestege Posted February 24, 2013 Share Posted February 24, 2013 لا بس ذا مدري وش مشكلتة ~ فـ سويتة لك كذا ولا تقدر تسوي elseif ( source == Button ) then -- Code Link to comment
Rm-Dj Posted February 24, 2013 Share Posted February 24, 2013 لوول ايه صح انا سويت نفس الطريقه ذي وخرب فـ جربت طريقتك الي فووق الي هي الهندر ع كل حال مشكور Link to comment
3NAD Posted February 24, 2013 Share Posted February 24, 2013 فيه امكانية تختصر كودك بدال كثرة الإيفنت و التريقر ليكون بالشكل التالي .. -- Client Side GUIEditor_Grid = {} GUIEditor_Button = {} Vehicle = guiCreateWindow(453,218,302,379,"x[ Vehicle Systm ]x",false) guiSetVisible(Vehicle,false) guiSetAlpha (Vehicle, 1) GUIEditor_Button[5] = guiCreateButton (0.0795,0.8575,0.4007,0.1135,"x[ set ]x",true,Vehicle) GUIEditor_Button[4] = guiCreateButton (0.5166,0.8602,0.4007,0.1135,"x[ close ]x",true,Vehicle) GUIEditor_Grid[1] = guiCreateGridList(0.106,0.1214,0.7583,0.6887,true,Vehicle) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) col = guiGridListAddColumn(GUIEditor_Grid[1],"Vehicle ",0.9) guiSetAlpha(GUIEditor_Grid[1],0.89999997615814) CarsTable = { { "Sultan" }, { "Banshee" }, { "Cheetah" }, { "Admiral" }, } for i, v in ipairs ( CarsTable ) do local row = guiGridListAddRow ( GUIEditor_Grid[1] ) guiGridListSetItemText ( GUIEditor_Grid[1], row, 1, v[1], false, true ) end marker = createMarker ( x,y,z, "cylinder", 2, 255, 0, 0, 255 ) addEventHandler ( "onClientMarkerHit", marker, function ( player ) if ( getElementType ( player ) == "player" ) and ( player == localPlayer ) and not isPedInVehicle ( player ) then guiSetVisible ( Vehicle, true ) showCursor ( true ) end end ) addEventHandler ( "onClientGUIClick", root, function ( ) if source == GUIEditor_Button[5] then local aGet = guiGridListGetItemText ( GUIEditor_Grid[1], guiGridListGetSelectedItem ( GUIEditor_Grid[1] ), 1 ) if aGet == "" then return end triggerServerEvent ( "onSelectedVehicle", localPlayer, aGet ) guiSetVisible ( Vehicle, false ) showCursor ( false ) elseif source == GUIEditor_Button[4] then guiSetVisible ( Vehicle, false ) showCursor ( false ) end end ) -- Server Side Vehicles = { } addEvent ( "onSelectedVehicle", true ) addEventHandler ( "onSelectedVehicle", root, function ( vehicleName ) if Vehicles [ source ] then destroyElement ( Vehicles [ source ] ) end local vName = getVehicleModelFromName ( vehicleName ) if vName then local x, y, z = getElementPosition ( source ) Vehicles [ source ] = createVehicle ( vName, x, y, z ) warpPedIntoVehicle ( source, Vehicles [ source ] ) end end ) addEventHandler ( "onPlayerQuit", root, function ( ) if Vehicles [ source ] then destroyElement ( Vehicles [ source ] ) Vehicles [ source ] = nil end end ) الباقي عليكـ تضيف المواتر بـ جدول الكلنت ذذ 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