Raised This Month: $ Target: $400
 0% 

[solved]2D array & compare floats


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Dr.G
Senior Member
Join Date: Nov 2008
Old 03-27-2009 , 18:46   [solved]2D array & compare floats
Reply With Quote #1

i made a no scope notifier for dod. All players top distances is saved to

PHP Code:
new Float:g_noscope_counter_dist[33
now i need a function to compare these distances and show the top distances in a motd thats showen with a say cmd e.g. anakin_cstrike made this function in his zoomless plugin:

PHP Code:
////////////////////////////////////////////////////////////////////////////////////////////////////
// by anakin_cstrike... 
public show_unscoped_top_killerid )
{
if(!
get_pcvar_num(p_on))
return 
PLUGIN_HANDLED
 
new players[32], indexcountnumi
get_players
playersnum )
 
for( ; 
numi++ )
{
index players];
 
g_Sortcount ][ ] = index
g_Sort
count ][ ] = g_noscope_counterindex ]
 
count++
}
 
SortCustom2Dg_Sortcount"compare_kills" )
 
new 
Motd1024 ], Len
 
Len 
formatMotdcharsmaxMotd ),"<body bgcolor=#000000><font color=#98f5ff><pre>" )
Len += formatMotdLen ], charsmaxMotd ) - Len,"%s %-22.22s %3s^n""#""Name""Unscoped Kills" )
 
 
new 
clampcount0get_pcvar_num(top_x) )
 
new 
name32 ], playerj
 
for( ; bj++ )
{
player g_Sort][ ]
 
get_user_nameplayernamesizeof name )
 
Len += formatMotdLen ], charsmaxMotd )-Len,"%d %-22.22s %d^n"j+1nameg_Sort][ ] )
}
Len += formatMotdLen ], charsmaxMotd )-Len,"</body></font></pre>" )
 
show_motdidMotdPLUGIN )
 
return 
PLUGIN_CONTINUE

the compare func:

PHP Code:
////////////////////////////////////////////////////////////////////////////////////////////////////
public compare_killselem1[ ], elem2[ ] )
{
if( 
elem1] > elem2] )
return -
1;
else if( 
elem1] < elem2] )
return 
1;
 
return 
0;
}
//////////////////////////////////////////////////////////////////////////////////////////////////// 
and that works great for compareing numbers, gj btw. but how can i add a float to g_Sort[ count ][ 1 ] and compare them? if i say g_Sort[ count ][ 1 ] = g_noscope_counter_dist[ id ] that have a floating value, i get tag mistakes.

Maybe this isnt the way to do it, all suggestions or just a hint is very welcome
__________________

Last edited by Dr.G; 03-27-2009 at 23:37.
Dr.G is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode