Forum

> > CS2D > Scripts > Hooks system
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Hooks system

8 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Hooks system

aleksix
User Off Offline

Zitieren
Does anyone know the algorithm used in hook system? It looks like you can't attach more than 3 functions with the default priority to one hook without any problems. They just cease to work!

alt Re: Hooks system

Alistaire
User Off Offline

Zitieren
You can put everything in the same hooked function, don't hook multiple functions to the same hook dude.

alt Re: Hooks system

aleksix
User Off Offline

Zitieren
Zitat
You can put everything in the same hooked function, don't hook multiple functions to the same hook dude.


Sure, but it makes code harder to read.

Zitat
Well, that's why the priority function does exists.


Still,I didn't see any scripts using it. This fact causes some bugs and "conflicts".

alt Re: Hooks system

Alistaire
User Off Offline

Zitieren
user aleksix hat geschrieben
Zitat
You can put everything in the same hooked function, don't hook multiple functions to the same hook dude.


Sure, but it makes code harder to read.

Zitat
Well, that's why the priority function does exists.


Still,I didn't see any scripts using it. This fact causes some bugs and "conflicts".


If you just throw everything in the same hook, it looks way better. And don't ever use multiple addhooks in one script, it looks terrible and people can tell you're a noob.

alt Re: Hooks system

Avo
User Off Offline

Zitieren
More than one function isn't bad as well, but you have to use 3rd argument to addhook. You can deactivate easily part of your code in-game then. In the other hand, user Alistaire is right - usually newbies use it, becouse pro-scripters don't get mind blocker seeing everything in one function.

alt Re: Hooks system

aleksix
User Off Offline

Zitieren
Backward-engineering is not that good. Someone would like to change the code. Even a good,well-documented code can be rather tricky to learn/remember.

alt Re: Hooks system

Alistaire
User Off Offline

Zitieren
user aleksix hat geschrieben
Backward-engineering is not that good. Someone would like to change the code. Even a good,well-documented code can be rather tricky to learn/remember.


Where the fuck are you trying to go with this post.

alt Re: Hooks system

Starkkz
Moderator Off Offline

Zitieren
All the time I've done scripts I never used the priority parameter, it gives a lot of bugs when you are using more functions. So I agree with user Alistaire, you should put your script inside a single hooked function to avoid bugs.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht