Raised This Month: $ Target: $400
 0% 

Compare nums


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 10-08-2007 , 11:34   Re: Compare nums
Reply With Quote #4

Possibly.

It's much harder to judge if something will work than write it :-D


Try it :-D

EDIT: And there's no point to strlen ShortestName every iteration - you can just save it.

No, it won't work.

If only because you got you > and < the wrong way around ...

That, and shortestname starts off empty. So its strlen is 0. So no other string can be shorter :-D


Re-EDIT: this:
PHP Code:
{
    new 
Players[32], NumPlayerShortestName[32],ShNameLen=9999;
    
get_players(PlayersNum);
 
    for(new 
Num i++)
    {
        
Player Players[i];
  
        static 
Name[32], NameLen ;
        
get_user_name(PlayerNamesizeof Name 1);
  
        
NameLen strlen(Name);
  
        if(
NameLen ShNameLen)
        {
            
copy(ShortestNamesizeof ShortestName 1Name);
            
ShNameLen NameLen
        
}
    }
    return 
ShortestName;

works fine.

I only changed a little - mainly swapping < for >, initialising shNameLen as 9999 and saving ShNameLen between iterations, rather than getting it each time.

Last edited by purple_pixie; 10-08-2007 at 11:45.
purple_pixie 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 16:13.


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