PDA

Просмотр полной версии : Plugins


charly911
17.06.2009, 10:32
Hello! i am trying to make a simple plugin, but i have some questions.
I am using v3.5.12.120.

I have not realy understood how to use it.
Is this ok?? :

Example pck -> RequestDropItem

pck = 12 79 A9 00 10 01 00 00 00 C6 E9 00 00 A7 5A FF FF 2C F4 FF FF

12 -> Package ID
79 A9 00 10 -> Object ID
01 00 00 00 -> Count
C6 E9 00 00 -> X
A7 5A FF FF -> Y
2C F4 FF FF -> Z

pck.pckId -> Package ID
So, if (pck.pckId=$12) -> True
if (pck.pckId=$79) -> False

pck.data[]
So, if (pck.data[1]=$12) -> True (Package ID) //yep
if (pck.data[2]=$79) -> True (Package no 2) //yep

ReadDEx()
So, if (ps.ReadDEx(pck,6)=1) -> True (01 00 00 00) Count //nop. ps.ReadDEx(pck.data,6); pck => size(2byte)data(size-2 byte) right now you reading this part [00 10 01 00]

//=====================

Sending.

buf:=#$4A#$00#$00#$00#$00;
WriteD(2);
WriteS(msg);
SendToClientEx(PlayerName);

==== Equal to ====

with ps do begin
buf:=HexToString('4A 00 00 00 00'); //оr buf:=#$4A#$00#$00#$00#$00;
WriteD(buf,2); -> = buf := buf+#$02#$00#$00#$00 ?? //yep
WriteS(buf,msg); //correct.
SendPacketStr(buf,PlayerName,False); -> PlayerName = 'TKBelCrt' <- is this ok?? //epic fail XD look 3rd post.
end;
Ty, Charly.

NLObP
17.06.2009, 10:45
IMHO
In plug-ins all offsets +1. The package starts with its size
0000 size
0002 ID
...

alexteam
17.06.2009, 13:00
NLObP (http://javascript%3Cb%3E%3C/b%3E:insertNick%28%27NLObP%27,%20%2732297%27%29;), not really.

recive packet:
TPacket = packed record case Integer of
0: (Size: Word;
Data: array[0..$FFFD] of Byte);
1: (PacketAsByteArray: array[0..$FFFF] of Byte);
2: (PacketAsCharArray: TCharArray);
3: (pckSize: Word;
pckId: Byte;
pckData: array[0..$FFFC] of Byte);
end;

TOnPacket = procedure(const cnt: Cardinal; const fromServer: Boolean; const connectionname:string; var packet : tpacket); stdcall;

packet.Data equal to pck in scripts.


sending packet:
procedure SendPacketStr(pck: string; const tid: integer; const ToServer: Boolean); override;

you can obtain tid by
function getConnectioidByName(name : string):integer; override;

charly911
17.06.2009, 19:47
OK, then

pck.data[2]+pck.data[3]+pck.data[4]+pck.data[5] = (ps.ReadDEx(pck,4) ?

and

with ps do begin
buf:=HexToString('4A 00 00 00 00');
WriteD(buf,2);
WriteS(buf,msg);
SendPacketStr(buf,getConnectioidByName(PlayerName) ,False); ?
end;


Ty, Charly.

alexteam
17.06.2009, 19:56
pck.data[2]+pck.data[3]+pck.data[4]+pck.data[5] = (ps.ReadDEx(pck,4) ?
not really... at last data its a byte array.. in facts its goint this way ->

pck.data[5]*256*256*256+pck.data[4]*256*256+pck.data[3]*256+pck.data[2] = (ps.ReadDEx(pck,4)

charly911
17.06.2009, 20:09
OK, i understood.
Thanks.

Charly.

charly911
19.06.2009, 06:01
Hi, i tryed to work with the plugin, but i get an error :P
I know the problem is in this piece of code, but i do not know where :


procedure OnLoad; stdcall;
var buf : string;
begin
with ps do
begin
buf:=HexToString('4A 00 00 00 00');
WriteD(buf,2);
WriteS(buf,'Hola');
SendPacketStr(buf,ConnectInfo.ConnectID,False);
end;
end;

***************************
Also tryed:

procedure OnLoad; stdcall;
var buf : string;
begin
with ps do begin
buf:=HexToString('4A 00 00 00 00');
WriteD(buf,2);
WriteS(buf,'Hola');
SendPacketStr(buf,getConnectioidByName(PlayerName) ,False); // Const, PlayerName = 'Asd';
end;
end;


Error i get:

================================================== ============================
= 18/06/2009 21:53:04 =
================================================== ============================
Access violation at address 00000000. Read of address 00000000.

Exception class: EAccessViolation
Exception message: Access violation at address 00000000. Read of address 00000000.
Exception address: 00000000
------------------------------------------------------------------------------
Stack list, generated 18/06/2009 21:53:04
(0027DE6E){l2ph.exe } [133BEE6E] uPluginData.TPlugin.LoadPlugin (Line 710, "units\uPluginData.pas" + 33) + $3
(0026D37A){l2ph.exe } [133AE37A] uPlugins.TfPlugins.clbPluginsListClickCheck (Line 132, "units\uPlugins.pas" + 5) + $E
(0011C9B1){l2ph.exe } [1325D9B1] CheckLst.TCheckListBox.ClickCheck + $15
(0011C992){l2ph.exe } [1325D992] CheckLst.TCheckListBox.ToggleClickCheck + $66
(0011C8E6){l2ph.exe } [1325D8E6] CheckLst.TCheckListBox.MouseDown + $8E
(000A9B4A){l2ph.exe } [131EAB4A] Controls.TControl.DoMouseDown + $76
(000A9B96){l2ph.exe } [131EAB96] Controls.TControl.WMLButtonDown + $3E
(0008871D){l2ph.exe } [131C971D] StdCtrls.TCustomListBox.WMLButtonDown + $69
(000A9DF2){l2ph.exe } [131EADF2] Controls.TControl.WMMouseMove + $6E
(000A98DC){l2ph.exe } [131EA8DC] Controls.TControl.WndProc + $188
(000014BC){l2ph.exe } [131424BC] System.SysFreeMem + $164
(000014E4){l2ph.exe } [131424E4] System.SysFreeMem + $18C
(00001A5D){l2ph.exe } [13142A5D] System.@FreeMem + $5
(000014BC){l2ph.exe } [131424BC] System.SysFreeMem + $164
(000014E4){l2ph.exe } [131424E4] System.SysFreeMem + $18C
(000014BC){l2ph.exe } [131424BC] System.SysFreeMem + $164
(000014E4){l2ph.exe } [131424E4] System.SysFreeMem + $18C
(000AC93B){l2ph.exe } [131ED93B] Controls.TWinControl.WndProc + $157
(0009297D){l2ph.exe } [131D397D] Forms.TCustomForm.WndProc + $421
(000237CC){l2ph.exe } [131647CC] Classes.TThreadList.UnlockList + $4
(000377E0){l2ph.exe } [131787E0] Graphics.FreeMemoryContexts + $98
(000AC5B8){l2ph.exe } [131ED5B8] Controls.TWinControl.MainWndProc + $2C
(000AC5CD){l2ph.exe } [131ED5CD] Controls.TWinControl.MainWndProc + $41
(000AC7A1){l2ph.exe } [131ED7A1] Controls.TWinControl.IsControlMouseMsg + $51
(000AC93B){l2ph.exe } [131ED93B] Controls.TWinControl.WndProc + $157
(000886A6){l2ph.exe } [131C96A6] StdCtrls.TCustomListBox.WndProc + $5A
(000AC5B8){l2ph.exe } [131ED5B8] Controls.TWinControl.MainWndProc + $2C
(000303DC){l2ph.exe } [131713DC] Classes.StdWndProc + $14
(0003B956){l2ph.exe } [1317C956] Contnrs.TComponentList.GetItems + $A
(00098E73){l2ph.exe } [131D9E73] Forms.TApplication.ProcessMessage + $83
(00098EAA){l2ph.exe } [131D9EAA] Forms.TApplication.HandleMessage + $A
(000990CA){l2ph.exe } [131DA0CA] Forms.TApplication.Run + $96
(0028407F){l2ph.exe } [133C507F] l2ph.l2ph (Line 88, "" + 26) + $2
------------------------------------------------------------------------------
System : Windows XP Professional, Version: 5.1, Build: A28, "Service Pack 2"
Processor: Intel, Intel(R) Core(TM)2 CPU 6300 @ 1.86GHz, 1866 MHz MMX 64 bits
Memory: 2047; free 1005
Display : 1280x1024 pixels, 32 bpp
------------------------------------------------------------------------------
List of loaded modules:
[01090000] E:\L2phx\Phx\LSPprovider.dll
<00400000> (no version info)
[01590000] E:\L2phx\Phx 3.5.x\plugins\PruebaPlugin.dll
<00400000> (no version info)
[13140000] E:\L2phx\Phx 3.5.x\l2ph.exe
3.5.12.120 - 3.5.12.120
[5B150000] C:\WINDOWS\system32\uxtheme.dll
6.0.2900.2180 - 6.00.2900.2180 (xpsp_sp2_rtm.040803-2158)
Biblioteca UxTheme de Microsoft
[66740000] C:\WINDOWS\system32\hnetcfg.dll
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
Administrador de configuración de redes domésticas
[719D0000] C:\WINDOWS\system32\mswsock.dll
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
Proveedor de servicios de Microsoft Windows Sockets 2.0
[71A10000] C:\WINDOWS\System32\wshtcpip.dll
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
Windows Sockets Helper DLL
[71A20000] C:\WINDOWS\system32\WS2HELP.dll
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
Ayuda de Windows Socket 2.0 para Windows NT
[71A30000] C:\WINDOWS\system32\WS2_32.dll
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
Windows Socket 2.0 32-Bit DLL
[71A50000] C:\WINDOWS\system32\wsock32.dll
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
Archivo DLL de 32 bits de Windows Socket
[72F80000] C:\WINDOWS\system32\winspool.drv
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
Controlador de administración de colas para Windows
[74DC0000] C:\WINDOWS\system32\RICHED20.DLL
5.30.23.1228 - 5.30.23.1228
Rich Text Edit Control, v3.0
[75160000] C:\WINDOWS\system32\msctfime.ime
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
Microsoft Text Frame Work Service IME
[76340000] C:\WINDOWS\system32\imm32.dll
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
Windows XP IMM32 API Client DLL
[76360000] C:\WINDOWS\system32\comdlg32.dll
6.0.2900.2180 - 6.00.2900.2180 (xpsp_sp2_rtm.040803-2158)
DLL de diálogos comunes
[76BB0000] C:\WINDOWS\system32\PSAPI.dll
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
Process Status Helper
[770F0000] C:\WINDOWS\system32\oleaut32.dll
5.1.2600.3266 - 5.1.2600.3266
[773A0000] C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
6.0.2900.2982 - 6.0 (xpsp.060825-0040)
User Experience Controls Library
[774B0000] C:\WINDOWS\system32\ole32.dll
5.1.2600.2726 - 5.1.2600.2726 (xpsp_sp2_gdr.050725-1528)
Microsoft OLE para Windows
[77BD0000] C:\WINDOWS\system32\version.dll
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
Version Checking and File Installation Libraries
[77BE0000] C:\WINDOWS\system32\msvcrt.dll
7.0.2600.2180 - 7.0.2600.2180 (xpsp_sp2_rtm.040803-2158)
Windows NT CRT DLL
[77DA0000] C:\WINDOWS\system32\advapi32.dll
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
API base de Windows 32 avanzado
[77E50000] C:\WINDOWS\system32\RPCRT4.dll
5.1.2600.3173 - 5.1.2600.3173 (xpsp_sp2_qfe.070709-0052)
Remote Procedure Call Runtime
[77EF0000] C:\WINDOWS\system32\GDI32.dll
5.1.2600.3099 - 5.1.2600.3099 (xpsp_sp2_qfe.070308-0217)
GDI Client DLL
[77F40000] C:\WINDOWS\system32\SHLWAPI.dll
6.0.2900.3020 - 6.00.2900.3020 (xpsp.061023-0222)
Biblioteca de utilidades de Shell
[7C800000] C:\WINDOWS\system32\kernel32.dll
5.1.2600.3119 - 5.1.2600.3119 (xpsp_sp2_gdr.070416-1301)
DLL de cliente API BASE de Windows NT
[7C910000] C:\WINDOWS\system32\ntdll.dll
5.1.2600.2180 - 5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
DLL de la capa de Windows NT
[7C9D0000] C:\WINDOWS\system32\shell32.dll
6.0.2900.2951 - 6.00.2900.2951 (xpsp.060713-0238)
DLL común del shell de Windows
[7E1E0000] C:\WINDOWS\system32\oledlg.dll
5.1.2600.3016 - 1.0 (xpsp_sp2_gdr.061016-0148)
Compatibilidad con interfaz de usuario de OLE 2.0 de Microsoft Windows(TM)
[7E390000] C:\WINDOWS\system32\user32.dll
5.1.2600.3099 - 5.1.2600.3099 (xpsp_sp2_qfe.070308-0217)
DLL de cliente USER API de Windows XP
------------------------------------------------------------------------------
Active Controls hierarchy:
TCheckListBox "clbPluginsList"
TGroupBox "GroupBox5"
TfPlugins "fPlugins"
------------------------------------------------------------------------------


Ty, Charly.

PS: L2ph v3.5.12.120

QaK
19.06.2009, 09:18
charly911, do you have "ps" variable in "var" block in the plugin?

charly911
19.06.2009, 09:45
Yes, when i compile it everything seems ok, no errors...
Code:

library PruebaPlugin;

{$define Release} // для совместимости с релизом пакетхака, при дебуге можно закоментировать

uses
FastMM4,
usharedstructs;
const PlayerName = 'PentA';
var {version} {revision}
min_ver_a: array[0..3] of Byte = ( 3,4,1, 46 );
min_ver: Integer absolute min_ver_a; // минимальная поддерживаемая версия программы
ps: TPluginStruct; // структура передаваемая в плагин

// Обязательно вызываемая функция.
// Должна вернуть описание плагина,
// заодно может проверить версию программы
function GetPluginInfo(const ver: Integer): PChar; stdcall;
begin
if ver<min_ver then
Result:='Демонстрационный Plugin к программе l2phx'+sLineBreak+
'Для версий 3.4.0+'+sLineBreak+
'У вас старая версия программы! Плагин не сможет корректно с ней работать!'
else
Result:='Демонстрационный Plugin к программе l2phx'+sLineBreak+
'Для версий 3.4.0+';
end;

// Обязательно вызываемая функция.
// Получает структуру с ссылками на все функции основной программы,
// которые могут вызываться из плагина.
// Если вернёт False то плагин выгружается.
function SetStruct(const struct: TPluginStruct): Boolean; stdcall;
begin
ps:=struct;
Result:=True;
end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при установки соединения (cnt) с клиентом (withServer=False)
// или сервером (withServer=True)
procedure OnConnect(const cnt: Cardinal; // номер соединения
const withServer: Boolean); stdcall; // с сервером?
begin

end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при разрыве соединения (cnt) с клиентом (withServer=False)
// или сервером (withServer=True)
procedure OnDisconnect(const cnt: Cardinal; // номер соединения
const withServer: Boolean); stdcall; // с сервером?
begin

end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при выгрузке плагине
procedure OnFree; stdcall;
begin

end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при загрузке плагине
procedure OnLoad; stdcall;
var buf : string;
begin
with ps do
begin
buf:=HexToString('4A 00 00 00 00');
WriteD(buf,2);
WriteS(buf,'Hola');
SendPacketStr(buf,ConnectInfo.ConnectID,False);
end;
end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при вызове скриптовой функции обьявленной в RefreshPrecompile
function OnCallMethod(const MethodName: String; // имя функции в верхнем регистре
var Params, // параметры функции
FuncResult: Variant // результат функции
): Boolean; stdcall; // если вернёт True то дальнейшая
// обработка функции прекратиться
begin
Result:=False; // передаём обработку функции программе
if MethodName='PI' then begin
Result:=True; // запрещаем дальнейшую обработку функции в программе
FuncResult:=Pi;
end;
end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается перед компиляцией скриптов
function OnRefreshPrecompile(var funcs: TStringArray): Integer; stdcall;
begin
SetLength(funcs,1); // указываем количество добавляемых в скрипт функций
funcs[0]:='function Pi:Extended'; // одна из добавляемых функций
end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при приходе пакета, параметры:
// cnt - номер соединения
// fromServer - если пакет от сервера равна True, если от клиента то False
// pck - собственно пакет (в виде массива)
procedure OnPacket(const cnt: Cardinal; const fromServer: Boolean; var pck:
TPacket); stdcall;
begin
if pck.size<3 then exit; // на случай если предыдущие плагины обнулили пакет
end;

// экспортируем используемые программой функции
exports
GetPluginInfo,
SetStruct,
OnPacket,
OnConnect,
OnDisconnect,
OnLoad,
OnFree,
OnCallMethod,
OnRefreshPrecompile;

begin
end.


Charly.

QaK
19.06.2009, 09:55
ConnectInfo - where is the description of this variable?

charly911
19.06.2009, 10:02
uses
FastMM4,
usharedstructs; <-- Here
-------
ConnectInfo : tConnectInfo;

tConnectInfo = packed record
ConnectID:integer;
ConnectName:string[200];
end;
------

alexteam
19.06.2009, 13:05
seems like its crashes here
with ps docoz ps = nil..

so.. its mean that you missed that part.
function SetStruct(const struct: PPluginStruct): Boolean; stdcall;
begin
ps := struct^;
Result:=True;
end;Добавлено через 4 минуты
your plugin must contain this code (every plugin MUST)


library plugname;
uses
FastMM4,
usharedstructs;

var
ps: TPluginStruct;


function GetPluginInfo(const ver: Integer): PChar; stdcall;
begin
Result:='Plugindescription';
end;

function SetStruct(const struct: PPluginStruct): Boolean; stdcall;
begin
ps := struct^;
Result:=True;
end;

exports
GetPluginInfo,
SetStruct;

begin
end.

Добавлено через 11 минут
also. about
ps.ConnectInfo

before using it you must call ps.GoFirstConnection

example
with ps do
begin
if GoFirstConnection then
begin
//now ConnectInfo contains data of first active connection in ph.
//so we can use it.

end
else
begin
//ph dont have intercepted connections.
end;

end;

Добавлено через 7 минут
we got GoNextConnection function. its used to enumerate all present connections.

example

buf := 'we want send this data to all intercepted connections';
with ps do
if GoFirstConnection then
repeat
SendPacketStr(buf, ConnectInfo.ConnectID, False);
until GoNextConnection;

charly911
19.06.2009, 18:58
Hi alexteam, i have in the plugin all you told me, but i still get an error.
I will describe yo step by step what i did:

Open RAD 2007
File -> New -> Other.. -> DLL Wizard
Paste code.
Build -> OK
Compile -> OK
Copy new dll to {L2phDir}/plugins
Start L2ph
Open L2 -> Login
Conection intercepted
Activate plugin
¡¡ Error !!
:(

Charly.

alexteam
19.06.2009, 19:19
can you post it's source ?

charly911
19.06.2009, 19:33
Here you are:

library PruebaPlugin;

{$define Release} // для совместимости с релизом пакетхака, при дебуге можно закоментировать

uses
FastMM4,
usharedstructs;
const PlayerName = 'PentA';
var {version} {revision}
min_ver_a: array[0..3] of Byte = ( 3,4,1, 46 );
min_ver: Integer absolute min_ver_a; // минимальная поддерживаемая версия программы
ps: TPluginStruct; // структура передаваемая в плагин

// Обязательно вызываемая функция.
// Должна вернуть описание плагина,
// заодно может проверить версию программы
function GetPluginInfo(const ver: Integer): PChar; stdcall;
begin
if ver<min_ver then
Result:='Демонстрационный Plugin к программе l2phx'+sLineBreak+
'Для версий 3.4.0+'+sLineBreak+
'У вас старая версия программы! Плагин не сможет корректно с ней работать!'
else
Result:='Демонстрационный Plugin к программе l2phx'+sLineBreak+
'Для версий 3.4.0+';
end;

// Обязательно вызываемая функция.
// Получает структуру с ссылками на все функции основной программы,
// которые могут вызываться из плагина.
// Если вернёт False то плагин выгружается.
function SetStruct(const struct: TPluginStruct): Boolean; stdcall;
begin
ps:=struct;
Result:=True;
end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при установки соединения (cnt) с клиентом (withServer=False)
// или сервером (withServer=True)
procedure OnConnect(const cnt: Cardinal; // номер соединения
const withServer: Boolean); stdcall; // с сервером?
begin

end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при разрыве соединения (cnt) с клиентом (withServer=False)
// или сервером (withServer=True)
procedure OnDisconnect(const cnt: Cardinal; // номер соединения
const withServer: Boolean); stdcall; // с сервером?
begin

end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при выгрузке плагине
procedure OnFree; stdcall;
begin

end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при загрузке плагине
procedure OnLoad; stdcall;
var buf : string;
begin
with ps do
begin
if GoFirstConnection then
begin
buf:=HexToString('4A 00 00 00 00');
WriteD(buf,2);
WriteS(buf,'Hola');
SendPacketStr(buf,ConnectInfo.ConnectID,False);
end;
end;
end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при вызове скриптовой функции обьявленной в RefreshPrecompile
function OnCallMethod(const MethodName: String; // имя функции в верхнем регистре
var Params, // параметры функции
FuncResult: Variant // результат функции
): Boolean; stdcall; // если вернёт True то дальнейшая
// обработка функции прекратиться
begin
Result:=False; // передаём обработку функции программе
if MethodName='PI' then begin
Result:=True; // запрещаем дальнейшую обработку функции в программе
FuncResult:=Pi;
end;
end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается перед компиляцией скриптов
function OnRefreshPrecompile(var funcs: TStringArray): Integer; stdcall;
begin
SetLength(funcs,1); // указываем количество добавляемых в скрипт функций
funcs[0]:='function Pi:Extended'; // одна из добавляемых функций
end;

// Необязательно вызываемая функция. (может отсутствовать в плагине)
// Вызывается при приходе пакета, параметры:
// cnt - номер соединения
// fromServer - если пакет от сервера равна True, если от клиента то False
// pck - собственно пакет (в виде массива)
procedure OnPacket(const cnt: Cardinal; const fromServer: Boolean; var pck:
TPacket); stdcall;
begin
if pck.size<3 then exit; // на случай если предыдущие плагины обнулили пакет
end;

// экспортируем используемые программой функции
exports
GetPluginInfo,
SetStruct,
OnPacket,
OnConnect,
OnDisconnect,
OnLoad,
OnFree,
OnCallMethod,
OnRefreshPrecompile;

begin
end.


Charly.

alexteam
19.06.2009, 19:50
one thing... my fail....

function SetStruct(const struct: PPluginStruct): Boolean; stdcall;
begin
ps := struct^;
Result:=True;
end;

charly911
19.06.2009, 19:58
ps := struct^; Error : pointer type required o.O

Charly.

alexteam
19.06.2009, 20:00
SetStruct(const struct: PPluginStruct)

charly911
19.06.2009, 20:12
Compiled, built, but still getting error, im going crazy :(


Access violation at address 013952C4 in module 'PruebaPlugin.dll'. Write of address 1325C4A0.

Exception class: EAccessViolation
Exception message: Access violation at address 013952C4 in module 'PruebaPlugin.dll'. Write of address 1325C4A0.
Exception address: 013952C4


Charly.

alexteam
19.06.2009, 21:43
procedure OnPacket(const cnt: Cardinal; const fromServer: Boolean; const connectionname:string; var pck: TPacket); stdcall;

Добавлено через 3 минуты
fully work project.
http://ifile.it/qfbtl7c
i hope its will be usefull.

charly911
19.06.2009, 23:51
Works :D
After the pck is sent i get a pointer error, press ok, an app continues running, so dont worry about it, i will look for a solution.

Many thanks, Charly.

alexteam
19.06.2009, 23:58
erms... in my proj i got no pointer errors :X

charly911
20.06.2009, 00:58
:P ok, what version are you using??
I will look for the error at night, as i have to go to university...
Then ill post for a solution (if i find the issue :P).

Charly.

alexteam
20.06.2009, 01:12
:P ok, what version are you using??

12.120

charly911
20.06.2009, 01:29
PC restarted, and error :D

Charly.

PS: Is any other way to contact you. I am translating you help file to english and spanish, but there are some words i dont understand....
MSN: cristian.colombo@hotmail.com
ICQ: 557499875

alexteam
20.06.2009, 01:44
ask here if need.

charly911
20.06.2009, 06:37
Invalid pointer operation apeared again -.-
---------------------------------------------
What shoud say here?? :
http://img193.imageshack.us/img193/2659/menuajp.th.jpg (http://img193.imageshack.us/i/menuajp.jpg/)

Charly.

alexteam
20.06.2009, 12:44
http://i.piccy.info/i3/ea/ca/7c8e1fd969632a94774ad90e664c.jpeg

QaK
20.06.2009, 13:16
alexteam, как в плугинах заюзать:
if FromServer and Pck.pckid=$4A then s:=reads(8)
?
А то что-то s:=ps.ReadS(pck.PacketAsCharArray,8) не читается ...

alexteam
20.06.2009, 13:25
ps.ReadS(pck.pckData,8)