Ja[B]er[X]Pro Posted March 1, 2016 Share Posted March 1, 2016 السلام عليكم ورحمة الله وبركاته اين الخطأ جربته عند قتل شخص ما يعطيني الداتا ؟؟ drug = {"Weed", "God", "Speed", "LSD", "Steroids", "Heroin",} local drug = math.random(#drug) addEventHandler("onPlayerWasted",root, function(attacker) if ( getElementType ( attacker ) == "player" ) then local number = math.random(1,3) setElementData(source,drug,getElementData(source,drug,) + number) end end) Link to comment
Jupi Posted March 1, 2016 Share Posted March 1, 2016 drug = {"Weed", "God", "Speed", "LSD", "Steroids", "Heroin"} local Data = drug[math.random(#drug)] addEventHandler("onPlayerWasted",root, function(attacker) if ( getElementType ( attacker ) == "player" ) then local number = math.random(1,3) setElementData(attacker, Data, getElementData(attacker,Data) + number) end end ) Note : الكود غير مجرب Link to comment
7up2016 Posted March 1, 2016 Share Posted March 1, 2016 السلام عليكم ورحمة الله وبركاتهاين الخطأ جربته عند قتل شخص ما يعطيني الداتا ؟؟ drug = {"Weed", "God", "Speed", "LSD", "Steroids", "Heroin",} local drug = math.random(#drug) addEventHandler("onPlayerWasted",root, function(attacker) if ( getElementType ( attacker ) == "player" ) then local number = math.random(1,3) setElementData(source,drug,getElementData(source,drug,) + number) end end) الخطأ الاول صححه الاخ دابل بدل ما تحط source تحط مكانه attacker الخطا الثاني setElementData(attacker,drug,getElementData(attacker,drug,) + number) تصحيحه setElementData(attacker,drug,(getElementData(attacker,drug) or 0 ) + number) لان قد لا يكون اللاعب عنده المنت داتا فيصير خطأ فتحط or 0 في حالة ما كان في المنت داتا الخطأ الثالث في نفس السطر (attacker,drug,) حاطط فاصلة بعد كلمة drug شيلها الزبدة هذا التصحيح الكامل drug = {"Weed", "God", "Speed", "LSD", "Steroids", "Heroin",} local randomDrug = math.random(#drug) -- غيرت اسم المتغير عشان ما يتعارض مع اسم الجدول addEventHandler("onPlayerWasted",root, function(attacker) if ( getElementType ( attacker ) == "player" ) then local number = math.random(1,3) setElementData(attacker,randomDrug,(getElementData(attacker,randomDrug) or 0 ) + number) -- شلت الفاصلة واضفت احتياط لو ما كان اللاعب عنده المنت داتا يعطيه قيمة صفر end end) اسف على الاطالة Link to comment
MuhannaDx Posted March 1, 2016 Share Posted March 1, 2016 ي سفن انت حطيت المتغير randomDrug = رقم بالحظ على عدد قيم المجدول التصحيح : drug = {"Weed", "God", "Speed", "LSD", "Steroids", "Heroin",} local randomDrug = drug[math.random(#drug)] addEventHandler("onPlayerWasted",root, function(attacker) if ( getElementType ( attacker ) == "player" ) then local number = math.random(1,3) setElementData(attacker,randomDrug,(getElementData(attacker,randomDrug) or 0 ) + number) end end) Link to comment
#CroSs Posted March 1, 2016 Share Posted March 1, 2016 local Drug = ( { "Weed", "God", "Speed", "LSD", "Steroids", "Heroin" } )[math.random( 6 )] addEventHandler( "onPlayerWasted", root, function( _, Killer ) if ( Killer and Killer ~= source and getElementType( Killer ) == "player" ) then setElementData( Killer, Drug, ( getElementData( Killer, Drug ) or 0 ) + math.random( 3 ) ) end end ) Link to comment
Abdul KariM Posted March 1, 2016 Share Posted March 1, 2016 drug = {"Weed", "God", "Speed", "LSD", "Steroids", "Heroin"} local Data = drug[math.random(#drug)] addEventHandler("onPlayerWasted",root, function(attacker) if ( getElementType ( attacker ) == "player" ) then local number = math.random(1,3) setElementData(attacker, Data, getElementData(attacker,Data) + number) end end ) Note : الكود غير مجرب int totalAmmo, element killer, int killerWeapon, int bodypart, bool stealth @ 7up2016 @ MuhannaDx Parameters الاول هو الرصاص الثاني هو الاعب الي قتل كود كروس عدل Link to comment
Jupi Posted March 1, 2016 Share Posted March 1, 2016 drug = {"Weed", "God", "Speed", "LSD", "Steroids", "Heroin"} local Data = drug[math.random(#drug)] addEventHandler("onPlayerWasted",root, function(attacker) if ( getElementType ( attacker ) == "player" ) then local number = math.random(1,3) setElementData(attacker, Data, getElementData(attacker,Data) + number) end end ) Note : الكود غير مجرب int totalAmmo, element killer, int killerWeapon, int bodypart, bool stealth @ 7up2016 @ MuhannaDx Parameters الاول هو الرصاص الثاني هو الاعب الي قتل كود كروس عدل علشان كدة كتبت : غير مجرب =_= كنت حاسس ان في حاجة مش ملاحظها Link to comment
Ja[B]er[X]Pro Posted March 13, 2016 Author Share Posted March 13, 2016 اعرف الموضوع قديم لكن رفعته لان المشكلة عن الموضوع دا local Drug = ( { "Weed", "God", "Speed", "LSD", "Steroids", "Heroin" } )[math.random( 6 )] addEventHandler( "onPlayerWasted", root, function( _, Killer ) if ( Killer and Killer ~= source and getElementType( Killer ) == "player" ) then setElementData( Killer, Drug, ( getElementData( Killer, Drug ) or 0 ) + math.random( 3 ) ) end end ) المشكلة هي عند قتل شخص اول مرة تشغل به المود يعطيه داتا عشوائية لكن عندما يقتل شخص اخر يعطيه نفس الداتا ويبقى يعطيه نفس الداتا ابي يعطي داتا اخر ايضاً Link to comment
#CroSs Posted March 13, 2016 Share Posted March 13, 2016 local Drugs = { "Weed", "God", "Speed", "LSD", "Steroids", "Heroin" } addEventHandler( "onPlayerWasted", root, function( _, Killer ) if ( Killer and Killer ~= source and getElementType( Killer ) == "player" ) then local Drug = Drugs[math.random( 6 )] setElementData( Killer, Drug, ( getElementData( Killer, Drug ) or 0 ) + math.random( 3 ) ) end end ) Link to comment
Ja[B]er[X]Pro Posted March 13, 2016 Author Share Posted March 13, 2016 local Drugs = { "Weed", "God", "Speed", "LSD", "Steroids", "Heroin" } addEventHandler( "onPlayerWasted", root, function( _, Killer ) if ( Killer and Killer ~= source and getElementType( Killer ) == "player" ) then local Drug = Drugs[math.random( 6 )] setElementData( Killer, Drug, ( getElementData( Killer, Drug ) or 0 ) + math.random( 3 ) ) end end ) شكراً جداً لك لكن سؤال كيف اسوي احد انواع الداتا تيجي قليل ونوع يجي اغلب الاحيان Link to comment
Ja[B]er[X]Pro Posted March 13, 2016 Author Share Posted March 13, 2016 local Drugs = { "Weed", "God", "Speed", "LSD", "Steroids", "Heroin" } addEventHandler( "onPlayerWasted", root, function( _, Killer ) if ( Killer and Killer ~= source and getElementType( Killer ) == "player" ) then local Drug = Drugs[math.random( 6 )] setElementData( Killer, Drug, ( getElementData( Killer, Drug ) or 0 ) + math.random( 3 ) ) end end ) شكراً جداً لك لكن سؤال كيف اسوي احد انواع الداتا تيجي قليل ونوع يجي اغلب الاحيان Link to comment
#CroSs Posted March 13, 2016 Share Posted March 13, 2016 local Drugs = { "Weed", "God", "Speed", "LSD", "Steroids", "Heroin" } addEventHandler( "onPlayerWasted", root, function( _, Killer ) if ( Killer and Killer ~= source and getElementType( Killer ) == "player" ) then local Drug = Drugs[math.random( 6 )] setElementData( Killer, Drug, ( getElementData( Killer, Drug ) or 0 ) + math.random( 3 ) ) end end ) شكراً جداً لك لكن سؤال كيف اسوي احد انواع الداتا تيجي قليل ونوع يجي اغلب الاحيان اممم ممكن تسوي كذا local Drugs = { "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "Weed", "God", "Speed", "LSD", "Steroids", "Heroin" } Link to comment
Abdul KariM Posted March 13, 2016 Share Posted March 13, 2016 https://forum.multitheftauto.com/viewtopic.php?f=164&t=57985 شوف اخر كود والكلام راح يفيدك 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