Register for your free account! | Forgot your password?

You last visited: Today at 00:03

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Lua] Eventhooks erstellen

Discussion on [Lua] Eventhooks erstellen within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1
 
Mijago's Avatar
 
elite*gold: 191
Join Date: May 2009
Posts: 1,214
Received Thanks: 2,597
[Lua] Eventhooks erstellen

Dieser Thread ist eine Kopie meines Releases im . Ich gebe in ePvP keinen aktiven Support mehr.

Diese Funktion gibt euch die möglichkeit, in jeder .lua sog. Hooks zu erstellen.
Ein Hook ist in unserem Fall nichts anderes als eine Funktion, die bei bestimmten Events ausgeführt wird.

PHP Code:
create_folder = function(path)
    
local pp ''
    
for i in string.gfind(path,'([%w_\-]*/)') do
        
pp pp..i
        os
.execute('if [ ! -d '..pp..' ]; then mkdir '..pp..'; fi')
    
end
end
hooks 
= {__data ={}}
hooks.add = function(typ,func)
    
hooks.__data[typ] = hooks.__data[typ] or {}
    
table.insert(hooks.__data[typ],func)
end
setmetatable
(hooks,{__newindex hooks.__data__index hooks.__data})

create_folder('locale/germany/quest/object/state/hooker_ptr')
local fi io.open('locale/germany/quest/object/state/hooker_ptr','w'); fi:write('hooker_ptr={["start"]=0}'); fi:close()
for 
i,l in {"button","enter","info","kill","leave","letter","levelup","login","logout","target","unmount"} do
    
create_folder('locale/germany/quest/object/notarget/'..l..'/hooker_ptr.start')
    
local fi io.open('locale/germany/quest/object/notarget/'..l..'/hooker_ptr.start','w')
    
fi:write('table.foreach(hooks.'..l..' or {},function(i,l) l() end)')
    
fi:close()
end 

Ein Hook könnte zB folgendermaßen aussehen:
PHP Code:
hooks.add('login',function()
    
notice('Willkommen, '..pc.get_name()..'.')
end
Ihr könnt damit jede beliebige Funktion aufrufen.
PHP Code:
local function test()
    
notice('Willkommen, '..pc.get_name()..'.')
end
hooks
.add('login',test
Mögliche Werte für Hooks: "button","enter","info","kill","leave","letter","l evelup","login","logout","target","unmount"

Tested!
Mijago is offline  
Thanks
15 Users
Old 10/15/2012, 15:23   #2
 
Lauling's Avatar
 
elite*gold: 315
Join Date: Jun 2012
Posts: 5,158
Received Thanks: 4,814
ah sehr interessant, danke fürs teilen werd ich mir mal genauer angucken.

mfg
Lauling is offline  
Old 10/15/2012, 15:44   #3

 
IgorGlock's Avatar
 
elite*gold: 1862
Join Date: Jan 2009
Posts: 3,725
Received Thanks: 7,671
Wie immer hochqualitativ&nützlich für ein oder anderen HobbyCoder
IgorGlock is offline  
Old 10/15/2012, 16:31   #4
 
elite*gold: 0
Join Date: Jan 2011
Posts: 1,297
Received Thanks: 1,295
Sehr gut gemacht
He3o Sippel is offline  
Old 10/15/2012, 16:46   #5
 
.Iscariot's Avatar
 
elite*gold: 37
Join Date: Jan 2010
Posts: 2,035
Received Thanks: 1,706
super ! Danke
.Iscariot is offline  
Reply


Similar Threads Similar Threads
[C++]Hooks
03/25/2010 - Coding Tutorials - 12 Replies
so... ich denke mal, dass ich euch eine der wichtigsten teile in sachen gamehacking hier erklären kann, oder zumindest versuchen zu erklären:p fangen wir mal damit an, was ich benutze: -Visual Studio 2008 Professional + Visual Assist X -IDA Pro Free -ein game los gehts: erstellt euch eine struktur, wodrin ihr informationen über einen hook speichert. bei mir sieht das so aus:
[c++]hooks
11/02/2009 - C/C++ - 2 Replies
brauche hilfe bei meinen hooks! ms detours will ich nich benutzen (vorallem weil die nich für meine zwecke laufen :D), ausserdem um weiterzu lernen eigenes system schreiben! mein problem is wenn ich in einer funktion die ersten 5 bytes mit jmp dword überschreibe, und z.b. das 2 byte auch nen jmp dword ist, bleibt am ende 1 byte über! in meiner subfunc speicher ich die register mit pushad, call , popad, den überschriebenen code hier einfügen, und dann jmp ....
Hooks mit VB?
04/22/2007 - .NET Languages - 21 Replies
Nabend, Ich versuch mich momentan den Tinytoon Hook hiermit zum implementieren, da mich Forceshock langsam.... :eek: Wär nett wenn jemand noch sinnvolle Beispiele dazu hätte, ua. selbst Erfahrung damit hat. Option Explicit Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long ...



All times are GMT +1. The time now is 00:04.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.