Jump to content

تصحيح كود


Recommended Posts

السلام عليكم و رحمة الله و بركاته

اليوم شفت مود مهمة البنك حقت جعفر

بس هي حقت حرب عصابات يعني شرطة ضد التيمات الباقية

اليوم حبيت احولها لهجولة

بس فشلت :mrgreen:

قلت اسال الحلويين اللي في المنتدي

المود مب من تصميمي ابي بس اخليه للهجولة عشان كثر طلبوه :D

بيه اللي يدخل الماركر الازرق عادي و اللي يدخل الماركر الاحمر عادي

يعني مب لازم يكون في تيم الشرطة

الاكواد

pRectangleBank   = createColRectangle ( 280.923828125, 50.7724609375, 300, 300 ) 
Bank             = {  
Marker           = {  }; 
Object           = {  }; 
}; 
  
  Bank.Marker[1] = createMarker ( 1467.2578125, -1010.4534912109, 27.84375, "arrow", 1.5, 255, 0, 0, 170 ) 
  createBlipAttachedTo ( Bank.Marker[1], 52 ) 
  Bank.Marker[2] = createMarker ( 390.21240234375, 173.71008300781, 1009.3828125, "arrow", 1.5, 0, 0, 255, 170 ) 
  setElementInterior ( Bank.Marker[2], 3 ) 
  Bank.Marker[3] = createMarker ( 1457.099609375, -1010.7734375, 27.84375, "arrow", 1.5, 0, 0, 255, 170 ) 
  Bank.Object[1] = createObject ( 828, 371.8720703125, 167.3662109375, 1008.3828125 ) 
  setElementInterior ( Bank.Object[1], 3 ) 
  setElementAlpha ( Bank.Object[1], 0 )  
   
   
function MarkerHit ( player ) 
   if source == Bank.Marker[1] then 
    if player == localPlayer then 
      if getPlayerTeam ( player ) ~= getTeamFromName ( 'Police' ) then 
        if getElementData ( resourceRoot, "BankTime" ) ~= 0 then 
                 outputChatBox ( "[ بقى على مهمة البنك ".. getElementData ( resourceRoot,"BankTime" ) .." ثانية ]", 255, 0, 0, true ) 
        end 
        if getElementData ( resourceRoot, "BankTime" ) <= 100 and getElementData ( resourceRoot, "BankTime" ) >= 1 then 
                 triggerServerEvent ( "BankMission-Join", localPlayer, "Rebel" ) 
                 addEventHandler ( "onClientRender", root, Draw ) 
           end 
        if getElementData ( resourceRoot, "BankTime" ) == 0 then 
                 outputChatBox ( "[ بقى على انتهاء مهمة البنك".. getElementData ( resourceRoot,"TimeOfMission" ) .." ثانية ]", 255, 0, 0, true ) 
         end 
       end               
     end 
   end 
 end 
addEventHandler ( "onClientMarkerHit", root, MarkerHit ) 
  
function MarkerHit2 ( player ) 
   if source == Bank.Marker[2] then 
    if player == localPlayer then 
                 triggerServerEvent ( "BankMission-Out", player ) 
                 removeEventHandler ( "onClientRender", root, Draw )                 
     end 
   end 
 end 
addEventHandler ( "onClientMarkerHit", root, MarkerHit2 ) 
  
function MarkerHit3 ( player ) 
   if source == Bank.Marker[3] then 
     if player == localPlayer then 
       if getPlayerTeam ( player ) and getPlayerTeam ( player ) == getTeamFromName ( 'Police' ) then 
          if getElementData ( resourceRoot, "BankTime" ) ~= 0 then 
                 outputChatBox ( "[ بقى على مهمة البنك ".. getElementData ( resourceRoot,"BankTime" ) .." ثانية ]", 255, 0, 0, true ) 
            end 
              if getElementData ( resourceRoot, "BankTime" ) <= 100 and getElementData ( resourceRoot, "BankTime" ) >= 1 or getElementData ( resourceRoot, "BankTime" ) == 0 then 
                 triggerServerEvent ( "BankMission-Join", localPlayer, "Police" )  
                 addEventHandler ( "onClientRender", root, Draw ) 
                 outputChatBox ( "هذه المنطقة خاصة بالشرطة", 255, 0, 0, true ) 
           end 
         end 
      end 
   else 
  end                
end 
addEventHandler ( "onClientMarkerHit", root, MarkerHit3 ) 
   
  
addCommandHandler ( "banktime", function (  ) 
    if getElementData ( resourceRoot, "BankTime" ) ~= 0 then 
      outputChatBox ( "[ بقى على مهمة البنك ".. getElementData( resourceRoot, "BankTime" ) .." ثانية ]", 255, 0, 0, true ) 
    else 
      outputChatBox ( "[ بقى على انتهاء مهمة البنك".. getElementData ( resourceRoot, "TimeOfMission" ) .." ثانية ]", 255, 0, 0, true ) 
  end 
end 
) 
  
addEvent ( "BankMission-ShowText", true ) 
addEventHandler ( "BankMission-ShowText", root, function (  ) 
addEventHandler ( "onClientRender", root, Draw ) 
end 
) 
  
addEvent ( "BankMission-Remove", true ) 
addEventHandler ( "BankMission-Remove", root, function (  ) 
removeEventHandler ( "onClientRender", root, Draw ) 
end 
) 
  
addEvent ( "BankMission-DestroyObjectClient", true ) 
addEventHandler ( "BankMission-DestroyObjectClient", root, function (  ) 
      destroyElement ( Bank.Object[1] ) 
end 
) 
     
function onClientHit ( player ) 
   if player == localPlayer then 
      addEventHandler ( "onClientRender", root, Draw ) 
    end 
end 
addEventHandler ( "onClientColShapeHit", pRectangleBank, onClientHit ) 
  
function onClientLeave ( player ) 
   if player == localPlayer then 
      removeEventHandler ( "onClientRender", root, Draw ) 
    end 
end 
addEventHandler ( "onClientColShapeLeave", pRectangleBank, onClientLeave ) 
  
local screenWidth, screenHeight = guiGetScreenSize ( ) 
  
Draw = function (  ) 
        local pTable = fromJSON ( getElementData ( resourceRoot, "PlayersCount" ) ) 
        local rTable = fromJSON ( getElementData ( resourceRoot, "RebelCount" ) ) 
        local ppTable = fromJSON ( getElementData ( resourceRoot, "PoliceCount" ) ) 
        dxDrawText ( "Time : ".. getElementData ( resourceRoot, "TimeOfMission" ), screenWidth - 200, ( screenHeight / 2 ) - 300, 772, 323, tocolor(255, 0, 0, 255), 2, "default", "center", "center", false, false, true, false, false ) 
        if pTable and #pTable ~= 0 then 
        dxDrawText ( "All Players In Bank : ".. #pTable, screenWidth - 250, ( screenHeight / 2 ) - 230, 772, 323, tocolor(255, 0, 0, 255), 2, "default", "center", "center", false, false, true, false, false ) 
        else 
        dxDrawText ( "All Players In Bank : 0 ", screenWidth - 250, ( screenHeight / 2 ) - 230, 772, 323, tocolor(255, 0, 0, 255), 2, "default", "center", "center", false, false, true, false, false ) 
        end 
        if rTable and #rTable ~= 0 then 
        dxDrawText ( "Rebel In Bank : ".. #rTable, screenWidth - 200, ( screenHeight / 2 ) - 150, 772, 323, tocolor(255, 0, 0, 255), 2, "default", "center", "center", false, false, true, false, false ) 
        else 
        dxDrawText ( "Rebel In Bank : 0 ", screenWidth - 200, ( screenHeight / 2 ) - 150, 772, 323, tocolor(255, 0, 0, 255), 2, "default", "center", "center", false, false, true, false, false ) 
        end 
        if ppTable and #ppTable ~= 0 then 
        dxDrawText ( "Police In Bank : ".. #ppTable, screenWidth - 200, ( screenHeight / 2 ) - 100, 772, 370, tocolor(255, 0, 0, 255), 2, "default", "center", "center", false, false, true, false, false ) 
        else 
        dxDrawText ( "Police In Bank : 0 ", screenWidth - 200, ( screenHeight / 2 ) - 100, 772, 370, tocolor(255, 0, 0, 255), 2, "default", "center", "center", false, false, true, false, false ) 
        end 
        dxDrawText ( "Count Bag : ".. getElementData ( resourceRoot, "countBag" ).." / 10 ", screenWidth - 200, ( screenHeight / 2 ) - 50, 772, 419, tocolor(255, 0, 0, 255), 2, "default", "center", "center", false, false, true, false, false ) 
end 

سيرفر

  
Count                 = get ( "BankTime" )
Num                   = get ( "TimeOfMission" )
pRectangleBank        = createColRectangle ( 280.923828125, 50.7724609375, 300, 300 )
PlayersTable          = {  };
RebelTable            = {  };
PoliceTable           = {  };
Bank                  = {
Marker                = {  };
Bag                   = {  };
}
    Bank.Marker[1]    = createMarker ( 319.1416015625, 160.07421875, 1014.1796875, "cylinder", 1.5, 0, 0, 0, 0 )
    Bank.Marker[2]    = createMarker ( 349.8671875, 193.91796875, 1019.984375, "cylinder", 1.5, 0, 0, 0, 0 )
    Bank.Marker[3]    = createMarker ( 363.025390625, 151.12109375, 1025.7963867188, "cylinder", 1.5, 0, 0, 0, 0 )
    Bank.Marker[4]    = createMarker ( 346.615234375, 163.1181640625, 1014.1875, "cylinder", 1.5, 0, 0, 0, 0 )
    Bank.Marker[5]    = createMarker ( 366.3583984375, 193.41015625, 1019.984375, "cylinder", 1.5, 0, 0, 0, 0 )
    Bank.Marker[6]    = createMarker ( 356.443359375, 173.591796875, 1025.7890625, "cylinder", 1.5, 0, 0, 0, 0 )
    Bank.Marker[7]    = createMarker ( 365.0673828125, 158.2744140625, 1014.1875, "cylinder", 1.5, 0, 0, 0, 0 )
    Bank.Marker[8]    = createMarker ( 348.42614746094, 162.26203918457, 1025.7890625, "cylinder", 1.5, 0, 0, 0, 0 )
    Bank.Marker[9]    = createMarker ( 355.79351806641, 167.87002563477, 1019.9912109375, "cylinder", 1.5, 0, 0, 0, 0 )
    Bank.Marker[10]   = createMarker ( 328.75942993164, 153.52079772949, 1014.1875, "cylinder", 1.5, 0, 0, 0, 0 )
 
    setElementData ( resourceRoot, "BankTime", Count )
    setElementData ( resourceRoot, "TimeOfMission", Num )
    setElementData ( resourceRoot, "PlayersCount", toJSON ( PlayersTable ) )
    setElementData ( resourceRoot, "RebelCount", toJSON ( RebelTable ) )
    setElementData ( resourceRoot, "PoliceCount", toJSON ( PoliceTable ) )
    setElementData ( resourceRoot, "countBag", 0 )
 
setTimer ( function (  )
    local playerInColShape = getElementsWithinColShape ( pRectangleBank, "player" )
    for _, player in ipairs ( playerInColShape ) do
    if getPlayerTeam ( player ) ~= getTeamFromName ( 'Police' ) then
    table.insert ( RebelTable, { name = getPlayerName ( player ) } )
    setElementData ( resourceRoot, "RebelCount", toJSON ( RebelTable ) )
    else
    table.insert ( PoliceTable, { name = getPlayerName ( player ) } )
    setElementData ( resourceRoot, "PoliceCount", toJSON ( PoliceTable ) ) 
    end
    table.insert ( PlayersTable, { name = getPlayerName ( player ) } )
    setElementData ( resourceRoot, "PlayersCount", toJSON ( PlayersTable ) )
    triggerClientEvent ( player, "BankMission-ShowText", player )
  end
end, 1000
, 1
)
 
for i, v in ipairs ( Bank.Marker ) do
    setElementInterior ( v, 3 )
end
 
 
 
function TimerCount (  )
    Count = Count - 1
    setElementData ( resourceRoot, "BankTime", Count )
    if Count <= 0 then
        if isTimer ( Timer ) then killTimer ( Timer ) end
        Count = 0
    end
end
Timer = setTimer ( TimerCount, 1000, 0 )
 
TimerBankStart = function (  )
    Num = Num - 1
    setElementData ( resourceRoot, "TimeOfMission", Num )
    if Num <= 0 then
        if isTimer ( TimerInBank ) then killTimer ( TimerInBank ) end
        setElementData ( resourceRoot, "TimeOfMission", 0 )
        triggerEvent ( "BankMission-BankEnd", root )
        Num = 0
    end
end
 
Re22 = setTimer (
    function ( )
    if getElementData ( resourceRoot, "BankTime" ) == 0 then
    if isTimer ( Re22 ) then killTimer ( Re22 ) end
    TimerInBank = setTimer ( TimerBankStart, 1000, 0 )
    triggerEvent ( "BankMission-StartBag", root )
    triggerClientEvent ( "BankMission-DestroyObjectClient", root )
    outputChatBox ( "*********************************", root, 130, 127, 124, true )
    outputChatBox ( "لقد بدأت مهمة البنك !", root, 130, 127, 124, true )
    outputChatBox ( "بإمكان الشرطة الدخول فقط الآن", root, 130, 127, 124, true )
    outputChatBox ( "*********************************", root, 130, 127, 124, true )
      end
    end, 1000, 0 )
 
 
Re = setTimer (
    function ( )
    if getElementData ( resourceRoot, "BankTime" ) == 100 then
    if isTimer ( Re ) then killTimer ( Re ) end
      outputChatBox ( "*********************************", root, 130, 127, 124, true )
      outputChatBox ( "ستبدأ مهمة البنك بعد 100 ثانية", root, 130, 127, 124, true )
      outputChatBox ( "على العصابات والشرطة الذهاب للبنك حالاً", root, 130, 127, 124, true )
      outputChatBox ( "*********************************", root, 130, 127, 124, true )
      end
    end, 1000, 0 )
   
addEvent ( "BankMission-StartBag", true )
addEventHandler ( "BankMission-StartBag", root, function (  )
      Bank.Bag[1] = createObject ( 1550, 319.1416015625, 160.07421875, 1014.1796875 )
      setElementInterior ( Bank.Bag[1], 3 )
      addEventHandler ( "onMarkerHit", Bank.Marker[1], MoneyBag1 )
end
)
 
   
MoneyBag1 = function ( player )
        local _, _, Pz = getElementPosition ( player )
        local _, _, Mz = getElementPosition ( source )
        if Mz == Pz then
        destroyElement( Bank.Bag[1] )
        givePlayerMoney ( player, 5000 )
        outputChatBox ( "[" .. getPlayerName( player ) .. "]: لقد حصل على حقيبة !", root, 255, 0, 0, true )
        outputChatBox ( "#ffff00[1/10]", root, 255, 0, 0, true )
        setElementData ( resourceRoot, "countBag", 1 )
        Bank.Bag[2] = createObject ( 1550, 349.8671875, 193.91796875, 1019.984375 )
        setElementInterior ( Bank.Bag[2], 3 )
        removeEventHandler( "onMarkerHit", Bank.Marker[1], MoneyBag1 )
        addEventHandler ( "onMarkerHit", Bank.Marker[2], MoneyBag2 )
    end
end
 
MoneyBag2 = function ( player )
        local _, _, Pz = getElementPosition ( player )
        local _, _, Mz = getElementPosition ( source )
        if Mz == Pz then
        destroyElement( Bank.Bag[2] )
        givePlayerMoney ( player, 5000 )
        outputChatBox ( "[" .. getPlayerName( player ) .. "]: لقد حصل على حقيبة !", root, 255, 0, 0, true )
        outputChatBox ( "#ffff00[2/10]", root, 255, 0, 0, true )
        setElementData ( resourceRoot, "countBag", 2 )
        Bank.Bag[3] = createObject ( 1550, 363.025390625, 151.12109375, 1025.7963867188 )
        setElementInterior ( Bank.Bag[3], 3 )
        removeEventHandler( "onMarkerHit", Bank.Marker[2], MoneyBag2 )
        addEventHandler ( "onMarkerHit", Bank.Marker[3], MoneyBag3 )
    end
end
   
MoneyBag3 = function ( player )
        local _, _, Pz = getElementPosition ( player )
        local _, _, Mz = getElementPosition ( source )
        if Mz == Pz then
        destroyElement( Bank.Bag[3] )
        givePlayerMoney ( player, 5000 )
        outputChatBox ( "[" .. getPlayerName( player ) .. "]: لقد حصل على حقيبة !", root, 255, 0, 0, true )
        outputChatBox ( "#ffff00[3/10]", root, 255, 0, 0, true )
        setElementData ( resourceRoot, "countBag", 3 )
        Bank.Bag[4] = createObject ( 1550, 346.615234375, 163.1181640625, 1014.1875 )
        setElementInterior ( Bank.Bag[4], 3 )
        removeEventHandler( "onMarkerHit", Bank.Marker[3], MoneyBag3 )
        addEventHandler ( "onMarkerHit", Bank.Marker[4], MoneyBag4 )
    end
end
   
MoneyBag4 = function ( player )
        local _, _, Pz = getElementPosition ( player )
        local _, _, Mz = getElementPosition ( source )
        if Mz == Pz then
        destroyElement( Bank.Bag[4] )
        givePlayerMoney ( player, 5000 )
        outputChatBox ( "[" .. getPlayerName( player ) .. "]: لقد حصل على حقيبة !", root, 255, 0, 0, true )
        outputChatBox ( "#ffff00[4/10]", root, 255, 0, 0, true )
        setElementData ( resourceRoot, "countBag", 4 )
        Bank.Bag[5] = createObject ( 1550, 366.3583984375, 193.41015625, 1019.984375 )
        setElementInterior ( Bank.Bag[5], 3 )
        removeEventHandler( "onMarkerHit", Bank.Marker[4], MoneyBag4 )
        addEventHandler ( "onMarkerHit", Bank.Marker[5], MoneyBag5 )
    end
end
 
MoneyBag5 = function ( player )
        local _, _, Pz = getElementPosition ( player )
        local _, _, Mz = getElementPosition ( source )
        if Mz == Pz then
        destroyElement( Bank.Bag[5] )
        givePlayerMoney ( player, 5000 )
        outputChatBox ( "[" .. getPlayerName( player ) .. "]: لقد حصل على حقيبة !", root, 255, 0, 0, true )
        outputChatBox ( "#ffff00[5/10]", root, 255, 0, 0, true )
        setElementData ( resourceRoot, "countBag", 5 )
        Bank.Bag[6] = createObject ( 1550, 356.443359375, 173.591796875, 1025.7890625 )
        setElementInterior ( Bank.Bag[6], 3 )
        removeEventHandler( "onMarkerHit", Bank.Marker[5], MoneyBag5 )
        addEventHandler ( "onMarkerHit", Bank.Marker[6], MoneyBag6 )
    end
end
   
MoneyBag6 = function ( player )
        local _, _, Pz = getElementPosition ( player )
        local _, _, Mz = getElementPosition ( source )
        if Mz == Pz then
        destroyElement( Bank.Bag[6] )
        givePlayerMoney ( player, 5000 )
        outputChatBox ( "[" .. getPlayerName( player ) .. "]: لقد حصل على حقيبة !", root, 255, 0, 0, true )
        outputChatBox ( "#ffff00[6/10]", root, 255, 0, 0, true )
        setElementData ( resourceRoot, "countBag", 6 )
        Bank.Bag[7] = createObject ( 1550, 365.0673828125, 158.2744140625, 1014.1875 )
        setElementInterior ( Bank.Bag[7], 3 )
        removeEventHandler( "onMarkerHit", Bank.Marker[6], MoneyBag6 )
        addEventHandler ( "onMarkerHit", Bank.Marker[7], MoneyBag7 )
    end
end
   
MoneyBag7 = function ( player )
        local _, _, Pz = getElementPosition ( player )
        local _, _, Mz = getElementPosition ( source )
        if Mz == Pz then
        destroyElement( Bank.Bag[7] )
        givePlayerMoney ( player, 5000 )
        outputChatBox ( "[" .. getPlayerName( player ) .. "]: لقد حصل على حقيبة !", root, 255, 0, 0, true )
        outputChatBox ( "#ffff00[7/10]", root, 255, 0, 0, true )
        setElementData ( resourceRoot, "countBag", 7 )
        Bank.Bag[8] = createObject ( 1550, 348.42614746094, 162.26203918457, 1025.7890625 )
        setElementInterior ( Bank.Bag[8], 3 )
        removeEventHandler( "onMarkerHit", Bank.Marker[7], MoneyBag7 )
        addEventHandler ( "onMarkerHit", Bank.Marker[8], MoneyBag8 )
    end
end
   
MoneyBag8 = function ( player )
        local _, _, Pz = getElementPosition ( player )
        local _, _, Mz = getElementPosition ( source )
        if Mz == Pz then
        destroyElement( Bank.Bag[8] )
        givePlayerMoney ( player, 5000 )
        outputChatBox ( "[" .. getPlayerName( player ) .. "]: لقد حصل على حقيبة !", root, 255, 0, 0, true )
        outputChatBox ( "#ffff00[8/10]", root, 255, 0, 0, true )
        setElementData ( resourceRoot, "countBag", 8 )
        Bank.Bag[9] = createObject ( 1550, 355.79351806641, 167.87002563477, 1019.9912109375 )
        setElementInterior ( Bank.Bag[9], 3 )
        removeEventHandler( "onMarkerHit", Bank.Marker[8], MoneyBag8 )
        addEventHandler ( "onMarkerHit", Bank.Marker[9], MoneyBag9 )
    end
end
   
MoneyBag9 = function ( player )
        local _, _, Pz = getElementPosition ( player )
        local _, _, Mz = getElementPosition ( source )
        if Mz == Pz then
        destroyElement( Bank.Bag[9] )
        givePlayerMoney ( player, 5000 )
        outputChatBox ( "[" .. getPlayerName( player ) .. "]: لقد حصل على حقيبة !", root, 255, 0, 0, true )
        outputChatBox ( "#ffff00[9/10]", root, 255, 0, 0, true )
        setElementData ( resourceRoot, "countBag", 9 )
        Bank.Bag[10] = createObject ( 1550, 328.75942993164, 153.52079772949, 1014.1875 )
        setElementInterior ( Bank.Bag[10], 3 )
        removeEventHandler( "onMarkerHit", Bank.Marker[9], MoneyBag9 )
        addEventHandler ( "onMarkerHit", Bank.Marker[10], MoneyBag10 )
    end
Link to comment

سهلل ما يبيلها تعب,

احذف الاكواد اللي تجيك كذا, او تشبهها

if getPlayerTeam ( player ) and getPlayerTeam ( player ) == getTeamFromName ( 'Police' ) then 

واحذف الاند تبعها, كلها اللي بالسيرفر والكلينت م شيكت ع الاكواد كامله :D .

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...