Raised This Month: $51 Target: $400
 12% 

Help buffer max string length on advanced valut by Destro


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
@LeX
Junior Member
Join Date: Nov 2018
Old 11-07-2022 , 05:22   Help buffer max string length on advanced valut by Destro
Reply With Quote #1

Hi, i recently started working with advanced vault system made by Destro and version 1.5

the plugin i want to make is ranktop, something like that.
i will try to explain, i have the following function:
PHP Code:
public ShowTop(idNum)
{
    new 
g_sort adv_vault_sort_create(g_vaultORDER_DESC602000CS_Stats[STATS_KILLS])

    new 
mvpkeyindexPlayer[32]
    
    new 
toploop min(adv_vault_sort_numresult(g_vaultg_sort), Num)

    
console_print(id,"")
    
console_print(id,"================ Top MVP ================")
    for(new 
position=Num-15 position <= toploopposition++)
    {

        if(
position >= Num+1)
            break

        
keyindex adv_vault_sort_position(g_vaultg_sortposition)
        
        if(!
adv_vault_get_prepare(g_vaultkeyindex)) continue
        
        
mvp adv_vault_get_field(g_vaultCS_Stats[STATS_MvP])
        
        
adv_vault_get_keyname(g_vaultkeyindexPlayer31)

        
console_print(id"#%d Player: %s - Total Kills: %d"positionPlayermvp)
    }
    
console_print(id,"===========================================")
    
console_print(id,"")
    
adv_vault_sort_destroy(g_vaultg_sort)

this is just an example
i want these values to be displayed in motd
just that... if i want that when... let's say a player write "/topmvp 300" in chat
to display the entire top from 1 to 300 in motd format

you already know what the problem would be, the maximum size of the buffer
i can't display elements in motd larger than... i don't know exactly... 3072?
sorry, i don't know exactly anymore

both the html code and the values from the advanced vault are stored in that buffer
and... you will realize that it will exceed the maximum size very quickly

my question is, is there any possibility to display exorbitantly large elements in that motd ?

and i mean by "exorbitant" in the pure sense.
when i specified a top from 1 to 300 it was an example
the initial value can easily exceed 2000 positions

this method will not only help me with this "ranktop" but it will also help me with other projects that i haven't finished yet and have the same problem with max buffer size.

if i'm not mistaken, someone else wanted something similar here, but the answers didn't give me a conclusive solution

Last edited by @LeX; 11-07-2022 at 05:23.
@LeX is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-07-2022 , 08:20   Re: Help buffer max string length on advanced valut by Destro
Reply With Quote #2

Simple set a task to show top10 results every interval length of time
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 11-07-2022 at 08:22.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
@LeX
Junior Member
Join Date: Nov 2018
Old 11-07-2022 , 09:43   Re: Help buffer max string length on advanced valut by Destro
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
Simple set a task to show top10 results every interval length of time
i don't think you understood me.
let me give another example
for this function:
PHP Code:
public test_top_basic(idNum)
{
    new 
Buffer[2368], Name[MAX_NAME_LENGTH*4], Lenkeyindexkillshsdeaths
    
new Float:clc
    
    formatex
(Buffercharsmax(Buffer), "<html><head><meta http-equiv=^"Content-Type^" content=^"text/htmlcharset=UTF-8^"><style>body{background:#4a4e4d;font-family:Arial}th{background:#6a8ec8;padding:10px 5px;text-align:left;font-size:18px;font-weight:600;color:#fff}td{padding:10px 5px}table{width:100%;font-size:16px;color:#000;padding:2px}#nr{width:50px}#s{background:#3D9970;padding:4px;color:#fff;border-radius:1px}#c{background:#e9e9e9}#cc{background:#ddd}#f{text-align:center}</style></head><body><table align=^"center^" cellspacing=^"0^"><tbody>");
    
Len add(Buffercharsmax(Buffer), "<tr><th id=^"nr^">#</th><th>Name</th><th>Kills</th><th>Deaths</th><th>HS %</th><th>Skill %</th></tr>");

    new 
g_sort adv_vault_sort_create(g_vaultORDER_DESC602000CS_Stats[STATS_KILLS],  CS_Stats[STATS_HEADSHOTS],  CS_Stats[STATS_DEATHS])

    new 
toploop min(adv_vault_sort_numresult(g_vaultg_sort), Num)
    for(new 
position=1position <= toploopposition++)
    {
        
keyindex adv_vault_sort_position(g_vaultg_sortposition)

        if(!
adv_vault_get_prepare(g_vaultkeyindex)) continue

        
kills        adv_vault_get_field(g_vaultCS_Stats[STATS_KILLS])
        
hs            adv_vault_get_field(g_vaultCS_Stats[STATS_HEADSHOTS])
        
deaths        adv_vault_get_field(g_vaultCS_Stats[STATS_DEATHS])

        
clc = (float(hs)*100/float(deaths))

        
adv_vault_get_keyname(g_vaultkeyindexNamecharsmax(Name))

        
Len += formatex(Buffer[Len], charsmax(Buffer), "<tr id=^"%s^"><td>%d</td><td>%s</td><td>%d</td><td>%d</td><td>%.02f%</td><td><span id=^"s^">%.02f%</span></td></tr>",((position%2)==0) ? "c" "cc"position+1Namekillsdeathsclcelo_raiting(killsdeathsgamesroundwins));
    }
    
add(Buffercharsmax(Buffer), "</tbody></table></body></html>");
    
show_motd(idBuffer"Top Rank");

the maximum length of the buffer is 2368
how could i make this buffer have a length greater than 3072 or the maximum length it supports.

as i said above, i want the buffer to print at least from 1 to 300 a top in MOTD
as i said above, this is just an example, the real top exceeds 2000 positions

theoretically i want to print absolutely everything that exists in the top from 1 to the maximum value of the positions, it can be 100000+
but to display in motd

Edit:
e.g:
for test_top_basic(id, 3000)
will it still show me the mod ?
and if not, how could i make to display the motd ?

Last edited by @LeX; 11-07-2022 at 09:57.
@LeX is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-07-2022 , 13:57   Re: Help buffer max string length on advanced valut by Destro
Reply With Quote #4

mate the motd is hard coded to 1536 chars so the solution is to show less or equal to 1536 chars per page.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 11-07-2022 at 14:00.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
@LeX
Junior Member
Join Date: Nov 2018
Old 11-07-2022 , 17:11   Re: Help buffer max string length on advanced valut by Destro
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
mate the motd is hard coded to 1536 chars so the solution is to show less or equal to 1536 chars per page.
thanks for trying


T/C please
@LeX 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 17:34.


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