AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   kz_top 15 for lan servers (https://forums.alliedmods.net/showthread.php?t=27438)

me_lju_aix 04-22-2006 08:34

kz_top 15 for lan servers
 
Code:
/************************************************************************************************************************/ /******************************************************* Top 15 *********************************************************/ /************************************************************************************************************************/ public check_top15(id) {     if (get_cvar_num("kz_top15")!=1)         return     new name[32],authid[32]     get_user_name( id, name, 31 )     get_user_authid( id, authid ,31 )     new sPlayerScore[10], sHighScore[10], iPlayerScore, iHighScore     new sMins[33],sSecs[33],sHuns[33]     new sMinsScore[33],sSecsScore[33],sHunsScore[33]     FormatTime(gMins[id],gSecs[id],gHuns[id],sMins,sSecs,sHuns)     format(sPlayerScore,9,"%s%s%s",sMins,sSecs,sHuns)     FormatTime(gMinsScore[14],gSecsScore[14],gHunsScore[14],sMinsScore,sSecsScore,sHunsScore)     format(sHighScore,9,"%s%s%s",sMinsScore,sSecsScore,sHunsScore)     iPlayerScore = str_to_num(sPlayerScore)     iHighScore = str_to_num(sHighScore)     if( iPlayerScore < iHighScore) {         for( new i = 0; i < 15; i++ ) {             FormatTime(gMinsScore[i],gSecsScore[i],gHunsScore[i],sMinsScore,sSecsScore,sHunsScore)             format(sHighScore,9,"%s%s%s",sMinsScore,sSecsScore,sHunsScore)             iHighScore = str_to_num(sHighScore)             if( iPlayerScore < iHighScore) {                 new pos = i                 while( !equal( gAuthScore[pos], authid ) && pos < 14 )                     pos++                 for( new j = pos; j > i; j-- ) {                     format( gAuthScore[j], 32, gAuthScore[j-1] )                     format( gNameScore[j], 32, gNameScore[j-1] )                     gMinsScore[j] = gMinsScore[j-1]                     gSecsScore[j] = gSecsScore[j-1]                     gHunsScore[j] = gHunsScore[j-1]                     gChecksScore[j] = gChecksScore[j-1]                 }                             format( gAuthScore[i], 32, authid )                 format( gNameScore[i], 32, name )                 gMinsScore[i] = gMins[id]                 gSecsScore[i] = gSecs[id]                 gHunsScore[i] = gHuns[id]                 gChecksScore[i] = gChecks[id]                 save_top15()                 return             }             if( equal( gAuthScore[i], authid ) )                 return         }       }     return } public save_top15() {     if (get_cvar_num("kz_top15")!=1)         return PLUGIN_HANDLED     new cMap[32]     get_mapname(cMap, 31)     new cScoreFile[128]     format(cScoreFile, 127, "%s/%s.txt", gScorePath, cMap)     if( file_exists(cScoreFile) )           delete_file(cScoreFile)         for( new i = 0; i < 15; i++ ) {         if( gMinsScore[i] == 0 && gSecsScore[i] == 0 && gHunsScore[i] == 0)             return PLUGIN_HANDLED             new TextToSave[1024],sNameScore[33]         format(sNameScore, 127, "^"%s^"", gNameScore[i])         format(TextToSave,sizeof(TextToSave),"%s %s %d %d %d %d",gAuthScore[i],sNameScore,gMinsScore[i],gSecsScore[i],gHunsScore[i],gChecksScore[i])         write_file(cScoreFile, TextToSave)     }     return PLUGIN_HANDLED } public read_top15() {     if (get_cvar_num("kz_top15")!=1)         return PLUGIN_HANDLED     for( new i = 0 ; i < 15; ++i) {         gAuthScore[i] = "X"         gNameScore[i] = "X"         gMinsScore[i] = 9999999         gSecsScore[i] = 0         gHunsScore[i] = 0         gChecksScore[i] = 9999999     }     new cMap[32]     get_mapname(cMap, 31)     new cScoreFile[128]     format(cScoreFile, 127, "%s/%s.txt", gScorePath, cMap)             if(file_exists(cScoreFile) == 1) {         new line, stxtsize         new data[192]         new tAuth[32],tName[32],tMins[10],tSecs[10],tHuns[10],tChecks[10]         for(line = 0; line < 15; ++line) {             read_file(cScoreFile,line,data,191,stxtsize)             parse(data,tAuth,31,tName,31,tMins,9,tSecs,9,tHuns,9,tChecks,9)             format(gAuthScore[line],sizeof(gAuthScore),tAuth)             format(gNameScore[line],sizeof(gNameScore),tName)             gMinsScore[line] = str_to_num(tMins)             gSecsScore[line] = str_to_num(tSecs)             gHunsScore[line] = str_to_num(tHuns)             gChecksScore[line] = str_to_num(tChecks)         }     }else{         server_cmd("echo [KZ] Error!!! Failed To Load ^"%s^"!!!",cScoreFile)         log_message("[KZ] Error!!! Failed To Load ^"%s^"!!!",cScoreFile)     }     return PLUGIN_HANDLED } public show_top15( id ) {     if (get_cvar_num("kz_top15")!=1) {         client_print(id,print_chat,"[KZ] Top15 is disabled ")         return PLUGIN_HANDLED     }             new buffer[2048]     new line[256]             new len = format( buffer, 2047, "<table cellspacing=0 rules=all border=2 frame=border>" )     if (get_cvar_num("kz_checkpoints")==1) {         len += format( buffer[len], 2047-len, "<tr><th> # <th> Nick <th> Climb time <th> Checkpoints" )     }else{         len += format( buffer[len], 2047-len, "<tr><th> # <th> Nick <th> Climb time" )     }     for(new i = 0; i < 15; ++i) {               if( gMinsScore[i] == 9999999 && gSecsScore[i] == 0 && gHunsScore[i] == 0 && gChecksScore[i] == 9999999)             if (get_cvar_num("kz_checkpoints")==1) {                 format(line, 255, "<tr><td> %d. <td> %s <td> %s <td> %s", (i+1), "&lt;----------&gt;", "&lt;not set&gt;", "&lt;not set&gt;" )             }else{                 format(line, 255, "<tr><td> %d. <td> %s <td> %s", (i+1), "&lt;----------&gt;", "&lt;not set&gt;" )             }         else             if (get_cvar_num("kz_checkpoints")==1) {                 format(line, 255, "<tr><td> %d. <td> %s <td> (%d:%d:%d) <td> (%d)", (i+1), gNameScore[i], gMinsScore[i] , gSecsScore[i], gHunsScore[i], gChecksScore[i] )             }else{                 format(line, 255, "<tr><td> %d. <td> %s <td> (%d:%d:%d)", (i+1), gNameScore[i], gMinsScore[i] , gSecsScore[i], gHunsScore[i]    )                       }         len += format( buffer[len], 2047-len, line )     }         format(line, 255, "</table>" )     len += format( buffer[len], 2047-len, line )             show_motd( id, buffer, "Top 15 Climbers" )      return PLUGIN_HANDLED }

Hello ! this is top15 part from kz_multiplugin !! the problem is i have Lan server an the top15 is writing Steam_ID , and when i place my score ok i am at 1.place but when some on beat my time he overwrite me !!
its posible to change the top ?

i tried to do only get errors :)

sorry for eng

me_lju_aix 04-23-2006 09:35

realy no help? or I am to stupid to answer me :evil:

_KaszpiR_ 04-23-2006 10:28

find in script any get_user_authid( id, authid ,31 ) and change it to get_user_ip( id, authid ,31 )


All times are GMT -4. The time now is 05:12.

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