SA-MP Forums Archive
sort dmgs - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: sort dmgs (/showthread.php?tid=382880)



sort dmgs - ReVo_ - 05.10.2012

Hello!,
i have a problem with "sorting" damage:
I have make this code but sometimes doesn't work:
Код:
   		new dmg = Player[ i ][ RDamage ];

		if (dmg >= dmgs[ 0 ][ 1 ])
		{
			dmgs[ 0 ][ 0 ] = i;
			dmgs[ 0 ][ 1 ] = dmg;
		}

		else if (dmg >= dmgs[ 1 ][ 1 ])
		{
			dmgs[ 1 ][ 0 ] = i;
			dmgs[ 1 ][ 1 ] = dmg;
		}
		
		else if (dmg >= dmgs[ 2 ][ 1 ])
		{
			dmgs[ 2 ][ 0 ] = i;
			dmgs[ 2 ][ 1 ] = dmg;
		}
I Want to know how to fix

This code must do a list of players with most dmg (first, second, three)

(oh, my english sux.. when i come back at home i'll correct xD)


Re: sort dmgs - ReVo_ - 05.10.2012

Uhm yeah, but i should save the id of the player.. i must know what is his dmg index.. (i dont know if u can understand what i said :/)