AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help buffer max string length on advanced valut by Destro (https://forums.alliedmods.net/showthread.php?t=340272)

@LeX 11-07-2022 05:22

Help buffer max string length on advanced valut by Destro
 
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

Natsheh 11-07-2022 08:20

Re: Help buffer max string length on advanced valut by Destro
 
Simple set a task to show top10 results every interval length of time

@LeX 11-07-2022 09:43

Re: Help buffer max string length on advanced valut by Destro
 
Quote:

Originally Posted by Natsheh (Post 2792328)
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 ?

Natsheh 11-07-2022 13:57

Re: Help buffer max string length on advanced valut by Destro
 
mate the motd is hard coded to 1536 chars so the solution is to show less or equal to 1536 chars per page.

@LeX 11-07-2022 17:11

Re: Help buffer max string length on advanced valut by Destro
 
Quote:

Originally Posted by Natsheh (Post 2792345)
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


All times are GMT -4. The time now is 20:22.

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