AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Server Shutdown When Checking Top Player Stats (https://forums.alliedmods.net/showthread.php?t=129357)

shadow.hk 06-12-2010 03:36

Server Shutdown When Checking Top Player Stats
 
I've been having trouble with this stuff for a while and i'm wondering what i'm doing wrong.

PHP Code:

check_top(index, class, xp
{
    static 
szName[32], posia;
    
    for(
0MAX_TOPi++)
    {
        
// if they have more xp than this ranked player then start calculating
        
if( xp g_iTopPlayerXP[class][i] )
        {
            
pos i;
            
            
// find out whether they're already in the top statistics and set pos to it
            
while( equal(g_szTopPlayerAuthID[class][pos], g_szAuthID[index]) && pos MAX_TOP )
            {
                if( ++
pos == MAX_TOP )
                {
                    
pos MAX_TOP 1;
                }
            }
            
            
// loop from player's position to player's new position, setting xp from the current position
            //  to the player below the current position
            
for(posia--)
            {
                
g_szTopPlayerName[class][a]        = g_szTopPlayerName[class][a-1];
                
g_szTopPlayerAuthID[class][a]        = g_szTopPlayerAuthID[class][a-1];
                
                
g_iTopPlayerXP[class][a]        = g_iTopPlayerXP[class][a-1];
                
g_iTopPlayerLevel[class][a]        = g_iTopPlayerLevel[class][a-1];
                
                
g_iTopPlayerUpgrade[class][a][0]    = g_iTopPlayerUpgrade[class][a-1][0];
                
g_iTopPlayerUpgrade[class][a][1]    = g_iTopPlayerUpgrade[class][a-1][1];
                
g_iTopPlayerUpgrade[class][a][2]    = g_iTopPlayerUpgrade[class][a-1][2];
                
g_iTopPlayerUpgrade[class][a][3]    = g_iTopPlayerUpgrade[class][a-1][3];
            }
            
            
// set player info to the new position
            
get_user_name(indexszName31);
            
            
g_szTopPlayerName[class][i]        = szName;
            
g_szTopPlayerAuthID[class][i]        = g_szAuthID[index];
            
            
g_iTopPlayerXP[class][i]        = xp;
            
g_iTopPlayerLevel[class][i]        = g_iPlayerLevel[index];
            
            
g_iTopPlayerUpgrade[class][i][0]    = g_iPlayerUpgrade[index][0];
            
g_iTopPlayerUpgrade[class][i][1]    = g_iPlayerUpgrade[index][1];
            
g_iTopPlayerUpgrade[class][i][2]    = g_iPlayerUpgrade[index][2];
            
g_iTopPlayerUpgrade[class][i][3]    = g_iPlayerUpgrade[index][3];
            
            
client_printc(0"%s Congratulations !t%s!n. You are ranked !g%i!n for the !g%s!n class!"PREFIXszNamepos 1, class);
            return;
        }
    }


All this does is make the server shut down once the function is called; without any errors as well. It's driving me insane so if anyone can tell me what i'm doing wrong it'd be GREATLY appreciated :cry:

Edit: I looked at the file that holds the top player info and it appears the function above works fine, yet it still crashes...

Code:

[Special Ops]

"v.fuct" "STEAM_0:1:20825055" "847" "4" "0" "0" "3" "5"
"" "" "0" "0" "0" "0" "0" "0"
"" "" "0" "0" "0" "0" "0" "0"
"" "" "0" "0" "0" "0" "0" "0"
"" "" "0" "0" "0" "0" "0" "0"
"" "" "0" "0" "0" "0" "0" "0"
"" "" "0" "0" "0" "0" "0" "0"
"" "" "0" "0" "0" "0" "0" "0"
"" "" "0" "0" "0" "0" "0" "0"
"" "" "0" "0" "0" "0" "0" "0"


shadow.hk 06-13-2010 03:01

Re: Server Shutdown When Checking Top Player Stats
 
Nevermind, got it. Trash please.


All times are GMT -4. The time now is 14:52.

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