Jump to content

تصحيح اكواد


Recommended Posts

الحين انا عندي لوحة كل ما اشغل مود تجي على طول انا ابيها ما تجي الا بالامر 

و ابي الزر يسكرها كاتب الاكواد بس ما يسكرها و تجي بوجهي لمن اشغلها ليه؟

addEventHandler("onClientResourceStart", resourceRoot,
    function()
        window1 = guiCreateWindow(509, 175, 311, 452, "Revive Panel", false)
        guiWindowSetSizable(window1, false)
		        guiGetVisible( window1 ,false)

        gridlist1 = guiCreateGridList(13, 26, 288, 341, false, window1)
        guiGridListAddColumn(gridlist1, "Players", 0.9)


        Button1 = guiCreateButton(17, 379, 139, 63, "Revive Player", false, window1)
        Button2 = guiCreateButton(166, 379, 135, 63, "Close", false, window1)    
    end
)

addCommandHandler('rp',
function ()
guiGetVisible(window1,not guiGetVisible(window1))
showCursor(guiGetVisible(window1))
end
)

addEventHandler ( "onClientGUIClick",root,
function ()
if (source == Button2) then
guiGetVisible( window1 ,false)
showCursor(false)
   end
end
)

و ابي كود يجيب اسماء لاعبين القريبين مني   و يكون دمهم ناقص

Link to comment

الطلب الأول :
انت مستعمل 

guiGetVisible

المفروض تستعمل

guiSetVisible

الطلب الثاني :

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

function isElementInRange(ele, x, y, z, range)
	   if isElement(ele) and type(x) == "number" and type(y) == "number" and type(z) == "number" and type(range) == "number" then
		  return getDistanceBetweenPoints3D(x, y, z, getElementPosition(ele)) <= range -- returns true if it the range of the element to the main point is smaller than (or as big as) the maximum range.
	   end
	   return false
	end
	function changeGridListToPlayersAround ( gridlist, column, range )
  		if type ( column ) == 'number' and type ( range ) == 'number' and getElementType ( gridlist ) == 'gui-gridlist' then
          for i,v in ipairs ( getElementsByType ( 'player' ) ) do
              local x,y,z = getElementPosition ( localPlayer )
                  if isElementInRange ( v, x, y, z, range ) then
                      local row = guiGridListAddRow ( gridlist )
                      guiGridListSetItemText ( gridlist, row, column, getPlayerName ( v ), false, false )
                  end
          end
    	return true
  		end
  		return false
	end

السينتاكس
 

bool changeGridListToPlayerAround ( element gridlist, int column, int range )

مثال :
 

function isElementInRange(ele, x, y, z, range)
	   if isElement(ele) and type(x) == "number" and type(y) == "number" and type(z) == "number" and type(range) == "number" then
		  return getDistanceBetweenPoints3D(x, y, z, getElementPosition(ele)) <= range -- returns true if it the range of the element to the main point is smaller than (or as big as) the maximum range.
	   end
	   return false
	end
	function changeGridListToPlayersAround ( gridlist, column, range )
  		if type ( column ) == 'number' and type ( range ) == 'number' and getElementType ( gridlist ) == 'gui-gridlist' then
          for i,v in ipairs ( getElementsByType ( 'player' ) ) do
              local x,y,z = getElementPosition ( localPlayer )
                  if isElementInRange ( v, x, y, z, range ) then
                      local row = guiGridListAddRow ( gridlist )
                      guiGridListSetItemText ( gridlist, row, column, getPlayerName ( v ), false, false )
                  end
          end
    	return true
  		end
  		return false
	end
mygridList = guiCreateGridList ( 13, 26, 288, 341, false )
guiSetVisible ( mygridList, not guiGetVisible ( mygridList ) )
guiGridListAddColumn( mygridList, "players:", 0.9 )
bindKey ( "1", "down", 
  function ( )
    guiSetVisible ( mygridList, not guiGetVisible ( mygridList ) )
	showCursor ( not isCursorShowing () )
	changeGridListToPlayersAround ( mygridList, 1, 20 )
    end
  )

 

Edited by iMr.WiFi..!
Link to comment

طيب طيب ودي اسالك ما ابيه بس كذا مثلا الحين بسوي انه يعطيه دم طيب؟ الكود بستخدمه 

addEventHandler ( "onClientGUIClick",root,
function ()  
if (source == Button1) then
setElementHealth( player, 100)
guiSetVisible(window1,not guiSetVisible(window1))
showCursor(false)
   end
end
)

و لمن الشخص يدعس على زر رقم 1 يطلع تحميل و هذا الكود حقه  ويسكر اللوحة

addEventHandler("onClientResourceStart", resourceRoot,
    function()
        progressbar = guiCreateProgressBar(569, 519, 212, 27, false )
        guiSetVisible(progressbar,false)
         local timee = guiProgressBarGetProgress(progressbar)
 setTimer( guiProgressBarSetProgress, 500, 1,progressbar,timee+10 )
 setTimer( guiProgressBarSetProgress, 1000, 1,progressbar,timee+20 )
 setTimer( guiProgressBarSetProgress, 1500, 1,progressbar,timee+30 )
 setTimer( guiProgressBarSetProgress, 2000, 1,progressbar,timee+40 )
 setTimer( guiProgressBarSetProgress, 2500, 1,progressbar,timee+50 )
 setTimer( guiProgressBarSetProgress, 3000, 1,progressbar,timee+60 )
 setTimer( guiProgressBarSetProgress, 3500, 1,progressbar,timee+70 )
 setTimer( guiProgressBarSetProgress, 4000, 1,progressbar,timee+80 )
 setTimer( guiProgressBarSetProgress, 4500, 1,progressbar,timee+90 )
 setTimer( guiProgressBarSetProgress, 5000, 1,progressbar,timee+100 )
 timer = setTimer(function ()     
     guiSetVisible(progressbar, false)
	guiProgressBarSetProgress(progressbar, 0)
        
end,5000, 1)
end		

)

addEventHandler ( "onClientGUIClick",root,
function ()  
if (source == Button1) then
guiSetVisible( progressbar ,true)
   end
end
)

لاحظ الكود الاول انه guiSetVisible يعني ابيه يسكر اللوحة لمن يدعس الزر رقم 1

و لمن يدعس الزر رقم واحد شف الكود رقم 2 تلاقي اخر شي 

انه لمن يدعسه يطلع التحميل 

طيب انا ابيه لمن يدعس الزر يكون وقت محدد و يعطيه دم استخدم 

setTimer 

اذا في شي غلط انا مسويه قلي عليه 

Link to comment

يا Wifi

الكود حقك ما يشتغل

ما يطلع لي اسم الاشخاص قريبين مني 

addEventHandler("onClientResourceStart", resourceRoot,
    function()
        window1 = guiCreateWindow(509, 175, 311, 452, "Revive Panel", false)
        guiWindowSetSizable(window1, false)
		        guiSetVisible( window1 ,false)

        gridlist1 = guiCreateGridList(13, 26, 288, 341, false, window1)
        guiGridListAddColumn(gridlist1, "Players", 0.9)


        Button1 = guiCreateButton(17, 379, 139, 63, "Revive Player", false, window1)
        Button2 = guiCreateButton(166, 379, 135, 63, "Close", false, window1) 
        guiGridListClear(gridlist1 )		
    end
)

addCommandHandler('rp',
function ()
guiSetVisible(window1,not guiSetVisible(window1))
showCursor(guiGetVisible(window1))
end
)

addEventHandler ( "onClientGUIClick",root,
function ()  
if (source == Button2) then
guiSetVisible( window1 ,false)
showCursor(false)
   end
end
)

addEventHandler ( "onClientGUIClick",root,
function ()  
if (source == Button1) then
guiSetVisible( window1 ,false)
guiSetVisible(progressbar,true)
showCursor(false)
   end
end
)

function isElementInRange(ele, x, y, z, range)
	   if isElement(ele) and type(x) == "number" and type(y) == "number" and type(z) == "number" and type(range) == "number" then
		  return getDistanceBetweenPoints3D(x, y, z, getElementPosition(ele)) <= range -- returns true if it the range of the element to the main point is smaller than (or as big as) the maximum range.
	   end
	   return false
	end
	
	function changeGridListToPlayersAround ( gridlist1, column, range )
  		if type ( column ) == 'number' and type ( range ) == 'number' and getElementType ( gridlist1 ) == 'gui-gridlist' then
          for i,v in ipairs ( getElementsByType ( 'player' ) ) do
              local x,y,z = getElementPosition ( localPlayer )
                  if isElementInRange ( v, x, y, z, range ) then
                      local row = guiGridListAddRow ( gridlist1 )
                      guiGridListSetItemText ( gridlist1, row, column, getPlayerName ( v ), false, false )
					  if ( v ~= getLocalPlayer ( ) ) then
                  end
          end
    	return true
  		end
  		return false
	end
end

 

Link to comment


addEventHandler("onClientResourceStart", resourceRoot,
    function()
        window1 = guiCreateWindow(509, 175, 311, 452, "Revive Panel", false)
        guiWindowSetSizable(window1, false)
		        guiSetVisible( window1 ,false)

        gridlist1 = guiCreateGridList(13, 26, 288, 341, false, window1)
        guiGridListAddColumn(gridlist1, "Players", 0.9)


        Button1 = guiCreateButton(17, 379, 139, 63, "Revive Player", false, window1)
        Button2 = guiCreateButton(166, 379, 135, 63, "Close", false, window1) 
        guiGridListClear(gridlist1 )		
    end
)

addCommandHandler('rp',
function ()
guiSetVisible(window1,not guiSetVisible(window1))
showCursor(guiGetVisible(window1))
changeGridListToPlayersAround ( gridlist1, 1, 5 )
end
)

addEventHandler ( "onClientGUIClick",root,
function ()  
if (source == Button2) then
guiSetVisible( window1 ,false)
showCursor(false)
   end
end
)

addEventHandler ( "onClientGUIClick",root,
function ()  
if (source == Button1) then
guiSetVisible( window1 ,false)
guiSetVisible(progressbar,true)
showCursor(false)
   end
end
)

function isElementInRange(ele, x, y, z, range)
	   if isElement(ele) and type(x) == "number" and type(y) == "number" and type(z) == "number" and type(range) == "number" then
		  return getDistanceBetweenPoints3D(x, y, z, getElementPosition(ele)) <= range -- returns true if it the range of the element to the main point is smaller than (or as big as) the maximum range.
	   end
	   return false
	end
	
	function changeGridListToPlayersAround ( gridlist, column, range )
  		if type ( column ) == 'number' and type ( range ) == 'number' and getElementType ( gridlist ) == 'gui-gridlist' then
    	guiGridListClear ( gridlist )
          for i,v in ipairs ( getElementsByType ( 'player' ) ) do
      		 if ( v == getLocalPlayer ( ) ) then
                return
        	end
              local x,y,z = getElementPosition ( localPlayer )
                  if isElementInRange ( v, x, y, z, range ) then
                      local row = guiGridListAddRow ( gridlist )
                      guiGridListSetItemText ( gridlist, row, column, getPlayerName ( v ), false, false )
				 end
  		end
		return true
		else
		return false
	end
end

 

Link to comment
12 hours ago, iMr.WiFi..! said:
  1.  
  2.  
  3. addEventHandler("onClientResourceStart", resourceRoot,
  4. function()
  5. window1 = guiCreateWindow(509, 175, 311, 452, "Revive Panel", false)
  6. guiWindowSetSizable(window1, false)
  7. guiSetVisible( window1 ,false)
  8.  
  9. gridlist1 = guiCreateGridList(13, 26, 288, 341, false, window1)
  10. guiGridListAddColumn(gridlist1, "Players", 0.9)
  11.  
  12.  
  13. Button1 = guiCreateButton(17, 379, 139, 63, "Revive Player", false, window1)
  14. Button2 = guiCreateButton(166, 379, 135, 63, "Close", false, window1)
  15. guiGridListClear(gridlist1 )
  16. end
  17. )
  18.  
  19. addCommandHandler('rp',
  20. function ()
  21. guiSetVisible(window1,not guiSetVisible(window1))
  22. showCursor(guiGetVisible(window1))
  23. changeGridListToPlayersAround ( gridlist1, 1, 5 )
  24. end
  25. )
  26.  
  27. addEventHandler ( "onClientGUIClick",root,
  28. function ()
  29. if (source == Button2) then
  30. guiSetVisible( window1 ,false)
  31. showCursor(false)
  32. end
  33. end
  34. )
  35.  
  36. addEventHandler ( "onClientGUIClick",root,
  37. function ()
  38. if (source == Button1) then
  39. guiSetVisible( window1 ,false)
  40. guiSetVisible(progressbar,true)
  41. showCursor(false)
  42. end
  43. end
  44. )
  45.  
  46. function isElementInRange(ele, x, y, z, range)
  47. if isElement(ele) and type(x) == "number" and type(y) == "number" and type(z) == "number" and type(range) == "number" then
  48. return getDistanceBetweenPoints3D(x, y, z, getElementPosition(ele)) <= range -- returns true if it the range of the element to the main point is smaller than (or as big as) the maximum range.
  49. end
  50. return false
  51. end
  52.  
  53. function changeGridListToPlayersAround ( gridlist, column, range )
  54. if type ( column ) == 'number' and type ( range ) == 'number' and getElementType ( gridlist ) == 'gui-gridlist' then
  55. guiGridListClear ( gridlist )
  56. for i,v in ipairs ( getElementsByType ( 'player' ) ) do
  57. if ( v == getLocalPlayer ( ) ) then
  58. return
  59. end
  60. local x,y,z = getElementPosition ( localPlayer )
  61. if isElementInRange ( v, x, y, z, range ) then
  62. local row = guiGridListAddRow ( gridlist )
  63. guiGridListSetItemText ( gridlist, row, column, getPlayerName ( v ), false, false )
  64. end
  65. end
  66. return true
  67. else
  68. return false
  69. end
  70. end

وش سويت كان في خطا او شي؟

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