kamel10 Posted July 7, 2014 Share Posted July 7, 2014 انا سويت لما تاخذ شيئ تاخذ فلوس و سلاح عشوائي بس ما اعرف كيف احدد كم رصاص لكل سلاح Link to comment
Quited Posted July 7, 2014 Share Posted July 7, 2014 (edited) -- استخدم الوظيفة لتحديد الرصاص setWeaponProperty giveWeapon Edited July 7, 2014 by Guest Link to comment
Max+ Posted July 7, 2014 Share Posted July 7, 2014 البندر خطا , Event : 'onPlayerSpawn' getPedTotalAmmo + giveWeapon مافيه امر يعطيك رصاص , لازم تستعمل تيبل , وتستخدم الامر اعطاء السلاح بعد ماتعرف الامر getPedTotalAmmo , Link to comment
kamel10 Posted July 7, 2014 Author Share Posted July 7, 2014 (edited) local idweapon = { 35, 38, 16 } function createBag() local random = math.random ( #mbag ) local x, y, z = mbag[random][1], mbag[random][2], mbag[random][3] bag = createPickup( x, y, z, 3, 1550 ) setElementCollisionsEnabled( bag, false ) bl = createBlipAttachedTo(bag,37) exports.guimessages:outputServer(root,"A Mystery Bag has Spawned get it", 0, 255, 0 ) end addEventHandler("onResourceStart", resourceRoot,createBag) addEventHandler("onPickupHit",root, function ( player ) if ( source ~= bag ) then return end if ( isPedInVehicle( player ) ) then return end destroyElement( bag ) destroyElement( bl ) randomMoney = math.random ( 10000, 20000 ) setElementData(player, "Money", (getElementData(player, "Money") or 0) + randomMoney) giveWeapon (player, idweapon[math.random(#idweapon)] ) exports.guimessages:outputServer(player, "You find #FF0000$" .. tostring(randomMoney) .." #C12267And #0000FFWeapon", 0, 250, 0) setTimer( createBag, 90000, 1 ) end ) انا مسوي كدة edit: كيف اعطي رصاص لكل سلاح Edited July 7, 2014 by Guest Link to comment
al-Kobra Posted July 7, 2014 Share Posted July 7, 2014 بعد ارقمنت السلاح ,, في ارقمنت الرصاص Link to comment
kamel10 Posted July 7, 2014 Author Share Posted July 7, 2014 الحين سويت ارقمنت ل الرصاص الحين وش اسوي local idweapon = { 35, 38, 16 } local ammo = { 3, 500, 5 } function createBag() local random = math.random ( #mbag ) local x, y, z = mbag[random][1], mbag[random][2], mbag[random][3] bag = createPickup( x, y, z, 3, 1550 ) setElementCollisionsEnabled( bag, false ) bl = createBlipAttachedTo(bag,37) exports.guimessages:outputServer(root,"A Mystery Bag has Spawned get it", 0, 255, 0 ) end addEventHandler("onResourceStart", resourceRoot,createBag) addEventHandler("onPickupHit",root, function ( player ) if ( source ~= bag ) then return end if ( isPedInVehicle( player ) ) then return end destroyElement( bag ) destroyElement( bl ) randomMoney = math.random ( 10000, 20000 ) setElementData(player, "Money", (getElementData(player, "Money") or 0) + randomMoney) giveWeapon (player, idweapon[math.random(#idweapon)] ) exports.guimessages:outputServer(player, "You find #FF0000$" .. tostring(randomMoney) .." #C12267And #0000FFWeapon", 0, 250, 0) setTimer( createBag, 90000, 1 ) end ) Link to comment
al-Kobra Posted July 7, 2014 Share Posted July 7, 2014 جرب بدل هذا giveWeapon (player, idweapon[math.random(#idweapon)] ) الى هذا giveWeapon (player, unpack(idweapon[math.random(#idweapon)]), unpack(ammo[math.random(#ammo)] )) Link to comment
kamel10 Posted July 7, 2014 Author Share Posted July 7, 2014 (edited) اوك بجرب .. ابي اسوي لما اخذ الاستفهام يظهر فوق السلاح الي اخذته انا حاط كدة exports.guimessages:outputServer(player, "You find #FF0000$" .. tostring(randomMoney) .." #C12267And #0000FFWeapon", 0, 250, 0) edit: ابي اسوي بدل كلمة weapon اسم السلاح edit #2: الحين ما يعطيني لا سلاح ولا رصاص Edited July 7, 2014 by Guest Link to comment
Tete omar Posted July 7, 2014 Share Posted July 7, 2014 kamel10 تجنب المشاركات المزدوجة ينقل إلى قسم البرمجة Link to comment
فاّرس Posted July 7, 2014 Share Posted July 7, 2014 تفضل هذا مثال : -- Server Side # weapons = { -- { id, ammo }, { 35, 100 }, { 16, 200 }, { 38, 300 } } addCommandHandler( 'randomWeapons', function ( plr ) local random = weapons[math.random(#weapons)] giveWeapon ( plr, random[1], random[2] ) end ) Link to comment
Max+ Posted July 7, 2014 Share Posted July 7, 2014 تفضل هذا مثال : -- Server Side # weapons = { -- { id, ammo }, { 35, 100 }, { 16, 200 }, { 38, 300 } } addCommandHandler( 'randomWeapons', function ( plr ) local random = weapons[math.random(#weapons)] giveWeapon ( plr, random[1], random[2] ) end ) giveWeapon ( plr, random[1], random[2] ) مو المفروض تحطهم 3 قيم ؟ لان عندك 3 تيبلات ؟ giveWeapon ( plr, random[1], random[2], random[3] ) Link to comment
#DRAGON!FIRE Posted July 7, 2014 Share Posted July 7, 2014 تفضل هذا مثال : -- Server Side # weapons = { -- { id, ammo }, { 35, 100 }, { 16, 200 }, { 38, 300 } } addCommandHandler( 'randomWeapons', function ( plr ) local random = weapons[math.random(#weapons)] giveWeapon ( plr, random[1], random[2] ) end ) giveWeapon ( plr, random[1], random[2] ) مو المفروض تحطهم 3 قيم ؟ لان عندك 3 تيبلات ؟ giveWeapon ( plr, random[1], random[2], random[3] ) من وين القيمة الثالثة ؟ و giveWeapon 3 ارقمنات انت 4 هو سوا زي كذا weapons[2][1], weapons[2][2] = 16, 200 Link to comment
Max+ Posted July 7, 2014 Share Posted July 7, 2014 طيب انت جبت القيمة الاولى والثانية صح ؟ طيب وذي { 38, 300 } والله التيبلات ماعرف بها , + هو مستخدم زي كذا random[1], random[2] بس ماستخدم random[1][2], random[2][1] Link to comment
#DRAGON!FIRE Posted July 7, 2014 Share Posted July 7, 2014 طيب انت جبت القيمة الاولى والثانية صح ؟ طيب وذي { 38, 300 } والله التيبلات ماعرف بها , + هو مستخدم زي كذا random[1], random[2] بس ماستخدم random[1][2], random[2][1] انا جبت القيمة الاولة والثانية من المفتاح الثاني هو مسوي كذا local random = weapons[math.random(#weapons)] فالفنترض الراندوم جا ع رقم 2 صار local random = weapons[2] الحين المفتاح الثاني صار بيجي يسوي كذا random[1], random[2] هو كذا مسويها يعني كانه سوا كذا weapons[2][1], weapons[2][2] Link to comment
kamel10 Posted July 7, 2014 Author Share Posted July 7, 2014 واخييييرا اشغل شكرااااااا والان عندي طلب اخير يعني ابي اغير كلمة weapon الى السلاح الذي حصل عليه exports.guimessages:outputServer(player, "You find #FF0000$" .. tostring(randomMoney) .." #C12267And #0000FFWeapon", 0, 250, 0) Link to comment
#DRAGON!FIRE Posted July 7, 2014 Share Posted July 7, 2014 اطرح كودكـ كامل او يوم تعطيه السلاح Link to comment
kamel10 Posted July 7, 2014 Author Share Posted July 7, 2014 local mbag = { {1125.1999511719, -2037.1999511719, 69.300003051758}, {1682.3000488281, -2290.1000976563, -1.7999999523163}, {1883.1999511719, -1991.4000244141, 13.199999809265}, {2799.6999511719, -2417.3000488281, 13.300000190735}, {2896.3999023438, -1960.6999511719, 4}, {406.39999389648, -1539.9000244141, 31.700000762939}, {1083.5, -683.5, 113.80000305176}, {613.09997558594, -607.70001220703, 17}, {2476.6000976563, -945.5, 80.300003051758}, {2564, -118, 51.799999237061}, {1726.5999755859, -1880.4000244141, 13.699999809265}, {154.30000305176, -1942.4000244141, 3.4000000953674}, {815.20001220703, -1094.5, 25.39999961853}, {1742.6999511719, -1562.1999511719, 13.800000190735}, {2141.1999511719, -2262.6000976563, 12.89999961853}, {991.29998779297, -1525.1999511719, 13.5}, {-100.90000152588, -1567.8000488281, 2.5999999046326}, {2809.8999023438, -1182, 24.5}, {1819.4000244141, -1142.6999511719, 23.700000762939}, {2520.1999511719, -1487, 23.60000038147}, {2337.3999023438, -1245.4000244141, 22.10000038147}, {320.29998779297, -1328.8000488281, 14.39999961853}, {1154.0999755859, -1879.9000244141, 13.199999809265}, {1792.5, -2302.6999511719, -2.7000000476837}, {829.29998779297, -923.09997558594, 54.900001525879}, {561.29998779297, -1359.0999755859, 14.800000190735}, {1899, -1992.5, 13.300000190735}, {1881.5999755859, -1313.4000244141, 14.39999961853}, {538.90002441406, -1318.9000244141, 17.200000762939}, {784.5, -1734.9000244141, 13.199999809265} } weapons = { { 35, 3 }, { 16, 5 }, { 38, 500 } } function createBag() local random = math.random ( #mbag ) local x, y, z = mbag[random][1], mbag[random][2], mbag[random][3] bag = createPickup( x, y, z, 3, 1550 ) setElementCollisionsEnabled( bag, false ) bl = createBlipAttachedTo(bag,37) exports.guimessages:outputServer(root,"A Mystery Bag has Spawned get it", 0, 255, 0 ) end addEventHandler("onResourceStart", resourceRoot,createBag) addEventHandler("onPickupHit",root, function ( player ) if ( source ~= bag ) then return end if ( isPedInVehicle( player ) ) then return end destroyElement( bag ) destroyElement( bl ) randomMoney = math.random ( 10000, 20000 ) setElementData(player, "Money", (getElementData(player, "Money") or 0) + randomMoney) local random = weapons[math.random(#weapons)] giveWeapon (player, random[1], random[2] ) exports.guimessages:outputServer(player, "You find #FF0000$" .. tostring(randomMoney) .." #C12267And #0000FFWeapon", 0, 250, 0) setTimer( createBag, 90000, 1 ) end ) Link to comment
فاّرس Posted July 7, 2014 Share Posted July 7, 2014 تقصد تبي تجيب اسم السلاح؟ getWeaponNameFromID تقدر تستخدم Link to comment
kamel10 Posted July 7, 2014 Author Share Posted July 7, 2014 تقدر تسويها على المود وترسلي الكود Link to comment
فاّرس Posted July 7, 2014 Share Posted July 7, 2014 عدل سطر 64 في الكود الي فوق , وحط بداله : exports.guimessages:outputServer(player, "You find #FF0000$" .. tostring(randomMoney) .." #C12267And #0000FF ".. getWeaponNameFromID ( random[1] ), 0, 250, 0) Link to comment
kamel10 Posted July 7, 2014 Author Share Posted July 7, 2014 كفوو اشتغل الحين ابي اخر طلب لما ياخذ الاستفهام يظهر اسم اللاعب و وش اخذ بس سويتها مدري ليش ما اشتغلت لو تشوفون فين الخطأ addEventHandler("onPickupHit",root, function ( player ) if ( source ~= bag ) then return end if ( isPedInVehicle( player ) ) then return end destroyElement( bag ) ) destroyElement( bl ) randomMoney = math.random ( 10000, 20000 ) setElementData(player, "Money", (getElementData(player, "Money") or 0) + randomMoney) local random = weapons[math.random(#weapons)] giveWeapon (player, random[1], random[2] ) exports.guimessages:outputServer(player, "You find #FF0000$" .. tostring(randomMoney) .." #C12267And #0000FF ".. getWeaponNameFromID ( random[1] ), 0, 250, 0) exports.guimessages:outputServer(root, "".. getPlayerName .." Has Get From Mystery Bag #FF0000$" .. tostring(randomMoney) .." #C12267And #0000FF ".. getWeaponNameFromID ( random[1] ), 0, 250, 0) MysteryTime = setTimer( createBag, 300000, 1 ) end Link to comment
#DRAGON!FIRE Posted July 7, 2014 Share Posted July 7, 2014 استبدل سطر 16 الى .. : exports.guimessages:outputServer(root, ""..getPlayerName( player ).." Has Get From Mystery Bag #FF0000$" .. tostring(randomMoney) .." #C12267And #0000FF ".. getWeaponNameFromID ( random[1] ), 0, 250, 0) Link to comment
kamel10 Posted July 7, 2014 Author Share Posted July 7, 2014 الحين ما شتغل المود اصلا Link to comment
Max+ Posted July 7, 2014 Share Posted July 7, 2014 في اخطاء بالسكربت ماقفلته , جرب الحين , addEventHandler("onPickupHit",root, function ( player ) if ( source ~= bag ) then return end if ( isPedInVehicle( player ) ) then return end destroyElement( bag ) destroyElement( bl ) randomMoney = math.random ( 10000, 20000 ) setElementData(player, "Money", (getElementData(player, "Money") or 0) + randomMoney) local random = weapons[math.random(#weapons)] giveWeapon (player, random[1], random[2] ) exports.guimessages:outputServer(player, "You find #FF0000$" .. tostring(randomMoney) .." #C12267And #0000FF ".. getWeaponNameFromID ( random[1] ), 0, 250, 0) exports.guimessages:outputServer(root, ""..getPlayerName( player ).." Has Get From Mystery Bag #FF0000$" .. tostring(randomMoney) .." #C12267And #0000FF ".. getWeaponNameFromID ( random[1] ), 0, 250, 0) MysteryTime = setTimer( createBag, 300000, 1 ) end ) Link to comment
Recommended Posts