Jump to content

مشكلة كود رسباون


Recommended Posts

كود شخص اجنبي ..

الكود لا يقوم بنقلي عندمـأ اموت للمكان المحدد

hospitalsTable = { 
{ 1179.22803,-1323.52087,14.15908 }, 
{ 1606.85559,1822.30957,10.82031 }, 
{ -2659.85767,632.98505,14.45313 }, 
} 
  
  
function spawn( player ) 
  local i=0 
  local minDistance=100000 
  local minHospital = 0 
  local posX, posY, posZ = getElementPosition(player) 
  for key,val in ipairs(hospitalsTable) do 
    i=i+1 
    local distance = getDistanceBetweenPoints2D(posX, posY, val[1], val[2]) 
    if (distance) then 
      minDistance=distance 
      minHospital=i 
    end 
  end 
  spawnPlayer( player, hospitalsTable[minHospital][1], hospitalsTable [minHospital][2], hospitalsTable [minHospital][3], hospitalsTable [minHospital][4] ) 
end 
addEventHandler("onPlayerWasted", getRootElement(),spawn) 

اتمنئ الافادةة

Link to comment

تفضل :

hospitalsTable = { 
{ 1179.22803,-1323.52087,14.15908 }, 
{ 1606.85559,1822.30957,10.82031 }, 
{ -2659.85767,632.98505,14.45313 }, 
} 
  
  
function spawn( player ) 
  local i=0 
  local minDistance=100000 
  local minHospital = 0 
  local posX, posY, posZ = getElementPosition(player) 
  for key,val in ipairs(hospitalsTable) do 
    i=i+1 
    local distance = getDistanceBetweenPoints2D(posX, posY, val[1], val[2]) 
    if (distance) then 
      minDistance=distance 
      minHospital=i 
    end 
  end 
  spawnPlayer( player, hospitalsTable[minHospital][1], hospitalsTable [minHospital][2], hospitalsTable [minHospital][3], hospitalsTable [minHospital][4] ) 
end 
addEventHandler("onPlayerSpawn", getRootElement(),spawn) 

المشكله انك كنت مسوي الحدث OnPlayerWasted

المفروض تسويه OnPlayerSpawn

Link to comment
hospitalsTable = { 
{ 1179.22803,-1323.52087,14.15908 }, 
{ 1606.85559,1822.30957,10.82031 }, 
{ -2659.85767,632.98505,14.45313 }, 
} 
  
  
function spawn( player ) 
  local i=0 
  local minDistance=100000 
  local minHospital = 0 
  local posX, posY, posZ = getElementPosition(player) 
  for key,val in ipairs(hospitalsTable) do 
    i=i+1 
    local distance = getDistanceBetweenPoints2D(posX, posY, val[1], val[2]) 
    if (distance) then 
      minDistance=distance 
      minHospital=i 
    end 
  end 
        for k,v in ipairs ( getElementsByType ( "player" ) ) do 
            local x, y, z = unpack ( hospitalsTable[ math.random ( #hospitalsTable ) ] ) 
            setTimer ( spawnPlayer, 1200, 1, v, x, y, z, 90, 46 ) 
        end 
end 
addEventHandler("onPlayerWasted", getRootElement(),spawn) 

Link to comment
hospitalsTable = { 
{ 1179.22803,-1323.52087,14.15908 }, 
{ 1606.85559,1822.30957,10.82031 }, 
{ -2659.85767,632.98505,14.45313 }, 
} 
  
  
function spawn( player ) 
  local i=0 
  local minDistance=100000 
  local minHospital = 0 
  local posX, posY, posZ = getElementPosition(player) 
  for key,val in ipairs(hospitalsTable) do 
    i=i+1 
    local distance = getDistanceBetweenPoints2D(posX, posY, val[1], val[2]) 
    if (distance) then 
      minDistance=distance 
      minHospital=i 
    end 
  end 
        for k,v in ipairs ( getElementsByType ( "player" ) ) do 
            local x, y, z = unpack ( hospitalsTable[ math.random ( #hospitalsTable ) ] ) 
            setTimer ( spawnPlayer, 1200, 1, v, x, y, z, 90, 46 ) 
        end 
end 
addEventHandler("onPlayerWasted", getRootElement(),spawn) 

hospitalsTable = { 
{ 1179.22803,-1323.52087,14.15908 }, 
{ 1606.85559,1822.30957,10.82031 }, 
{ -2659.85767,632.98505,14.45313 }, 
} 
  
  
function spawn( ) 
  local i=0 
  local minDistance=100000 
  local minHospital = 0 
  local posX, posY, posZ = getElementPosition(source) 
  for key,val in ipairs(hospitalsTable) do 
    i=i+1 
    local distance = getDistanceBetweenPoints2D(posX, posY, val[1], val[2]) 
    if (distance) then 
      minDistance=distance 
      minHospital=i 
    end 
  end 
        for k,v in ipairs ( getElementsByType ( "player" ) ) do 
            local x, y, z = unpack ( hospitalsTable[ math.random ( #hospitalsTable ) ] ) 
            setTimer ( spawnPlayer, 1200, 1, v, x, y, z, 90, 46 ) 
        end 
end 
addEventHandler("onPlayerWasted", getRootElement(),spawn) 
Link to comment

أنا حطيت سورس لكود الي فوقي لا أكثر

hospitalsTable = { 
{ 1179.22803,-1323.52087,14.15908 }, 
{ 1606.85559,1822.30957,10.82031 }, 
{ -2659.85767,632.98505,14.45313 }, 
} 
  
  
function spawn( ) 
  local i=0 
  local minDistance=100000 
  local minHospital = 0 
  local posX, posY, posZ = getElementPosition(source) 
  for key,val in ipairs(hospitalsTable) do 
    i=i+1 
    local distance = getDistanceBetweenPoints2D(posX, posY, val[1], val[2]) 
    if (distance) then 
      minDistance=distance 
      minHospital=i 
    end 
  end 
  spawnPlayer( source, hospitalsTable[minHospital][1], hospitalsTable [minHospital][2], hospitalsTable [minHospital][3], hospitalsTable [minHospital][4] ) 
end 
addEventHandler("onPlayerSpawn", getRootElement(),spawn) 
Link to comment
أنا حطيت سورس لكود الي فوقي لا أكثر

hospitalsTable = { 
{ 1179.22803,-1323.52087,14.15908 }, 
{ 1606.85559,1822.30957,10.82031 }, 
{ -2659.85767,632.98505,14.45313 }, 
} 
  
  
function spawn( ) 
  local i=0 
  local minDistance=100000 
  local minHospital = 0 
  local posX, posY, posZ = getElementPosition(source) 
  for key,val in ipairs(hospitalsTable) do 
    i=i+1 
    local distance = getDistanceBetweenPoints2D(posX, posY, val[1], val[2]) 
    if (distance) then 
      minDistance=distance 
      minHospital=i 
    end 
  end 
  spawnPlayer( source, hospitalsTable[minHospital][1], hospitalsTable [minHospital][2], hospitalsTable [minHospital][3], hospitalsTable [minHospital][4] ) 
end 
addEventHandler("onPlayerSpawn", getRootElement(),spawn) 

داري انه كود الي فوقك بس كيف انت تعدل بكود بدون ما تشوف وش الي بالكود؟

الأفنت الي حاطه خطأ

لما اللاعب يجيه سباون تسوي سباون و لما تسوي سباون رح يشتغل حدث لما اللاعب يجيه سباون و انت رح تسوي سباون مره ثانية و رح يشتغل الحدث مره ثالثة و رح يستمر ل ما لا نهاية و بينفجر المود :cry:

و يغير بلاير إلى سورس ب فنكشن الي يجيب الأحداثيات و فنكشن السباون function الحدث الي حاطه صاحب الموضوع الصحيح بس يحذف بلاير من

و الجدول فيه 3 ارقام و انتو حاطين 4 بفنكشن السباون

و يفضل يستخدم تايمر ل فنكشن السباون عشان مو اول ما يموت اللاعب على طول يلقى نفسه يركض جنب المستشفى

Link to comment

اما ينفجر :lol:

hospitalsTable = { 
{ 1179.22803,-1323.52087,14.15908 }, 
{ 1606.85559,1822.30957,10.82031 }, 
{ -2659.85767,632.98505,14.45313 }, 
} 
  
addEventHandler("onPlayerWasted",root, 
setTimer ( function() 
function (   ) 
  local i=0 
  local minDistance=100000 
  local minHospital = 0 
  local posX, posY, posZ = getElementPosition(source) 
  for key,val in ipairs(hospitalsTable) do 
    i=i+1 
    local distance = getDistanceBetweenPoints2D(posX, posY, val[1], val[2]) 
    if (distance) then 
      minDistance=distance 
      minHospital=i 
    end 
  end 
  spawnPlayer( source, hospitalsTable[minHospital][1], hospitalsTable [minHospital][2], hospitalsTable [minHospital][3], hospitalsTable [minHospital][4] ) 
end 
end,5000 , 1) 
) 
Link to comment

يعطيككم العافيةة كل واحد بأسمة

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

بس مدري تعديلي صح ولا لن ماشتغل

 hospitalsTable = { 
{ 1179.22803,-1323.52087,14.15908 }, 
{ 1606.85559,1822.30957,10.82031 }, 
{ -2659.85767,632.98505,14.45313 }, 
} 
  
  
function ( ) 
  local i=0 
  local minDistance=100000 
  local minHospital = 0 
  local posX, posY, posZ = getElementPosition(source) 
  for key,val in ipairs(hospitalsTable) do 
    i=i+1 
    local distance = getDistanceBetweenPoints2D(posX, posY, val[1], val[2]) 
    if (distance) then 
      minDistance=distance 
      minHospital=i 
    end 
  end 
  spawnPlayer( source, hospitalsTable[minHospital][1], hospitalsTable [minHospital][2], hospitalsTable [minHospital][3], hospitalsTable [minHospital][4] ) 
end 
addEventHandler("onPlayerWasted", getRootElement(),spawn) 

Edited by Guest
Link to comment
     hospitalsTable = { 
    { 1179.22803,-1323.52087,14.15908 }, 
    { 1606.85559,1822.30957,10.82031 }, 
    { -2659.85767,632.98505,14.45313 }, 
    } 
      
      
    function spawn() 
      local i=0 
      local minDistance=100000 
      local minHospital = 0 
      local posX, posY, posZ = getElementPosition(source) 
      for key,val in ipairs(hospitalsTable) do 
        i=i+1 
        local distance = getDistanceBetweenPoints2D(posX, posY, val[1], val[2]) 
        if (distance) then 
          minDistance=distance 
          minHospital=i 
        end 
      end 
      spawnPlayer( source, hospitalsTable[minHospital][1], hospitalsTable [minHospital][2], hospitalsTable [minHospital][3] ) 
    end 
    addEventHandler("onPlayerWasted", getRootElement(),spawn) 

Edited by Guest
Link to comment
         hospitalsTable = { 
        { 1179.22803,-1323.52087,14.15908 }, 
        { 1606.85559,1822.30957,10.82031 }, 
        { -2659.85767,632.98505,14.45313 }, 
        } 
          
          
        function spawn() 
          local i=0 
          local minDistance=100000 
          local minHospital = 0 
          local posX, posY, posZ = getElementPosition(source) 
          for key,val in ipairs(hospitalsTable) do 
            i=i+1 
            local distance = getDistanceBetweenPoints2D(posX, posY, val[1], val[2]) 
            if (distance) then 
              minDistance=distance 
              minHospital=i 
            end 
          end 
          setTimer ( spawnPlayer, 3000, 1, source, hospitalsTable[minHospital][1], hospitalsTable [minHospital][2], hospitalsTable [minHospital][3] ) 
        end 
        addEventHandler("onPlayerWasted", getRootElement(),spawn) 

Edited by Guest
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...