20.05.2016, 10:33
A simple GetPublicName function
PHP код:
stock GetPublicName(idx, buffer[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 >> 8 & 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(i, buffer)) {
if(strcmp(buffer, "cmd_", false, 4) == 0) {
buffer[2] = '\n';
buffer[3] = '/';
strcat(gCmdList, buffer[2]);
}
i++;
}
print(gCmdList[1]);