Raised This Month: $ Target: $400
 0% 

Code doesn't count correct


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 07-22-2013 , 06:14   Code doesn't count correct
Reply With Quote #1

Hello everybody,

For my ranking system I need to know who is the first / second etc. place of a race. For this I use this code :

PHP Code:
new PlayerZ[32], id2Amount g_PartyData[id][Amount_In_Party]
    
get_party_index(idPlayerZ)
    
    static 
PlayersFinished 0
    
    
for(new iAmounti++) 
    {
        
id2 PlayerZ[i]    
        if(!
g_bIsInRace[id2])
            
PlayersFinished++
    }
    
    for(new 
iAmounti++) 
    {
        
id2 PlayerZ[i]
        switch(
PlayersFinished)
        {
            case 
1:
            {
                
g_PartyData[id2][FIRST] = id
                client_print
(0print_chat"[DEBUG] %i is first player."id)
            }
            case 
2:
            {
                
g_PartyData[id2][SECOND] = id
                client_print
(0print_chat"[DEBUG] %i is second player."id)
            }
            case 
3:
            {
                
g_PartyData[id2][THIRD] = id
                client_print
(0print_chat"[DEBUG] %i is third player."id)
            }
            case 
4:
            {
                
g_PartyData[id2][FOURTH] = id
            
}
            case 
5:
            {
                
g_PartyData[id2][FIFTH] = id
            
}
            case 
6:
            {
                
g_PartyData[id2][SIXTH] = id
            
}
            case 
7:
            {
                
g_PartyData[id2][SEVENTH] = id
            
}
            case 
8:
            {
                
g_PartyData[id2][EIGHTH] = id
            
}    
        }
    }
    if(
PlayersFinished == g_PartyData[id][Amount_In_Party])
    {
        
calculate_players_elo(id)
    } 
But it always shows the second player as third (printing out ""[DEBUG] %i is third player.", id)") and the function "calculate_players_elo(id)" never gets executed.

Anyone knows what I'm doing wrong or has better idea how to do this?
__________________
Kia is offline
Smatify
Senior Member
Join Date: Nov 2012
Location: Where ever you want
Old 07-22-2013 , 07:40   Re: Code doesn't count correct
Reply With Quote #2

Maybe is this the problem?
PHP Code:
static PlayersFinished 
__________________
Selling Hosting stuff such as Webspace and Game- & VoiceServer

I'm also selling Steam Keys.
For more informations, contact me.

(Homepage is under development)
Smatify is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 07-22-2013 , 07:44   Re: Code doesn't count correct
Reply With Quote #3

Nevermind, Smatify told me my mistake.

PHP Code:
 static PlayersFinished 
->
PHP Code:
  new PlayersFinished 
__________________
Kia is offline
Reply



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 06:24.


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