ghassen14 Posted October 1, 2015 Share Posted October 1, 2015 السلام عليكم شباب ابي كود لما يضغط زر يعطيه سلاح و شكرا شباب Link to comment
#|_oskar_|# Posted October 1, 2015 Share Posted October 1, 2015 Client onClientGUIClick triggerServerEvent Server addEvent giveWeapon Link to comment
khaledmhammed Posted October 1, 2015 Share Posted October 1, 2015 -- client -- Event : onClientGUIClick addEventHandler function () if source == الزر then triggerServerEvent -- server -- addEvent addEventHandler function () giveWeapon https://forum.multitheftauto.com/viewtopic.php?f=160&t=93303 -- هذا المثال نفس طلبك بس بدل فنكشن السيرفر باللي تبي Link to comment
Mr.R Posted October 1, 2015 Share Posted October 1, 2015 #Client Side addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == اسم الزر ) then triggerServerEvent ( "Minigun", localPlayer ) -- ترايقر لسيرفر عشان لايكون السلاح وهمي end end ) #Server Side addEvent( "Minigun", true ) addEventHandler ( "Minigun", root, function ( ) if ( getPlayerMoney ( source ) >= 4000 ) then takePlayerMoney ( source, 4000 ) -- يأخذ منه 4 الاف سعر السلاح giveWeapon ( source , 38, 10000 ) -- العشر الاف الرصاص الي يجي بالسلاح والـ38 ايدي السلاح setPedWeaponSlot ( source, getSlotFromWeapon ( 38 ) ) -- ايدي السلاح outputChatBox ( "* " .. getPlayerName ( source ) .. " Has Bought Weapon [ Minigun ]", root, 255, 255, 255, true )-- مخرج شات else outputChatBox ( "* You don't have $4000 to buy [ Minigun ]", source, 255, 255, 255, true )-- مخرج شات end end ) Link to comment
khaledmhammed Posted October 1, 2015 Share Posted October 1, 2015 #Client Side addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == اسم الزر ) then triggerServerEvent ( "Minigun", localPlayer ) -- ترايقر لسيرفر عشان لايكون السلاح وهمي end end ) #Server Side addEvent( "Minigun", true ) addEventHandler ( "Minigun", root, function ( ) if ( getPlayerMoney ( source ) >= 4000 ) then takePlayerMoney ( source, 4000 ) -- يأخذ منه 4 الاف سعر السلاح giveWeapon ( source , 38, 10000 ) -- العشر الاف الرصاص الي يجي بالسلاح والـ38 ايدي السلاح setPedWeaponSlot ( source, getSlotFromWeapon ( 38 ) ) -- ايدي السلاح outputChatBox ( "* " .. getPlayerName ( source ) .. " Has Bought Weapon [ Minigun ]", root, 255, 255, 255, true )-- مخرج شات else outputChatBox ( "* You don't have $4000 to buy [ Minigun ]", source, 255, 255, 255, true )-- مخرج شات end end ) السطر ذا if ( getPlayerMoney ( source ) >= 4000 ) then يتحقق لو معه المبلغ او لا عشان ماتكون الفلوس سالب ولا؟ Link to comment
` Allawi Posted October 1, 2015 Share Posted October 1, 2015 السطر ذا if ( getPlayerMoney ( source ) >= 4000 ) then يتحقق لو معه المبلغ او لا عشان ماتكون الفلوس سالب ولا؟ يتحقق منها كلها راح يتحقق انه الفلوس مو سالب وراح يتحقق ان فلوسه اكثر من 4000 Link to comment
ghassen14 Posted October 1, 2015 Author Share Posted October 1, 2015 شباب وين الخطأ انا لما اضغط الزر ما اشتغل addEvent( "Usi", true ) addEventHandler ( "Usi", root, function ( ) if ( getPlayerMoney ( source ) >= 100 ) then takePlayerMoney ( source, 100 ) giveWeapon ( source , 28, 10000 ) setPedWeaponSlot ( source, getSlotFromWeapon ( 28) ) outputChatBox ( "* " .. getPlayerName ( source ) .. " Has Bought Weapon [ Usi ]", root, 255, 255, 255, true ) else outputChatBox ( "* You don't have $4000 to buy [ Usi ]", source, 255, 255, 255, true ) end end ) Link to comment
Mr.R Posted October 1, 2015 Share Posted October 1, 2015 شباب وين الخطأ انا لما اضغط الزر ما اشتغل addEvent( "Usi", true ) addEventHandler ( "Usi", root, function ( ) if ( getPlayerMoney ( source ) >= 100 ) then takePlayerMoney ( source, 100 ) giveWeapon ( source , 28, 10000 ) setPedWeaponSlot ( source, getSlotFromWeapon ( 28) ) outputChatBox ( "* " .. getPlayerName ( source ) .. " Has Bought Weapon [ Usi ]", root, 255, 255, 255, true ) else outputChatBox ( "* You don't have $4000 to buy [ Usi ]", source, 255, 255, 255, true ) end end ) مافيه خطأ , اطرح الكلينت Link to comment
ghassen14 Posted October 1, 2015 Author Share Posted October 1, 2015 client addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == GUIEditor.button[2]) then triggerServerEvent ( "Usi", localPlayer ) end end ) +اعطيني سكايبك Link to comment
GraveDigger. Posted October 1, 2015 Share Posted October 1, 2015 في سطر "2" اتأكد انك حاط اسم الزر صح Edit : و بطريقة احسن function Give() triggerServerEvent ( "Usi",localPlayer) end addEventHandler ( "onClientGUIClick",الأسم, Give, false ) Link to comment
Mr.R Posted October 1, 2015 Share Posted October 1, 2015 client addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == GUIEditor.button[2]) then triggerServerEvent ( "Usi", localPlayer ) end end ) +اعطيني سكايبك ماشوف فيه اي خطأ + تأكد من اسم الزر ادخل فالوكيند بس Httttt7.Ksa وبالنسبه للسكايب تفضل : ) 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