| 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], pos, i, a;
for(i = 0; i < MAX_TOP; i++)
{
// 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(a = pos; a > i; a--)
{
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(index, szName, 31);
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!", PREFIX, szName, pos + 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"
|