Jump to content

x[مشكله]x في مهمه


Recommended Posts

السلام عليكم

المشكله : اخر لاعب يبقى مايخذ فلوس ولا ينتحر

+ ابي لما تبدا المهم الماركه تنشآل وماترجع الا بعد المهمه

+ لما احد يسحبك في المهمه او ينتقل لك مايقدر

حلو مشكلتي الاول ثمن الثنين الباقيه الفانكشنات وانا بحآول

  
  
  
aTable = {  } 
  
  
  
addEventHandler ( "onPlayerJoin",root,function() 
outputChatBox("تم بددآ المهم اذهب الى المآركه  لـدخول الى المهمه",source, 50, 30, 255) 
outputChatBox("تم تغشيل المهمه",source, 0, 150, 255) 
end) 
--------create Marker 
local WarMission = createMarker(2727.24390,-1826.40039,11.84375, "cylinder", 2, 255, 150, 250, 150) 
--------Taple 
local war = { 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375},} 
-------- Event Marker 
addEventHandler( "onMarkerHit", WarMission,function (player) 
if getElementType(player) == "player" and not isPedInVehicle(player) then 
if #aTable >= 32 then return outputChatBox ( 'العدد مكتمل لايمكنك دخول المهمه', player ) end 
local x, y, z = unpack(war[math.random(#war)]) 
setElementPosition(player, x, y, z) 
setElementModel (player, 2) 
setElementDimension ( player, 6 ) 
giveWeapon ( player, 4, 1, true ) 
giveWeapon ( player, 27, 999999, true ) 
giveWeapon ( player, 31, 999999, true ) 
giveWeapon ( player, 30, 999999, true ) 
giveWeapon ( player, 16, 2, true ) 
giveWeapon ( player, 25, 999999, true )             
toggleControl ( player, "fire", false ) 
setElementFrozen(player, true) 
if getPlayerTable ( player , aTable ) then return outputChatBox ( "انت بالمهمة الان" , player , 255 , 255 , 255 , true ) end; 
table.insert ( aTable , player ) 
setTimer ( toggleControl , 5000 , 1 , player , "fire" , true ) 
setTimer ( setElementFrozen , 5000 , 1 , player , false ) 
end 
end 
) 
  
  
 function getPlayerTable(player, Table) 
    for i, v in ipairs (Table) do 
        if (v == player) then 
            return true 
        end 
    end 
end 
  
  
buttons = { 
    ['F1'] = true, 
    ['F2'] = true, 
    ['F3'] = true, 
} 
  
addEventHandler( 'onElementClicked', root, function (button , prees) 
    if prees and getElementDimension(localPlayer) == 6 then 
        if buttons[button] then 
                 outputChatBox("غير مصرح لك بفتح اللوحة الان ", source, 255, 0, 0) 
            cancelEvent() 
        end 
    end 
end) 
  
addEventHandler( "onPlayerWasted", root, 
  
    function (  ) 
    
    if getPlayerTable ( player , aTable ) then 
     
        for i , v in ipairs ( aTable ) do 
    
    if ( v == source ) then 
  
    table.remove ( aTable , i ); 
  
    end 
        
    if ( #aTable == 1 ) then 
    
    player = aTable [ 1 ] 
    
    givePlayerMoney ( player , 9999 ) 
   
   killPed (player) 
  
           
           end 
        end 
    end 
end 
  
    ) 
  
  
addEventHandler( "onPlayerQuit", root, 
 function() 
  
    if getPlayerTable ( player , aTable ) then 
     
        for i , v in ipairs ( aTable ) do 
    
    if ( v == source ) then 
  
    table.remove ( aTable , i ); 
  
    end 
        
    if ( #aTable == 1 ) then  
    
    player = aTable [ 1 ]  killPed ( player ) 
    
    givePlayerMoney ( player , 9999 ) 
  
            end 
        end 
    end 
end 
 ) 
  
  
function dPlayers(player) 
  
    if getPlayerTable ( player , aTable ) then 
     
        for i , v in ipairs ( aTable ) do 
    
    if ( v == source ) then 
     
     if ( #aTable == 1 ) then  
      
    killPed ( player ) 
     
    givePlayerMoney ( player , 9999 ) 
     
    table.remove ( aTable , i ); 
  
    
    end 
    end 
    end 
    end 
    end 

Link to comment

كودك معفوس وعندك اخطاء بالجمله.

وبعد ما تنتهي المهمه سوي الماركر مره ثانيه destroyElement عشان تحذف الماركر استخدم

وعشان ما تخلي احد يسحبه او ينتقل له لازم تسوي للاعب اللي دخل المهمه داتا, واذا جا احد ينتقل له او يسحبه يتحقق لو عنده داتا ما يقدر ينتقل له او يسحبه.

Link to comment
  • Moderators
buttons = { 
    ['F1'] = true, 
    ['F2'] = true, 
    ['F3'] = true, 
} 
  
addEventHandler( 'onElementClicked', root, function (button , prees) 
    if prees and getElementDimension(localPlayer) == 6 then 
        if buttons[button] then 
                 outputChatBox("غير مصرح لك بفتح اللوحة الان ", source, 255, 0, 0) 
            cancelEvent() 
        end 
    end 

ملاحظة : هالكود ماراح يمنع الازرار من العمل , لأن وظيفة هالحدث عكس ما تعتقد

فـ يجب إستخدام الحدث

onClientKey

Link to comment
buttons = { 
    ['F1'] = true, 
    ['F2'] = true, 
    ['F3'] = true, 
} 
  
addEventHandler( 'onElementClicked', root, function (button , prees) 
    if prees and getElementDimension(localPlayer) == 6 then 
        if buttons[button] then 
                 outputChatBox("غير مصرح لك بفتح اللوحة الان ", source, 255, 0, 0) 
            cancelEvent() 
        end 
    end 

ملاحظة : هالكود ماراح يمنع الازرار من العمل , لأن وظيفة هالحدث عكس ما تعتقد

فـ يجب إستخدام الحدث

onClientKey

الكود اصلن خطاء شوف

كيف لوكل بلاير في تحقق من الدايمنشن و في الأوت بوت شات حاطت سورس ؟

+ حدث onElementClicked

button, state, player, x, y, z

دي Parameters

بتاعو من وين جاين

button , prees

Link to comment

عندك اخطاء كثير وذكروا بعضها الشباب فوق ^

عدلت لك الكود واختصرت لك بعض الأشياء :

-- Client Side # 
local buttons = { 
    ['F1'] = true, 
    ['F2'] = true, 
    ['F3'] = true, 
} 
  
addEventHandler( 'onClientKey', root, function (button , press) 
    if press and getElementDimension(localPlayer) == 6 then 
        if buttons[button] then 
            outputChatBox("غير مصرح لك بفتح اللوحة الان ", 255, 0, 0) 
                cancelEvent() 
        end 
    end 
end) 

-- Server Side # 
local aTable = {  } 
  
local weps = { { 4, 2 }, { 27, 999999 }, { 30, 999999 }, { 31, 999999 }, { 16, 4 }, { 25, 999999 } } 
  
  
local war = { 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375}, 
{2485.00000,-1667.00000,13.34375},} 
  
    
function getPlayerTable(player, Table) 
    for i, v in ipairs (Table) do 
        if (v == player) then 
            return true 
        end 
    end 
end 
  
  
local WarMission = createMarker(2727.24390,-1826.40039,11.84375, "cylinder", 2, 255, 150, 250, 150) 
  
addEventHandler ( "onPlayerJoin",root,function() 
    outputChatBox("تم بددآ المهم اذهب الى المآركه  لـدخول الى المهمه",source, 50, 30, 255) 
    outputChatBox("تم تغشيل المهمه",source, 0, 150, 255) 
end) 
  
  
addEventHandler( "onMarkerHit", WarMission,function (player) 
    if getElementType(player) == "player" and not isPedInVehicle(player) then 
    if #aTable >= 32 then return outputChatBox ( 'العدد مكتمل لايمكنك دخول المهمه', player ) end 
    if getPlayerTable ( player , aTable ) then return outputChatBox ( "انت بالمهمة الان" , player , 255 , 255 , 255 , true ) end 
        local x, y, z = unpack( war [ math.random( #war ) ] ) 
            setElementPosition( player, x, y, z) 
                setElementModel ( player, 2) 
                    setElementDimension ( player, 6 ) 
                        for i = 1, #weps do 
                            giveWeapon ( player, weps [ i ] [ 1 ], weps [ i ] [ 2 ] ) 
                    end 
                        toggleControl ( player, 'fire', false ) 
                            setElementFrozen( player, true ) 
                                table.insert ( aTable , player ) 
                                    setTimer ( toggleControl , 5000 , 1 , player , 'fire' , true ) 
                                        setTimer ( setElementFrozen, 5000, 1, player, false ) 
        end 
    end 
) 
  
  
addEventHandler( 'onPlayerWasted', root, function (  ) 
    if getPlayerTable ( source , aTable ) then 
        for k,v in ipairs ( aTable ) do 
            if ( v == source ) then 
                if #aTable == 1  then 
                    givePlayerMoney ( aTable [ 1 ] , 9999 ) 
                        killPed ( aTable [ 1 ] ) 
                        end 
                table.remove ( aTable , i ); 
                    break 
                end 
            end 
        end 
    end 
) 
  
  
addEventHandler( 'onPlayerQuit', root, function() 
    if getPlayerTable ( source , aTable ) then 
        for k,v in ipairs ( aTable ) do 
            if ( v == source ) then 
                table.remove ( aTable , i ); 
                    break 
                end 
            end 
        end 
    end 
) 
Edited by Guest
Link to comment

لما انا وواحد ندخل المهم و اقتله مايديني كيل بيد و فلوس

غريبها

ليه

+ ترى كود اختصار الاسلحه بي جدول مايطعي الاسلحه غير شلت الاختاصر و رديت الاسله مثل اول

+ مشكور اخي شآطح

Link to comment
غير معرفه, صححت لك الكود plr صحيح, عندي خطأ بالوظيفه وهي

كان عندي خطأ اللي هو اني ما حطيت التحقق داخل اللوب , عدلت الكود انسخه مره ثانيه.

نفس الشيء لو دخلت المهم انا و خويي و قتلت خويي مايجي كيل بد ولا يدوني فلوس

+

ابي لو بعد 1 دقيقه المهم فيه 1

يسوي له كيل بيد

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...