elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Estamos en la red social de Mastodon


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  ¿Como crear .DLL con este codigo?
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: ¿Como crear .DLL con este codigo?  (Leído 2,998 veces)
PUTIBOSS

Desconectado Desconectado

Mensajes: 9


Ver Perfil
¿Como crear .DLL con este codigo?
« en: 15 Noviembre 2010, 05:38 am »

hola amigos quiero aprender un poco sobre programacion y codear, tengo muy poco tiempo en esto y en especial quiero basarme en un juego llamado mu online, quiero codear su gameserver para agregarle cosas por mi mismo. Me encontre con este source pero no se como crear la dll con el he visto tutoriales pero no funcionan con este codigo:

Código:
void DataSendAll(unsigned char* Packet, int Length)
{
for (int i=6400; i<7400; i++)
if(gObjIsConnected(i))
DataSend(i, Packet, Length);
}

void SendPost(int wId, LPCSTR Command, LPCSTR Text)
{
if (!IsPost) return;
if (!gObjIsConnected(wId)) return;
if (!strcmpi(Command, "/Post"))
{
MessageOutput(wId, "[%s] Usando: /Post <Msg>.", szPrefix);
MessageOutput(wId, "[%s] Preco para usar Post: %d, Level Requerido: %d", szPrefix, PostCost, PostLevel);
return;
}
gObj_SetInfo(wId);
if (gObj.Level < PostLevel)
{
MessageOutput(wId, "[%s] Voce esta level baixo para usar o /post", szPrefix);
return;
}
if (gObj.Money < PostCost)
{
MessageOutput(wId, "[%s] Voce nao tem zen suficiente para usar o /post", szPrefix);
return;
}
BYTE *Packet;
char Message[100];
Packet = (BYTE*) malloc(200);
memset(Packet, 0x00, 200);
*Packet = 0xC1;
*(Packet+2) = 0x00;
memcpy((Packet+3), gObj.Nick, strlen(gObj.Nick));
sprintf(Message, "@@[post] %s", Text);
memcpy((Packet+13), Message, strlen(Message));
int Len = (strlen(Message) + 0x13);
*(Packet+1) = Len;
DataSendAll(Packet, Len);
int Amount = (gObj.Money - PostCost);
gObj_Write(wId, gObj_Money, Amount);
MoneySend(wId, Amount);
free (Packet);
}

ese seria para un comando llamado /post. la dll la creare para hookearla a el gameserver, hookearla lo se pero en crearla estoy herrado.

me harian una clase de tutorial o guia para crearla porfavor.

de antemano gracias.

PD: aqui les dejo otros sources para comandos:

comando /add
Código:
void AddStats(int aIndex)
{
if (!IsAddCmd) return;
cObj->Init(aIndex);
if (!strcmpi(Message, "/add"))
{
MessageOutput(aIndex, "Useage: /add <Type> <Amount>");
MessageOutput(aIndex, "The price for Add is: %d, Maximum stats: %d", AddPrice, AddMax);
return;
}
if (cObj->Money < AddPrice)
{
MessageOutput(aIndex, "You are lacking zen! %d", AddPrice - cObj->Money);
return;
}
char Param1[100];
memset(Param1, 0x00, 100);
GetParam(1, Message, Param1);
int AddType = 0;
if (!strcmpi(Param1, "str")) AddType = 0xB8;
if (!strcmpi(Param1, "agi")) AddType = 0xBA;
if (!strcmpi(Param1, "vit")) AddType = 0xBC;
if (!strcmpi(Param1, "eng")) AddType = 0xBE;
if (!strcmpi(Param1, "cmd")) AddType = 0xD8;
if (!AddType)
{
MessageOutput(aIndex, "You have selected wrong type! The types are: str, agi, vit, eng, cmd");
return;
}
if (cObj->Class != 4 && AddType == 0xD8)
{
MessageOutput(aIndex, "Only Dark Lords can use the add cmd type.");
return;
}
char Param2[100];
memset(Param2, 0x00, 100);
GetParam(2, Message, Param2);
int StatsToAdd = atoi(Param2);
if (cObj->LvlUpPoints < StatsToAdd)
{
MessageOutput(aIndex, "You are lacking level up points! %d", StatsToAdd - cObj->LvlUpPoints);
return;
}
int NowStats = cObj->GetWord(AddType);
if ((StatsToAdd + NowStats) > AddMax)
{
MessageOutput(aIndex, "You are not allowed to add more than %d points!", AddMax);
return;
}
BYTE Packet[5] = {0xC1, 0x05, 0x0F3, 0x06};
Packet[4] = ((AddType % 16) ^ 8) / 2; // Nice algorithm by coNsept to convert from gObj Offsets to the add types :P
if (AddType == 0xD8) Packet[4] = 0x04;
if (StatsToAdd <= 100)
for (int i=0; i<StatsToAdd; i++)
CGLevelUpPointAdd(Packet, aIndex);
else
{
int Amount = (cObj->LvlUpPoints - StatsToAdd - 1);
cObj->SetInt(0xA4, Amount);
cObj->AddInt(AddType, StatsToAdd - 1);
CGLevelUpPointAdd(Packet, aIndex);
}
cObj->SetInt(0xB4, cObj->Money - AddPrice);
CGMoneySend(aIndex, cObj->Money - AddPrice);
cObj->Init(aIndex);
MessageOutput(aIndex, "You've added %d points. You have now %d points left.", StatsToAdd, cObj->LvlUpPoints);
if (StatsToAdd > 100)
MessageOutput(aIndex, "Please relog and your stats will be updated.");


Comando /drop (/make):
Código:
void UseMakeCommand(DWORD gObjId, char * msg)
{
if(strlen(msg) < 18)
{
return;
}

int spaces = 0;
for(int i=0; i < strlen(msg); i++)
{
if(msg[i] == ' ')
spaces++;
}
if(spaces < 7)
return;

if(IsObjectGM(gObjId) == false)
{
return;
}

char * PosA;
PosA = strchr( msg , ' ' );

char * PosB;
PosB = strchr( PosA+1 , ' ' );

char * PosC;
PosC = strchr( PosB+1 , ' ' );

char * PosD;
PosD = strchr( PosC+1 , ' ' );

int ItemType, ItemNr, ItemLevel;
if(*(PosA+2) != ' ')
{
ItemType = (int)(*(PosA+1) - 48) * 10 + (int)(*(PosA+2) - 48);
}
else
{
ItemType = (*(PosA+1)) - 48;
}

if(*(PosB+2) != ' ')
{
ItemNr = (int)(*(PosB+1) - 48) * 10 + (int)(*(PosB+2) - 48);
}
else
{
ItemNr = (*(PosB+1)) - 48;
}

if(*(PosC+2) != ' ')
{
ItemLevel = (int)(*(PosC+1) - 48) * 10 + (int)(*(PosC+2) - 48);
}
else
{
ItemLevel = (*(PosC+1)) - 48;
}

int ItemSkill = (*(PosD+1)) - 48;
int ItemLuck = (*(PosD+3)) - 48;
int ItemOpt = (*(PosD+5)) - 48;
int ItemExc = (*(PosD+7)) - 48;


DWORD Item = ItemType * 512 + ItemNr;

InvItemCreate ( gObjId , GetObjectMap(gObjId) , GetObjectPosX(gObjId) , GetObjectPosY(gObjId) , Item , ItemLevel , 0 ,ItemSkill , ItemLuck, ItemOpt , -1 , ItemExc , 0 );
GCServerMsgStringSend("[Make]: You have made an item.", gObjId, 1);


En línea

Eternal Idol
Kernel coder
Moderador
***
Desconectado Desconectado

Mensajes: 5.937


Israel nunca torturó niños, ni lo volverá a hacer.


Ver Perfil WWW
Re: ¿Como crear .DLL con este codigo?
« Respuesta #1 en: 15 Noviembre 2010, 13:34 pm »

Te recomiendo que primero entiendas como funciona una DLL comun y corriente, agarres el codigo de la misma y despues trates de agregarle lo que quieras.

Consulta la MSDN, al menos DllMain.


En línea

La economía nunca ha sido libre: o la controla el Estado en beneficio del Pueblo o lo hacen los grandes consorcios en perjuicio de éste.
Juan Domingo Perón
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
como descifrar este codigo?
Criptografía
chacal0112 9 12,897 Último mensaje 20 Octubre 2013, 23:40 pm
por Anastacio
¿Como sustituyo este codigo por otro para que no salte el AV? « 1 2 »
Programación Visual Basic
xivan25 12 6,035 Último mensaje 1 Abril 2013, 15:46 pm
por raul338
Ayuda con este codigo js. Crear style dinamicamente.
Programación General
70N1 0 1,613 Último mensaje 18 Julio 2013, 10:09 am
por 70N1
Como se descifra este código
Dudas Generales
SMFSM 0 2,147 Último mensaje 26 Febrero 2014, 01:32 am
por SMFSM
⚠❓ el objetivo de este código es crear una lista de clientes para una veterinaria
Programación C/C++
ESTUDIANTE CONFUSED 2 2,535 Último mensaje 28 Septiembre 2021, 12:26 pm
por MAFUS
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines