Quote:
Originally Posted by lucas_7_94
Em si algo por el estilo , algo asi me refiero.
Code:
#include <amxmodx>
new bit
public client_authorized( id )
bit |= ( 1 << ( id % 32 ) )
public client_disconnect( id )
bit &= ~( 1 << ( id % 32 ) )
public clcmd_hooksomethinghere( id )
{
if( bit & ( 1 << ( id % 32 ) ) )
client_print( id , print_chat, "Sos admin" )
}
|
Quote:
Originally Posted by S34Qu4K3
Dump de tu plugin luqas:
PHP Code:
No module data detected. native: client_print 0x000000BC public clcmd_hooksomethinghere(id) 0x00000008 public client_authorized(id) 0x00000060 public client_disconnect(id) codestart codeend address type name 0x00000008 0x00000060 0x0000000C local val id 0x00000060 0x000000BC 0x0000000C local val id 0x000000BC 0x00000148 0x0000000C local val id 0x00000008 0x00000148 0x00000000 global val bit 0x000000BC 0x00000148 0x000000BC public clcmd_hooksomethinghere 0x00000008 0x00000060 0x00000008 public client_authorized 0x00000060 0x000000BC 0x00000060 public client_disconnect 0x00000000 new bit
0x8 PROC ; public client_authorized(id) 0xC BREAK ; bits_luqas.sma:4 0x10 BREAK ; bits_luqas.sma:5 0x14 LOAD.pri 0x0 ; bit 0x1C PUSH.pri 0x20 CONST.pri 0x20 ; "in" 0x28 LOAD.S.alt 0xC ; id 0x30 SDIV.alt 0x34 MOVE.pri 0x38 CONST.alt 0x1 ; 0x53000000 (1392508928.00000) 0x40 XCHG 0x44 SHL 0x2B 0x4C OR 0x50 STOR.pri 0x0 ; bit 0x58 ZERO.pri 0x5C RETN 0x60 PROC ; public client_disconnect(id) 0x64 BREAK ; bits_luqas.sma:7 0x68 BREAK ; bits_luqas.sma:8 0x6C LOAD.pri 0x0 ; bit 0x74 PUSH.pri 0x78 CONST.pri 0x20 ; "in" 0x80 LOAD.S.alt 0xC ; id 0x88 SDIV.alt 0x8C MOVE.pri 0x90 CONST.alt 0x1 ; 0x53000000 (1392508928.00000) 0x98 XCHG 0x9C SHL 0x56 0xA4 POP.alt 0xA8 AND 0xAC STOR.pri 0x0 ; bit 0xB4 ZERO.pri 0xB8 RETN 0xBC PROC ; public clcmd_hooksomethinghere(id ) 0xC0 BREAK ; bits_luqas.sma:11 0xC4 BREAK ; bits_luqas.sma:13 0xC8 LOAD.pri 0x0 ; bit 0xD0 PUSH.pri 0xD4 CONST.pri 0x20 ; "in" 0xDC LOAD.S.alt 0xC ; id 0xE4 SDIV.alt 0xE8 MOVE.pri 0xEC CONST.alt 0x1 ; 0x53000000 (1392508928.00000) 0xF4 XCHG 0xF8 SHL 0x2B 0x100 AND 0x104 JZER 0x140 ; jump_0 0x10C BREAK ; bits_luqas.sma:14 0x110 PUSH.C 0x4 ; "Sos admin" 0x118 PUSH.C 0x3 ; 0x5300 0x120 PUSH.S 0xC ; id 0x128 PUSH.C 0xC 0x130 SYSREQ.C 0x0 ; client_print 0x138 STACK 0x10 ; free 4 cells 0x140 ZERO.pri ; target:jump_0 0x144 RETN
Parece complicadito asi que estoy planeando dejar el soporte para bits para el final, asi que al principio habra que aguantarse un poco porque no habra soporte para ellos :S
@Gladius
parse_gvars.cpp
PHP Code:
#include "main.h"
using namespace std;
void parse_gvars(char *afile, char *output_file) { char buffer[LINE_LEN] = ""; char *substring_pointer = NULL;
ifstream gstream(afile); fstream input(output_file, ios::app); //ios::app writes to the end of the file
printf("----------------------------------------------------\n"); printf("Parsing global vars...\n");
while(!gstream.eof()) { erase_array(buffer);
gstream.getline(buffer, LINE_LEN);
if(strncmp(buffer,"0x0", 3) == 0) //If strncmp retuns 0, there are equal { if(substring_pointer = strstr(buffer,"new")) { for(int i=11; i<LINE_LEN; i++)//Skip the 11 first characters (hex and space) { if(buffer[i] != '\0') { cout<<buffer[i]; input<<buffer[i]; } } cout<<endl; input<<endl; } } else if(substring_pointer = strstr(buffer,"0x8")) //0x8 PROC (start of the first function) break; }
cout<<endl; input<<endl; printf("!!Global vars parsing finished!!\n\n"); printf("----------------------------------------------------\n");
gstream.close(); }
Los otros son similares, cualquier cosa que veas que se pueda mejorar, solo dimelo =)
|
Acerca del plugin de Lucas lo único que pude ver de los bits solo puedo determinar a cuántos bits representa, si es de player o de entidades o solo 1. Pero saber si setea, quita o compara es difícil ya que no da resultados correctos siempre, probé con otros bits y me daba algunos valores y otros no por ende no supe como deducir que era. Lo mejor es preguntarle a Bailopan a ver si puede ayudar en los bits.
Con respecto al code que me dejaste, te dejo este en C++
Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void parse_gvars(string input_file, string output_file)
{
fstream outfile(output_file.c_str(), fstream::out | fstream::app); //ios::app writes to the end of the file
fstream infile(input_file.c_str(), fstream::in);
cout << "----------------------------------------------------" << endl;
cout << "Parsing global vars..." << endl;
string szBuffer;
//size_t piSubString;
while(infile.eof() == 0)
{
szBuffer.clear();
getline(infile, szBuffer);
if(szBuffer.compare(szBuffer.begin(), 3, "0x0") == 0) //If strncmp retuns 0, there are equal
{
//if((piSubString = szBuffer.find("new")) != string::npos)
// string::npos = -1
if(szBuffer.find("new") != string::npos)
{
szBuffer.assign(szBuffer.begin() + 11, szBuffer.end()); //Skip the 11 first characters (hex and space)
cout << szBuffer << endl;
outfile << szBuffer << endl;
}
}
// string::npos = -1
else if((piSubString = szBuffer.find("0x8")) != string::npos) //0x8 PROC (start of the first function)
{
break;
}
}
cout << endl << "!!Global vars parsing finished!!" << endl << endl;
cout << "----------------------------------------------------" << endl;
outfile << endl;
outfile.close();
infile.close();
}
Esto te puede servir acerca de Ficheros(Archivos).
http://www.cplusplus.com/reference/iostream/fstream
http://www.cplusplus.com/reference/iostream/ofstream
http://www.cplusplus.com/reference/iostream/ifstream
Cuando usar el primero o separarlos en los 2 siguientes depende de lo que hagas.
También te adjunto algo de Strings.
http://www.cplusplus.com/reference/string/string
__________________