Jump to content

[HELP] addDebugHook


#Major .

Recommended Posts

-- Server  
function GHook(sourceResource, functionName, isAllowedByACL, luaFilename, luaLineNumber, ...)
    		local args = {...}
    		outputChatBox("!")
    		if getElementType(args[1]) == 'player' then
    		SetWeapon(args[1])
    		end
    		end	
        addDebugHook('postFunction', GHook, {'giveWeapon','setWeaponAmmo','takeWeapon'})

Why does the code not work on the  { giveWeapon, setWeaponAmmo, takeWeapon } function, but it works on other functions

Edited by *RayaN-Alharbi.
Link to comment

from what i see it should work, but after putting it in the notepad++ i noticed some weird font in the addDebugScript line, you added some Arabic symbols in that line before the quotes- ' - which is considered as "Unicode" symbols, can't be used in LUA outside the string quotes so you will need to re-write that line, try this: 

addDebugHook('postFunction', GHook, {'giveWeapon','setWeaponAmmo','takeWeapon'})

even when you paste it here in the "Code" insertion you will notice it as a huge dot or something, however you will need also to remove any writing decorators you recently added and so. also you can check for the Unicode characters with this website https://apps.timwhitlock.info/unicode/inspect

Link to comment
8 hours ago, savour said:

from what i see it should work, but after putting it in the notepad++ i noticed some weird font in the addDebugScript line, you added some Arabic symbols in that line before the quotes- ' - which is considered as "Unicode" symbols, can't be used in LUA outside the string quotes so you will need to re-write that line, try this:  


addDebugHook('postFunction', GHook, {'giveWeapon','setWeaponAmmo','takeWeapon'})

even when you paste it here in the "Code" insertion you will notice it as a huge dot or something, however you will need also to remove any writing decorators you recently added and so. also you can check for the Unicode characters with this website https://apps.timwhitlock.info/unicode/inspect

Actually I did not understand you well but this code works well with other functions like getPlayerSerial or getPedTotalAmmo but it does not work with previous functions

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...