Jump to content

Xdr

Members
  • Posts

    2
  • Joined

  • Last visited

Xdr's Achievements

I ordered some spaghetti with marinara sauce and I got egg noodles and ketchup. I'm an average nobody.

I ordered some spaghetti with marinara sauce and I got egg noodles and ketchup. I'm an average nobody. (2/54)

0

Reputation

  1. Xdr

    A couple questions

    Thanks SDK. I remember reading functions worked as variables, but didn't know that they could be overwritten that easily. As for the second question, in Pawn, when you included a library (which is similar to a "resource" that provides functions) and wanted to use a callback (event) such as onPlayerConnect, you would need to "hook" the callback in the library. For example, if in the main gamemode script someone had onPlayerConnect callback, and the library also used the callback, then you'd have to hook it, or call a separate function (such as onPlayerConnectEx (a custom function)). The method of hooking would eliminate this, so when the main gamemode script read the onPlayerConnect callback, it would also automatically call the one from inside the library. (It's not as complicated as it seems, I just can't find the right words to explain it) However, I don't believe that will be a problem, as resources are used differently, in Lua. I'm assuming I could run a separate resource with an event, regardless of whether or not it's already in another resource (like a gamemode)? If so, I don't need any guidance on the second question. Once again, thanks, it's much appreciated! If I have any more questions, I'll post again. EDIT: I'm sorry, but I missed the whole reason I posted in the first place Included in my first question, I meant, is it possible to replace the function with all functions not only in my resources, but all that loaded on the server. So if they included my resource, then all of the resources that use that function will call the "hooked" (or custom/replaced) function.
  2. Hello, I've started to pick up on the Lua language in the past couple of days and have a few questions; 1. Is it possible to hook functions? For example, if I wanted to make the function setPlayerMoney actually call a custom function I created, and not do what it actually does, natively. 2. Is it possible to hook events? Like with function hooks, but BOTH the custom function I create and the event that is inside the gamemode script will be called. (Or does this not need to be a problem, as it will be called anyway in the resource?) Specifically, I'm looking to hook the event when the player spawns. I'm sorry if anything what I'm asking is confusing, I'm use to using terms for the Pawn language, so may mix a few things up here and there. If I'm giving things the wrong names, please, let me know! Thanks.
×
×
  • Create New...