IsHash
This function was added in DSL 9
Description
Check if a hash (returned by functions like ObjectNameToHashID
) is equal to a number represented by a string. The string is specified in hexadecimal.
function IsHash(hash, check) --[[ ... ]] end
Parameters
hash
:userdata
- The hash to check.check
:string
- The hexadecimal string to compare against.
Return Values
equal
:boolean
- Returnstrue
if the hash is equal to the number represented by the string, otherwisefalse
.
Example
Check if Jimmy is wearing the Bullworth vest by checking the hash of the clothing item:
if IsHash(ClothingGetPlayer(1), '65A6B72C') then
TextPrintString('Wearing Bullworth vest.', 0, 1)
end
.
function main()
while not SystemIsReady() do
Wait(0)
end
local hash = ObjectNameToHashID('example_object')
local isEqual = IsHash(hash, '0x12345678')
if isEqual then
print('The hash matches the specified number.')
else
print('The hash does not match the specified number.')
end
end