Jump to content

x[ استفسار ]x TOP 5


Recommended Posts

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

لو في اشخاص معهم اكاونت داتا ارقام

ابي اجيب من الكبير للصغير بحيث يصير هيك

يعني مثلا انا معي قيمة 5 و واحد تاني 10 

عايز اجي في جريد ليست انا الاول و هو الثاني

ازاي ؟

فنكشنات + الطريقة لو ممكن

 

Edited by #STZ
Link to comment

to @iPrestege

aKillsData = 'داتا النقاط'

function aUpdateKiller ( 		)
	aTopKiller = {		};
	for _,v in ipairs( getElementsByType ( 'player') ) do 
		if getElementData ( v,aKillsData ) then
  		  table.insert ( aTopKiller,{ ['aName'] = getPlayerName ( v ),['aScore'] = getElementData ( v,aKillsData ) } );
  		end;
	end;
	table.sort ( aTopKiller, function ( a,b )  return a.aScore > b.aScore end ); 
end;
aUpdateKiller ( 		);

addEventHandler ( 'onClientElementDataChange',root,
	function (	aD )
		if aD == aKillsData then
			aUpdateKiller ( 		);
		end
	end
);

local aX,aY = guiGetScreenSize ( ) 
addEventHandler ( 'onClientRender',root,
function  ( )
	if #aTopKiller > 0 then
   		 dxDrawText ( 'Top Player is : '..aTopKiller[1].aName..' and His score is : '..aTopKiller [1].aScore..'', 44, aY - 43, aX, aY, tocolor ( 255, 255, 255, 255 ), 1 ) 
   	end
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...