Thread: [Solved] Read file backwards
View Single Post
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 10-16-2019 , 23:02   Re: Read file backwards
Reply With Quote #7

Simplesmente, você le o arquivo normalmente de cima pra baixo e quando você for registrar o menu, comece do ultimo, pegando os valores decrescentes. Tipo, normalmente se utiliza o loop usando ++, é só você trocar pro --, tipo assim:

PHP Code:
// "i" will start with the MAX_VALUE readed, the loop will continue 'til the "i" be equal to or less than 0.
for(new ArraySize(g_arIniFileData);0;i--) 
E provavelmente, quando você for registrar o menu, mesmo usando o loop ao contrário, quando você for selecionar a opção ele ainda vai começar do 0 ao valor maximo que você registrar, então é necessário você passar a ID do item também pro handler, assim você pode saber que opção EXATA o jogador vai selecionar.

Basically:

Simply, you read the file normally, and when you'd create the menu, use the loop backwards, instead of increasing, you decrese the value, something like I showed. And probably, when you do register the menu, even using the reverse loop, after you select the option it'll still start from the 0 to the max value you registered without the menu_get_iteminfo, so you'll need to pass the ID of the item to the menu handler, with this, you'll be able to know which EXACT option the player would select.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 10-16-2019 at 23:11.
EFFx is offline