Is it even possible?
#1

Just wondering if it's possible to fetch all the created command list. I mean, for example I have 80 commands created in the script so, without having to write every single created commands in the commands list dialog, it would automatically fetch the newly added command in the script and update the list.

Is there any ways to do it?
Reply
#2

Try this:
-By Konstantinos

PHP код:
#include <YSI\y_amx> 

... 

static 
    list[
512], // change its value depending on how many commands you got 
    
buffer[32], 
    
count
         
while ((
count AMX_GetName(AMX_TABLE_PUBLICScountbuffer"cmd_"))) 

    if (!
strcmp(buffer"zcmd_OnGameModeInit") || !strcmp(buffer"zcmd_OnFilterScriptInit")) continue; 

    
strmid(bufferbuffer4strlen(buffer), sizeof buffer); 
    
strins(buffer"/"0sizeof buffer); 
    
strcat(list, buffersizeof list); 
    
strcat(list, "\n"sizeof list); 

print(list); 
Reply
#3

Okay, but can this code be modified so I don't have to use y_amx?

I know it would be faster but I don't have YSI library and I don't plan to use it either regarding it's size.
Reply
#4

A simple GetPublicName function
PHP код:
stock GetPublicName(idxbuffer[32]) {
    if(
idx >= 0) {
        new
            
publics,
            
natives
        
;
        
#emit lctrl 1
        #emit const.alt 32
        #emit sub.alt
        #emit stor.s.pri publics
        #emit add.c 4
        #emit stor.s.pri natives
        #emit lref.s.pri natives
        #emit stor.s.pri natives
        #emit lref.s.pri publics
        #emit load.s.alt idx
        #emit shl.c.alt 3
        #emit add
        #emit stor.s.pri publics
        
if(publics natives) {
            
#emit lctrl 1
            #emit move.alt
            #emit load.s.pri publics
            #emit add.c 4
            #emit sub
            #emit stor.s.pri publics
            #emit lref.s.pri publics
            #emit sub
            #emit stor.s.pri natives
            
for(idx 0; ; natives += 4) {
                
#emit lref.s.pri natives
                #emit stor.s.pri publics
                
if((buffer[idx++] = publics 0xFF) == EOS || (buffer[idx++] = publics >> 0xFF) == EOS || (buffer[idx++] = publics >> 16 0xFF) == EOS || (buffer[idx++] = publics >>> 24) == EOS) {
                    return 
idx;
                }
            }
        }
    }
    return 
0;

PHP код:
// global
new
    
gCmdList[512// change its value depending on how many commands you got 
;
// OnGameModeInit
    
new
        
i,
        
buffer[32]
    ;
    while(
GetPublicName(ibuffer)) {
        if(
strcmp(buffer"cmd_"false4) == 0) {
            
buffer[2] = '\n';
            
buffer[3] = '/';
            
strcat(gCmdListbuffer[2]);
        }
        
i++;
    }
    print(
gCmdList[1]); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)