Raised This Month: $ Target: $400
 0% 

Prokreedz edit top10 problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kinoute
New Member
Join Date: Jan 2007
Old 02-05-2007 , 00:35   Re: Prokreedz edit top10 problem
Reply With Quote #1

Anyone ?
kinoute is offline
drx
New Member
Join Date: Mar 2007
Location: Germany
Old 03-10-2007 , 18:03   Re: Prokreedz edit top10 problem
Reply With Quote #2

hi

didnt test it that much, so its not gueranteed that its bugfree (if you find some, pls post theme here).

here it is:


replace your whole topten_update function with this:
PHP Code:
getTopTenPlace(id) {
        
    new 
currentMap[32];
    
get_mapname(currentMap32);
    
    new 
topTenVault[64];
    
format(topTenVault64"pk_%s"currentMap);
    
    new 
kzTime;    
    
kzTime get_systime() - timer_time[id-1];
    
    new 
vault nvault_open(topTenVault);
    new 
vaultKey[8];
    new 
vaultReturn[128];
    new 
arg1[32], arg2[8];
    
    new 
ret;
    
    if(
vault != INVALID_HANDLE) {
        
        for(new 
1<= 10i++) {
        
            
format(vaultKey8"%d"i);
            
            
nvault_get(vaultvaultKeyvaultReturn128);
            
            if(
parse(vaultReturnarg132arg28) != 0) {
                
                if(
kzTime str_to_num(arg2)) {
                
                    
ret i;
                    break;
                
                } else {
                
                    
ret 0;
                
                }
            
            } else {
                
                
ret i;
                break;
            
            }
        
        }
        
    }
    
    
nvault_close(vault);
    
    return 
ret;
}

// ==================

isPlayerInTopTen(id) {

    new 
userName[32];
    
get_user_name(iduserName32);

    new 
currentMap[32];
    
get_mapname(currentMap32);
    
    new 
topTenVault[64];
    
format(topTenVault64"pk_%s"currentMap);
    
    new 
vault nvault_open(topTenVault);
    new 
vaultKey[8];
    new 
vaultReturn[128];
    new 
arg1[32], arg2[8];
    
    new 
ret;
    
    if(
vault != INVALID_HANDLE) {
    
        for(new 
1<= 10i++) {
        
            
format(vaultKey8"%d"i);
            
            
nvault_get(vaultvaultKeyvaultReturn128);
            
            if(
parse(vaultReturnarg132arg28) != && equal(userNamearg1)) {
            
                
ret i;
                break;
            
            } else {
            
                
ret 0;
            
            }
        
        }
    
    }
    
    
nvault_close(vault);
    
    return 
ret;
}

// ==================

showTime(idnewPlace) {

    new 
userName[32];
    
get_user_name(iduserName32);
    
    new 
kzTime;    
    
kzTime get_systime() - timer_time[id-1];
    
    new 
minutesseconds
                        
    
if((kzTime 60.0) >= 1) {

        
minutes floatround(kzTime 60.0,floatround_floor);
        
kzTime -= (floatround(kzTime60.0,floatround_floor) * 60);
        
seconds kzTime;
        
    } else {
        
        
minutes 0;
        
seconds kzTime;
    
    }

    
set_hudmessage(255255255, -1.0, -1.0);
    
    if(
newPlace == 1) {
    
        
show_hudmessage(0"%s finished the map in %d min %d sec and established a new record"userNameminutesseconds);
        
    } else if(
newPlace == 0) {
    
        
show_hudmessage(0"%s finished the map in %d min %d sec"userNameminutesseconds);
    
    } else {
    
        
show_hudmessage(0"%s finished the map in %d min %d sec and established a new Top10 time"userNameminutesseconds);
    
    }

}

// ==================

public topten_update(id) {
    
    new 
newPlace getTopTenPlace(id);
    
    new 
oldPlace isPlayerInTopTen(id);
    
    new 
userName[32];
    
get_user_name(iduserName32);

    new 
currentMap[32];
    
get_mapname(currentMap32);
    
    new 
kzTime;    
    
kzTime get_systime() - timer_time[id-1];
    
    new 
vaultEntry[128];
    
format(vaultEntry128"^"%s^" ^"%d^" ^"%d^""userNamekzTimecheckpointnum[id-1]);
    
    new 
topTenVault[64];
    
format(topTenVault64"pk_%s"currentMap);
    
    new 
vault nvault_open(topTenVault);
    
    if(
oldPlace 0) {
    
        if(
newPlace ) {
        
            new 
key[8];
            
            if(
newPlace oldPlace) {
        
                
format(key8"%d"oldPlace);
                
nvault_remove(vaultkey);
                
                for(new 
oldPlace10i++) {
                
                    new 
temp[128], tempKey[8]
                    
format(tempKey,8,"%d",i+1)
                    
nvault_get(vault,tempKey,temp,128)
                    
                    if(!
equal(temp,"")) {
                        
format(tempKey,8,"%d",i)
                        
nvault_pset(vault,tempKey,temp)
                    }
                    
                }
                
                for(new 
10newPlacei--) {
                
                    new 
temp[128], tempKey[8]
                    
format(tempKey,8,"%d",i-1)
                    
nvault_get(vault,tempKey,temp,128)
                    
                    if(!
equal(temp,"")) {
                        
format(tempKey,8,"%d",i)
                        
nvault_pset(vault,tempKey,temp)
                    }
                    
                }
                
                
format(key8"%d"newPlace);
                
nvault_pset(vaultkeyvaultEntry);
            
            } else if(
newPlace == oldPlace) {
                
                
format(key8"%d"oldPlace);
                
nvault_remove(vaultkey);
                
format(key8"%d"newPlace);
                
nvault_pset(vaultkeyvaultEntry);
            
            }
            
            
showTime(idnewPlace);
            
        
        } 
        
    } else {
    
        if(
newPlace 0) {
        
            for(new 
10newPlacei--) {
            
                new 
temp[128], tempKey[8]
                
format(tempKey,8,"%d",i-1)
                
nvault_get(vault,tempKey,temp,128)
                
                if(!
equal(temp,"")) {
                    
format(tempKey,8,"%d",i)
                    
nvault_pset(vault,tempKey,temp)
                }
                
            }
            
            new 
key[8];

            
format(key8"%d"newPlace);
            
nvault_pset(vaultkeyvaultEntry);
            
            
showTime(idnewPlace);
        
        } 
    
    }
    
    
nvault_close(vault);
    


Last edited by drx; 03-10-2007 at 18:08.
drx is offline
Send a message via ICQ to drx
aDr.
Member
Join Date: Oct 2006
Old 04-27-2007 , 05:21   Re: Prokreedz edit top10 problem
Reply With Quote #3

Works on Windows , but on linux dont work
Attached Files
File Type: sma Get Plugin or Get Source (prokreedz.sma - 717 views - 44.8 KB)
__________________
aDr. 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 00:40.


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