#StrOnG_,) Posted January 9, 2016 Share Posted January 9, 2016 السلام عليكم ابي اعدل على هذي الاكواد اخليها بفلوس معينه لكل سيارة كيف اسويها ؟ Client # local Vehicles = { {'Alpha',602}, {'Banshee',429}, {'Buffalo',402}, {'Bullet',541}, {'Cheetah',415}, {'Comet',480}, {'Elegy',562}, {'Euros',587}, {'Flash',565}, {'Jester',559}, {'Phoenix',603}, {'Sultan',560}, {'Super GT',506}, {'Turismo',451}, {'Uranus',558}, {'NRG-500',522}, {'Infernus',411}, } for i,v in ipairs ( Vehicles ) do local row = guiGridListAddRow ( grid ) guiGridListSetItemText ( grid , row , 1 , v[1] , false , false ) guiGridListSetItemData ( grid , row , 1 , v[2] ) end addEventHandler('onClientGUIClick',root, function ( ) if ( source == GUIEditor.button[1] ) then if ( guiGridListGetSelectedItem ( grid ) ~= -1 ) then showCursor(false) guiSetVisible(wnd,false) triggerServerEvent('cars',getLocalPlayer(),guiGridListGetItemData ( grid , guiGridListGetSelectedItem ( grid ) , 1 ) ) end end end ) Server # local Vehicle = { } addEvent('cars',true) addEventHandler('cars',root, function ( id ) if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) end local Position = { getElementPosition ( source ) } Vehicle[source] = createVehicle ( id , Position[1] , Position[2] , Position[3] ) warpPedIntoVehicle ( source , Vehicle[source] ) end ) addEventHandler('onPlayerQuit',root, function ( ) if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) end end) Link to comment
iPrestege Posted January 9, 2016 Share Posted January 9, 2016 عدل على الجدول باضافة قيمة لكل سيارة وارسال القيمة للسيرفر والتحقق من المبلغ مع الاعب وسحب المبلغ من الاعب . Link to comment
Mr.R Posted January 9, 2016 Share Posted January 9, 2016 (edited) تفضل , اعتقد كل شيء واضح واذا مافهمت حاجه اسأل وحاول تفهم التعديلات لاتنسخ وتلصق #Client Side local Vehicles = { { "Alpha", 602, 1000 }, { "Banshee", 429, 2000 }, { "Buffalo", 402, 3000 }, { "Bullet", 541, 4000 }, { "Cheetah", 415, 5000 }, { "Comet", 480, 6000 }, { "Elegy", 562, 7000 }, { "Euros", 587, 8000}, { "Flash", 565, 9000}, { "Jester", 559, 10000 }, { "Phoenix", 603, 20000 }, { "Sultan", 560, 30000 }, { "Super GT", 506, 40000 }, { "Turismo", 451, 50000 }, { "Uranus", 558, 60000 }, { "NRG-500", 522, 70000 }, { "Infernus", 411, 90000 }, } for i,v in ipairs ( Vehicles ) do local row = guiGridListAddRow ( grid ) guiGridListSetItemText ( grid, row, 1, tostring ( v[1] ), false , false ) guiGridListSetItemText ( grid, row, 2, "$"..v[3] , false , false ) guiGridListSetItemColor ( grid, row, 2, 0, 255, 0 ) guiGridListSetItemData ( grid, row, 1, v[2] ) end addEventHandler ( "onClientGUIClick", resourceRoot, function ( ) if ( source == GUIEditor.button[1] ) then if ( guiGridListGetSelectedItem ( grid ) ~= -1 ) then local Money = guiGridListGetItemText ( grid, guiGridListGetSelectedItem ( grid ), 2 ) local iD = guiGridListGetItemData ( grid, guiGridListGetSelectedItem ( grid ), 1 ) if ( Money ~= '' and iD ~= '' ) then triggerServerEvent ( "Cars", localPlayer, iD, string.sub ( Money, 2, string.len ( Money ) ) ) guiSetVisible( wnd, false ) showCursor ( false ) end else outputChatBox ( "* الرجاء اختيار سيارهـ", 255, 255, 255, true ) end end end ) #Server Side local Vehicle = { }; addEvent ( "Cars", true ) addEventHandler ( "Cars", root, function ( iD, Money ) if ( getPlayerMoney ( source ) >= tonumber ( Money ) ) then takePlayerMoney ( source, tonumber ( Money ) ) outputChatBox ( "* [ "..tonumber ( Money ).." ] بـ هذا المبلغ [ "..getVehicleNameFromID ( iD ).." ] لقد اشتريت السيارهـ", source, 0, 255, 0, true ) else outputChatBox ( "* لا تملك المال الكافي لـ شراء سيارهـ", source, 255, 0, 0, true ) end if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) end local x, y, z = getElementPosition ( source ) Vehicle[source] = createVehicle ( iD, x, y, z ) warpPedIntoVehicle ( source, Vehicle[source] ) end ) addEventHandler ( "onPlayerQuit", root, function ( ) if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) Vehicle[source] = nil end end ) واذا تبي السيارهـ تختفي بعد ماتنفجر مباشرهـ استخدم هذا الحدث Event : "onVehicleExplode" وهذا الفنكشن destroyElement ... طبعاً من جانب سيرفر Edited January 9, 2016 by Guest Link to comment
#StrOnG_,) Posted January 9, 2016 Author Share Posted January 9, 2016 عندك خطأ بالسيرفر server.lua:10 'end' expected (to close ' function' at line 5 near else Link to comment
Abdul KariM Posted January 9, 2016 Share Posted January 9, 2016 عندك خطأ بالسيرفر server.lua:10 'end' expected (to close ' function' at line 5 near else local Vehicle = { }; addEvent ( "Cars", true ) addEventHandler ( "Cars", root, function ( iD, Money, player ) if ( getPlayerMoney ( player ) >= tonumber ( Money ) ) then takePlayerMoney ( player, tonumber ( Money ) ) outputChatBox ( "* [ "..tonumber ( Money ).." ] بـ هذا المبلغ [ "..getVehicleNameFromID ( iD ).." ] لقد اشتريت السيارهـ", player, 0, 255, 0, true ) else outputChatBox ( "* لا تملك المال الكافي لـ شراء سيارهـ", player, 255, 0, 0, true ) end if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) end local x, y, z = getElementPosition ( player ) Vehicle[source] = createVehicle ( iD, x, y, z ) warpPedIntoVehicle ( player, Vehicle[source] ) end ) Link to comment
#StrOnG_,) Posted January 9, 2016 Author Share Posted January 9, 2016 عندك خطأ بالسيرفر server.lua:10 'end' expected (to close ' function' at line 5 near else local Vehicle = { }; addEvent ( "Cars", true ) addEventHandler ( "Cars", root, function ( iD, Money, player ) if ( getPlayerMoney ( player ) >= tonumber ( Money ) ) then takePlayerMoney ( player, tonumber ( Money ) ) outputChatBox ( "* [ "..tonumber ( Money ).." ] بـ هذا المبلغ [ "..getVehicleNameFromID ( iD ).." ] لقد اشتريت السيارهـ", player, 0, 255, 0, true ) else outputChatBox ( "* لا تملك المال الكافي لـ شراء سيارهـ", player, 255, 0, 0, true ) end if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) end local x, y, z = getElementPosition ( player ) Vehicle[source] = createVehicle ( iD, x, y, z ) warpPedIntoVehicle ( player, Vehicle[source] ) end ) Server.lua:6: attempt to compare numper with boolean ومعي فلوس عشان اشتري . Link to comment
' A F . Posted January 9, 2016 Share Posted January 9, 2016 local Vehicle = { }; addEvent ( "Cars", true ) addEventHandler ( "Cars", root, function ( iD, Money, player ) if ( tonumber ( Money ) ) then if ( getPlayerMoney ( player ) >= tonumber ( Money ) ) then takePlayerMoney ( player, tonumber ( Money ) ) outputChatBox ( "* [ "..tonumber ( Money ).." ] بـ هذا المبلغ [ "..getVehicleNameFromID ( iD ).." ] لقد اشتريت السيارهـ", player, 0, 255, 0, true ) else outputChatBox ( "* لا تملك المال الكافي لـ شراء سيارهـ", player, 255, 0, 0, true ) end end if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) end local x, y, z = getElementPosition ( player ) Vehicle[source] = createVehicle ( iD, x, y, z ) warpPedIntoVehicle ( player, Vehicle[source] ) end ) Link to comment
#StrOnG_,) Posted January 9, 2016 Author Share Posted January 9, 2016 نفس المشكلة ونفس الكلام بالدي بق @_@ Link to comment
Mr.R Posted January 9, 2016 Share Posted January 9, 2016 نفس المشكلة ونفس الكلام بالدي بق @_@ جرب صلحته وصلحتها Moneny الي داخل الفنكشن كذا Money الغلط الرئيسي كانت ... ويسلمون الشباب ماقصروا Link to comment
#StrOnG_,) Posted January 9, 2016 Author Share Posted January 9, 2016 ما ضبط @ يقول فيه اند زايد بـ سطر 10 حذفت الاند يجي لي بالدي بق Server.lua:20: unexpected symbol near ) @_@ Link to comment
Mr.R Posted January 9, 2016 Share Posted January 9, 2016 ما ضبط @ يقول فيه اند زايد بـ سطر 10حذفت الاند يجي لي بالدي بق Server.lua:20: unexpected symbol near ) @_@ جرب الحين Link to comment
#StrOnG_,) Posted January 9, 2016 Author Share Posted January 9, 2016 ما ضبط @ يقول فيه اند زايد بـ سطر 10حذفت الاند يجي لي بالدي بق Server.lua:20: unexpected symbol near ) @_@ جرب الحين Server.lua:7: attempt to compare numper with boolean شكلها معانده معي هذي المره :@ Link to comment
Mr.R Posted January 9, 2016 Share Posted January 9, 2016 ^ حذفت سطر 6 , ماشوف له داعي جرب الحيين Link to comment
Abdul KariM Posted January 9, 2016 Share Posted January 9, 2016 (edited) كلينت local Vehicles = { { "Alpha", 602, "1000" }, { "Banshee", 429, "2000" }, { "Buffalo", 402, "3000" }, { "Bullet", 541, "4000" }, { "Cheetah", 415, "5000" }, { "Comet", 480, "6000" }, { "Elegy", 562, "7000" }, { "Euros", 587, "8000"}, { "Flash", 565, "9000"}, { "Jester", 559, "10000" }, { "Phoenix", 603, "20000" }, { "Sultan", 560, "30000" }, { "Super GT", 506, "40000" }, { "Turismo", 451, "50000" }, { "Uranus", 558, "60000" }, { "NRG-500", 522, "70000" }, { "Infernus", 411, "80000" }, } for i,v in ipairs ( Vehicles ) do local row = guiGridListAddRow ( grid ) guiGridListSetItemText ( grid, row, 1, tostring(v[1]) , false , false ) guiGridListSetItemText ( grid, row, 2, v[2] , false , false ) guiGridListSetItemText ( grid, row, 3, tostring(v[3]) , false , false ) guiGridListSetItemColor ( grid, row, 2, 0, 255, 0) guiGridListSetItemData ( grid, row, 2, v[2] ) end addEventHandler ( "onClientGUIClick", resourceRoot, function ( ) if ( source == GUIEditor.button[1] ) then if ( guiGridListGetSelectedItem ( grid ) ~= -1 ) then local Money = guiGridListGetItemText ( grid, guiGridListGetSelectedItem ( grid ), 3 ) local iD = guiGridListGetItemData( grid, guiGridListGetSelectedItem( grid ), 2 ) if ( Money ~= '' and iD ~= '' ) then triggerServerEvent ( "Cars", localPlayer, iD, Money ) guiSetVisible( wnd, false ) showCursor ( false ) end else outputChatBox ( "* الرجاء اختيار سيارهـ", 255, 255, 255, true ) end end end ) سيرفر local Vehicle = { }; addEvent ( "Cars", true ) addEventHandler ( "Cars", root, function ( iD, Money ) if ( getPlayerMoney ( source ) >= tonumber( Money ) ) then takePlayerMoney ( source, tonumber( Money ) ) outputChatBox ( "* [ ".. tonumber( Money ) .." ] بـ هذا المبلغ [ "..getVehicleNameFromID ( iD ).." ] لقد اشتريت السيارهـ", source, 0, 255, 0, true ) else outputChatBox ( "* لا تملك المال الكافي لـ شراء سيارهـ", source, 255, 0, 0, true ) end if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) end local x, y, z = getElementPosition ( source ) Vehicle[source] = createVehicle ( iD, x, y, z ) warpPedIntoVehicle ( source, Vehicle[source] ) end ) Edited January 9, 2016 by Guest Link to comment
#StrOnG_,) Posted January 9, 2016 Author Share Posted January 9, 2016 ^حذفت سطر 6 , ماشوف له داعي جرب الحيين نفس المشكلة ولكن بسطر رقم 6 Server.lua:6: attempt to compare numper with boolean Link to comment
Mr.R Posted January 9, 2016 Share Posted January 9, 2016 (edited) كلينت local Vehicles = { { "Alpha", 602, "1000" }, { "Banshee", 429, "2000" }, { "Buffalo", 402, "3000" }, { "Bullet", 541, "4000" }, { "Cheetah", 415, "5000" }, { "Comet", 480, "6000" }, { "Elegy", 562, "7000" }, { "Euros", 587, "8000"}, { "Flash", 565, "9000"}, { "Jester", 559, "10000" }, { "Phoenix", 603, "20000" }, { "Sultan", 560, "30000" }, { "Super GT", 506, "40000" }, { "Turismo", 451, "50000" }, { "Uranus", 558, "60000" }, { "NRG-500", 522, "70000" }, { "Infernus", 411, "80000" }, } for i,v in ipairs ( Vehicles ) do local row = guiGridListAddRow ( grid ) guiGridListSetItemText ( grid, row, 1, tostring(v[1]) , false , false ) guiGridListSetItemText ( grid, row, 2, v[2] , false , false ) guiGridListSetItemText ( grid, row, 3, tostring(v[3]) , false , false ) guiGridListSetItemColor ( grid, row, 2, 0, 255, 0) guiGridListSetItemData ( grid, row, 2, v[2] ) end addEventHandler ( "onClientGUIClick", resourceRoot, function ( ) if ( source == GUIEditor.button[1] ) then if ( guiGridListGetSelectedItem ( grid ) ~= -1 ) then local Money = guiGridListGetItemText ( grid, guiGridListGetSelectedItem ( grid ), 3 ) local iD = guiGridListGetItemData( grid, guiGridListGetSelectedItem( grid ), 2 ) if ( Money ~= '' and iD ~= '' ) then triggerServerEvent ( "Cars", localPlayer, iD, Money ) guiSetVisible( wnd, false ) showCursor ( false ) end else outputChatBox ( "* الرجاء اختيار سيارهـ", 255, 255, 255, true ) end end end ) سيرفر local Vehicle = { }; addEvent ( "Cars", true ) addEventHandler ( "Cars", root, function ( iD, Money ) if ( getPlayerMoney ( source ) >= tonumber( Money ) ) then takePlayerMoney ( source, tonumber( Money ) ) outputChatBox ( "* [ ".. tonumber( Money ) .." ] بـ هذا المبلغ [ "..getVehicleNameFromID ( iD ).." ] لقد اشتريت السيارهـ", source, 0, 255, 0, true ) else outputChatBox ( "* لا تملك المال الكافي لـ شراء سيارهـ", source, 255, 0, 0, true ) end if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) end local x, y, z = getElementPosition ( source ) Vehicle[source] = createVehicle ( iD, x, y, z ) warpPedIntoVehicle ( source, Vehicle[source] ) end ) ياحبيبي حنا ليه سوينا داتا للايدي ؟ عشان مانحطه في القريد ليست عندك غلط هذي المفروض guiGridListSetItemText ( grid, row, 1, v[2] , false , false ) كذا لاننا ماراح نحطها بالقريد ليست سوينا لها داتا يعني تصير بالكولمن الاول مع الاسم وهذي المفروض كذا guiGridListSetItemText ( grid, row, 2, v[3] , false , false ) وقيمة الفلوس بالجدول ليه حاط عليها سترنق وهي نمبر يعني ماتحتاج سترنق لاننا بنستخدم tonumber وليس tostring خله على اكوادي صلحتها لا تلخطبه واذا ماعجبته يقدر يستخدم حقتك .. للتوضيح بس <== Edited January 9, 2016 by Guest Link to comment
Mr.R Posted January 9, 2016 Share Posted January 9, 2016 ^حذفت سطر 6 , ماشوف له داعي جرب الحيين نفس المشكلة ولكن بسطر رقم 6 Server.lua:6: attempt to compare numper with boolean جربها كذا #Client Side local Vehicles = { { "Alpha", 602, 1000 }, { "Banshee", 429, 2000 }, { "Buffalo", 402, 3000 }, { "Bullet", 541, 4000 }, { "Cheetah", 415, 5000 }, { "Comet", 480, 6000 }, { "Elegy", 562, 7000 }, { "Euros", 587, 8000}, { "Flash", 565, 9000}, { "Jester", 559, 10000 }, { "Phoenix", 603, 20000 }, { "Sultan", 560, 30000 }, { "Super GT", 506, 40000 }, { "Turismo", 451, 50000 }, { "Uranus", 558, 60000 }, { "NRG-500", 522, 70000 }, { "Infernus", 411, 90000 }, } for i,v in ipairs ( Vehicles ) do local row = guiGridListAddRow ( grid ) guiGridListSetItemText ( grid, row, 1, tostring ( v[1] ), false , false ) guiGridListSetItemText ( grid, row, 2, "$"..v[3] , false , false ) guiGridListSetItemColor ( grid, row, 2, 0, 255, 0 ) guiGridListSetItemData ( grid, row, 1, v[2] ) end addEventHandler ( "onClientGUIClick", resourceRoot, function ( ) if ( source == GUIEditor.button[1] ) then if ( guiGridListGetSelectedItem ( grid ) ~= -1 ) then local Money = guiGridListGetItemText ( grid, guiGridListGetSelectedItem ( grid ), 2 ) local iD = guiGridListGetItemData ( grid, guiGridListGetSelectedItem ( grid ), 1 ) if ( Money ~= '' and iD ~= '' ) then triggerServerEvent ( "Cars", localPlayer, iD, string.sub ( Money, 2, string.len ( Money ) ) ) guiSetVisible( wnd, false ) showCursor ( false ) end else outputChatBox ( "* الرجاء اختيار سيارهـ", 255, 255, 255, true ) end end end ) #Server Side local Vehicle = { }; addEvent ( "Cars", true ) addEventHandler ( "Cars", root, function ( iD, Money ) if ( getPlayerMoney ( source ) >= tonumber ( Money ) ) then takePlayerMoney ( source, tonumber ( Money ) ) outputChatBox ( "* [ "..tonumber ( Money ).." ] بـ هذا المبلغ [ "..getVehicleNameFromID ( iD ).." ] لقد اشتريت السيارهـ", source, 0, 255, 0, true ) else outputChatBox ( "* لا تملك المال الكافي لـ شراء سيارهـ", source, 255, 0, 0, true ) end if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) end local x, y, z = getElementPosition ( source ) Vehicle[source] = createVehicle ( iD, x, y, z ) warpPedIntoVehicle ( source, Vehicle[source] ) end ) addEventHandler ( "onPlayerQuit", root, function ( ) if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) Vehicle[source] = nil end end ) Link to comment
#StrOnG_,) Posted January 9, 2016 Author Share Posted January 9, 2016 مشكور مستر ار وباقي الشباب <3 ممكن اعرف وش كان الخطأ Link to comment
Mr.R Posted January 9, 2016 Share Posted January 9, 2016 مشكور مستر ار وباقي الشباب <3ممكن اعرف وش كان الخطأ حياك الله حبيبي .. لو تلاحظ غيرت بلاير إلى سورس بس مالها شغل لو خليتها او شلتها الخطأ باختصار local Vehicle = { }; addEvent ( "Cars", true ) addEventHandler ( "Cars", root, function ( iD, Moneny ) -- Moeny هنا الغلط في كلمة if ( getPlayerMoney ( source ) >= tonumber ( Money ) ) then takePlayerMoney ( source, tonumber ( Money ) ) outputChatBox ( "* [ "..tonumber ( Money ).." ] بـ هذا المبلغ [ "..getVehicleNameFromID ( iD ).." ] لقد اشتريت السيارهـ", source, 0, 255, 0, true ) end -- وهنا الغلط المفروض الاند تحت مخرج الشات الي يقولك لا تملك المال الكافي عشان تعكس الشرط الي فوق سطر 6 ويطلع الكلام في الشات else outputChatBox ( "* لا تملك المال الكافي لـ شراء سيارهـ", source, 255, 0, 0, true ) if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) end local x, y, z = getElementPosition ( source ) Vehicle[source] = createVehicle ( iD, x, y, z ) warpPedIntoVehicle ( source, Vehicle[source] ) end ) وهنا التصحيح local Vehicle = { }; addEvent ( "Cars", true ) addEventHandler ( "Cars", root, function ( iD, Money ) if ( getPlayerMoney ( source ) >= tonumber ( Money ) ) then takePlayerMoney ( source, tonumber ( Money ) ) outputChatBox ( "* [ "..tonumber ( Money ).." ] بـ هذا المبلغ [ "..getVehicleNameFromID ( iD ).." ] لقد اشتريت السيارهـ", source, 0, 255, 0, true ) else outputChatBox ( "* لا تملك المال الكافي لـ شراء سيارهـ", source, 255, 0, 0, true ) end if ( isElement ( Vehicle[source] ) ) then destroyElement ( Vehicle[source] ) end local x, y, z = getElementPosition ( source ) Vehicle[source] = createVehicle ( iD, x, y, z ) warpPedIntoVehicle ( source, Vehicle[source] ) end ) Link to comment
Mr.R Posted January 9, 2016 Share Posted January 9, 2016 مشكور يالذيب ^ حياك الله , بس ابغي صوره للمود بعد ماضبط معك بشوفه .. أفكر اسوي معرض سيارات خطير ض1 مو للاكواد للوحه نفسها Link to comment
#StrOnG_,) Posted January 9, 2016 Author Share Posted January 9, 2016 مشكور يالذيب ^ حياك الله , بس ابغي صوره للمود بعد ماضبط معك بشوفه .. أفكر اسوي معرض سيارات خطير ض1 مو للاكواد للوحه نفسها ايهه ابشر ض -- -- Link to comment
teu12 Posted January 9, 2016 Share Posted January 9, 2016 6 الخط هو المشكلة، وحان الوقت وأنها ستعمل Link to comment
#StrOnG_,) Posted January 17, 2016 Author Share Posted January 17, 2016 @ Mr.R امم بعد مدة جربت اشتري اي شي من القريد ليست وفلوسي 0 قام يشتري يعني حتى لو ما معي فلوس يشتري 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