Raised This Month: $32 Target: $400
 8% 

Solved [Req] Invalid cellvector handle provided (8:1:1)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 04-26-2019 , 01:21   [Req] Invalid cellvector handle provided (8:1:1)
Reply With Quote #1

I would be appreciated if someone can checkout the sma attached.

These Errors i got from console: L 04/25/2019 - 128:00: Invalid cellvector handle provided (8:1:1)
L 04/25/2019 - 128:00: [AMXX] Displaying debug trace (plugin "played_time.amxx")
L 04/25/2019 - 128:00: [AMXX] Run time error 10: native error (native "ArrayGetString")
L 04/25/2019 - 128:00: [AMXX] [0] played_time.sma::getter (line 160)
L 04/25/2019 - 128:00: [AMXX] [1] played_time.sma::show_top15 (line 107)



PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <nvault_util>
#include <fakemeta>
 
#define PLUGIN "Time Played"
#define VERSION "0.1"
#define AUTHOR "[LF] | Dr.Freeman"
 
new g_msgSayText;
 
new 
TotalPlayedTime[33];
static const 
Green[] = "^x04"
static const Team[] = "^x03"

new cv_prune
 
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR );
    
register_clcmd("say /pt""Time")
    
register_clcmd("say /pttop15""show_top15")
    
register_concmd("amx_playedtime""admin_showptime"ADMIN_KICK," <#Player Name> - Details about playedtime.");
    
g_msgSayText get_user_msgid("SayText")
    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged")
    
    
cv_prune register_cvar("amx_pt_prune","30")
}

public 
plugin_cfg(){
    new 
vault nvault_open("Played_Time")
    new 
prune_time=(get_systime()-(get_pcvar_num(cv_prune)*86400))
    
nvault_prune(vault,0prune_time)
    
nvault_close(vault)
}
 
public 
Time(id
{
    static 
ctime[64], timep;
        
    
timep get_user_time(id1) / 60;
    
get_time("%H:%M:%S"ctime63);
        
    
ChatColor(id"%s[Asia_Game] Current time played: %s[%d] %sminute%s.",GreenTeamtimepGreentimep == "" "s");
    
ChatColor(id"%s[Asia_Game] Total time played: %s[%d] %sminute%s."GreenTeamtimep+TotalPlayedTime[id], Greentimep+TotalPlayedTime[id] == "" "s");
}
 
public 
admin_showptime(id,level,cid
{
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED;
    
    static 
arg[32];
    
read_argv(1arg31);
    
    new 
player cmd_target(idarg2);
    
    if(!
player)
        return 
PLUGIN_HANDLED;
    
    static 
name[32];
    
get_user_name(playername31);
    
    static 
timepctime[64];
    
    
timep get_user_time(player1) / 60;
    
get_time("%H:%M:%S"ctime63);
    
    
console_print(id"-----------------------(#PlayedTime#)-----------------------");
    
console_print(id"[Asia_Game]%s Current played time %d minute%s.",nametimeptimep == "" "s");
    
console_print(id"[Asia_Game]%s's Total played time: %d minute%s.",nametimep+TotalPlayedTime[player], timep == "" "s"); // new
    
console_print(id"-----------------------------------------------------------------");
    
    return 
PLUGIN_HANDLED;
}
 
public 
show_top15(id){
    new 
pos,key[64],data[64],timestamp
    
new vault nvault_util_open("Played_Time")
    new 
count nvault_util_count(vault)
    
    new Array:
stats,Trie:names
    stats 
ArrayCreate(20)
    
names TrieCreate()
    
    new 
temp[20],knum[5]

    for (new 
i=1;i<=count;i++ ){
        
pos nvault_util_read(vault,pos,key,64,data,64,timestamp)
        
formatex(temp,19,"%d %d",i,str_to_num(data))
        
ArrayPushString(stats,temp)
        
replace_all(key,64,"PLAYEDTIME","")
        
formatex(knum,4,"%d",i)
        
TrieSetString(names,knum,key)
    }
    
    
nvault_util_close(vault)
    
ArraySort(stats,"sorter")
    
    new 
motd[1501],iLen;
    
iLen format(motdsizeof motd 1,"<body bgcolor=#000000><font color=#98f5ff><pre>");
    
iLen += format(motd[iLen], (sizeof motd 1) - iLen,"%s %-22.22s %3s^n""#""Name""Time in Minutes")
    
    for(new 
015x++){
        new 
rank,name[32],srank[5]
        new 
pt getter(stats,x,rank)
        
formatex(srank,4,"%d",rank)
        
TrieGetString(names,srank,name,31)
        
iLen += format(motd[iLen], (sizeof motd 1) - iLen,"%d %-22.22s %d^n"1namept);
    }
    
iLen += format(motd[iLen], (sizeof motd 1) - iLen,"</body></font></pre>")
    
    
ArrayDestroy(stats)
    
TrieDestroy(names)
/*
    static Sort[33][2];
    new players[32],num,count,index;
    get_players(players,num);
 
    for(new i = 0; i < num; i++){
        index = players[i];
        Sort[count][0] = index;
        Sort[count][1] = TotalPlayedTime[index];
        count++;
    }
 
    SortCustom2D(Sort,count,"compare_xp");
    new motd[1501],iLen;
    iLen = format(motd, sizeof motd - 1,"<body bgcolor=#000000><font color=#98f5ff><pre>");
    iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%s %-22.22s %3s^n", "#", "Name", "Time in Minutes");
 
    new y = clamp(count,0,10);
    new name[32],kindex;
 
    for(new x = 0; x < y; x++){
        kindex = Sort[x][0];
        get_user_name(kindex,name,sizeof name - 1);
        iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%d %-22.22s %d^n", x + 1, name, Sort[x][1]);
    }
    iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"</body></font></pre>");*/
    
show_motd(id,motd"XP Top 10");
}

public 
sorter(Array:array,item1,item2){
    new 
res1=getter(array,item1)
    new 
res2=getter(array,item2)
    
    if(
res1<res2)
        return 
1
    
    
else if(res1>res2)
        return -
1

    
return 0
}

getter(Array:array,item,&rank=0){
    new 
outa[32],temp[2][10],val
    ArrayGetString
(array,item,outa,31)
    
parse(outa,temp[0],9,temp[1],9)
    
rank str_to_num(temp[0])
    
val str_to_num(temp[1])
    return 
val
}
 
public 
ClientUserInfoChanged(id

    static const 
name[] = "name" 
    
static szOldName[32], szNewName[32
    
pev(idpev_netnameszOldNamecharsmax(szOldName)) 
    if( 
szOldName[0] ) 
    {
        
get_user_info(idnameszNewNamecharsmax(szNewName)) 
        if( !
equal(szOldNameszNewName) ) 
        {
            
TotalPlayedTime[id] = 0
            set_task
(0.5"ChangeTime"id)
            return 
FMRES_HANDLED 
        
}
    }
    return 
FMRES_IGNORED 
}
 
public 
ChangeTime(id)
{
    
TotalPlayedTime[id] = LoadTime(id)
}
 
public 
client_disconnect(id)
{
    
TotalPlayedTime[id] = TotalPlayedTime[id] + (get_user_time(id)/60);
    
SaveTime(idTotalPlayedTime[id]);
}
 
public 
client_putinserver(id)
{
    
TotalPlayedTime[id] = LoadTime(id);
}
 
public 
LoadTimeid 
{
    new 
valut nvault_open("Played_Time")
    
    new 
szName[33];
    new 
vaultkey[64], vaultdata[64];
    
    
get_user_name(idszName32);
    
    
format(vaultkey63"PLAYEDTIME%s"szName);
    
    
nvault_get(valutvaultkeyvaultdata63);
    
nvault_close(valut);
    
    return 
str_to_num(vaultdata);
}
 
public 
SaveTime(id,PlayedTime)
{
    new 
valut nvault_open("Played_Time")
    
    if(
valut == INVALID_HANDLE)
        
set_fail_state("nValut returned invalid handle")
    
    new 
szName[33];
    new 
vaultkey[64], vaultdata[64];
    
    
get_user_name(idszName32)
    
    
format(vaultkey63"PLAYEDTIME%s"szName); 
    
format(vaultdata63"%d"PlayedTime); 
    
    
nvault_set(valutvaultkeyvaultdata);
    
nvault_close(valut);
}
 
stock ChatColor(const id, const input[], any:...) 
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
    if (
idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLE,g_msgSayText,_players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

Thanks.
Attached Files
File Type: sma Get Plugin or Get Source (played_time.sma - 73 views - 6.9 KB)

Last edited by LearninG; 09-04-2019 at 08:47.
LearninG is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 04-26-2019 , 04:36   Re: [Req] Invalid cellvector handle provided (8:1:1)
Reply With Quote #2

or if u just tell me what to change in the PHP code to solve error that will be enough too. thanks
LearninG is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-26-2019 , 08:40   Re: [Req] Invalid cellvector handle provided (8:1:1)
Reply With Quote #3

Changes are highlighted in red.

Code:
public show_top15(id){ 
    new pos,key[64],data[64],timestamp 
    new vault = nvault_util_open("Played_Time") 
    new count = nvault_util_count(vault) 
     
    new Array:stats,Trie:names 
    stats = ArrayCreate(20) 
    names = TrieCreate() 
     
    new temp[20],knum[5] 

    for (new i=1;i<=count;i++ ){ 
        pos = nvault_util_read(vault,pos,key,64,data,64,timestamp) 
        formatex(temp,19,"%d %d",i,str_to_num(data)) 
        ArrayPushString(stats,temp) 
        replace_all(key,64,"PLAYEDTIME","") 
        formatex(knum,4,"%d",i) 
        TrieSetString(names,knum,key) 
    } 
     
    nvault_util_close(vault) 
    ArraySort(stats,"sorter") 
     
    new motd[1501],iLen; 
    iLen = format(motd, sizeof motd - 1,"<body bgcolor=#000000><font color=#98f5ff><pre>"); 
    iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%s %-22.22s %3s^n", "#", "Name", "Time in Minutes") 
     
    for(new x = 0, k = min(ArraySize(stats),15); x < k; x++){ 
        new rank,name[32],srank[5] 
        new pt = getter(stats,x,rank) 
        formatex(srank,4,"%d",rank) 
        TrieGetString(names,srank,name,31) 
        iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%d %-22.22s %d^n", x + 1, name, pt); 
    } 
    iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"</body></font></pre>") 
     
    ArrayDestroy(stats) 
    TrieDestroy(names) 
/* 
    static Sort[33][2]; 
    new players[32],num,count,index; 
    get_players(players,num); 
  
    for(new i = 0; i < num; i++){ 
        index = players[i]; 
        Sort[count][0] = index; 
        Sort[count][1] = TotalPlayedTime[index]; 
        count++; 
    } 
  
    SortCustom2D(Sort,count,"compare_xp"); 
    new motd[1501],iLen; 
    iLen = format(motd, sizeof motd - 1,"<body bgcolor=#000000><font color=#98f5ff><pre>"); 
    iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%s %-22.22s %3s^n", "#", "Name", "Time in Minutes"); 
  
    new y = clamp(count,0,10); 
    new name[32],kindex; 
  
    for(new x = 0; x < y; x++){ 
        kindex = Sort[x][0]; 
        get_user_name(kindex,name,sizeof name - 1); 
        iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%d %-22.22s %d^n", x + 1, name, Sort[x][1]); 
    } 
    iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"</body></font></pre>");*/ 
    show_motd(id,motd, "XP Top 10"); 
}
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 04-26-2019 , 09:05   Re: [Req] Invalid cellvector handle provided (8:1:1)
Reply With Quote #4

Quote:
Originally Posted by Natsheh View Post
Changes are highlighted in red.

Code:
public show_top15(id){ 
    new pos,key[64],data[64],timestamp 
    new vault = nvault_util_open("Played_Time") 
    new count = nvault_util_count(vault) 
     
    new Array:stats,Trie:names 
    stats = ArrayCreate(20) 
    names = TrieCreate() 
     
    new temp[20],knum[5] 

    for (new i=1;i<=count;i++ ){ 
        pos = nvault_util_read(vault,pos,key,64,data,64,timestamp) 
        formatex(temp,19,"%d %d",i,str_to_num(data)) 
        ArrayPushString(stats,temp) 
        replace_all(key,64,"PLAYEDTIME","") 
        formatex(knum,4,"%d",i) 
        TrieSetString(names,knum,key) 
    } 
     
    nvault_util_close(vault) 
    ArraySort(stats,"sorter") 
     
    new motd[1501],iLen; 
    iLen = format(motd, sizeof motd - 1,"<body bgcolor=#000000><font color=#98f5ff><pre>"); 
    iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%s %-22.22s %3s^n", "#", "Name", "Time in Minutes") 
     
    for(new x = 0, k = min(ArraySize(stats),15); x < k; x++){ 
        new rank,name[32],srank[5] 
        new pt = getter(stats,x,rank) 
        formatex(srank,4,"%d",rank) 
        TrieGetString(names,srank,name,31) 
        iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%d %-22.22s %d^n", x + 1, name, pt); 
    } 
    iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"</body></font></pre>") 
     
    ArrayDestroy(stats) 
    TrieDestroy(names) 
/* 
    static Sort[33][2]; 
    new players[32],num,count,index; 
    get_players(players,num); 
  
    for(new i = 0; i < num; i++){ 
        index = players[i]; 
        Sort[count][0] = index; 
        Sort[count][1] = TotalPlayedTime[index]; 
        count++; 
    } 
  
    SortCustom2D(Sort,count,"compare_xp"); 
    new motd[1501],iLen; 
    iLen = format(motd, sizeof motd - 1,"<body bgcolor=#000000><font color=#98f5ff><pre>"); 
    iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%s %-22.22s %3s^n", "#", "Name", "Time in Minutes"); 
  
    new y = clamp(count,0,10); 
    new name[32],kindex; 
  
    for(new x = 0; x < y; x++){ 
        kindex = Sort[x][0]; 
        get_user_name(kindex,name,sizeof name - 1); 
        iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"%d %-22.22s %d^n", x + 1, name, Sort[x][1]); 
    } 
    iLen += format(motd[iLen], (sizeof motd - 1) - iLen,"</body></font></pre>");*/ 
    show_motd(id,motd, "XP Top 10"); 
}

Thank you so much it worked!!!
LearninG is offline
Reply


Thread Tools
Display Modes

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


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