mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-28 23:01:29 +00:00
return on improper usage
This commit is contained in:
@@ -401,6 +401,10 @@ function Player:AddMethod(methodName, handler)
|
||||
if Player[methodName] then
|
||||
return false
|
||||
end
|
||||
if type(handler) ~= 'function' then
|
||||
print(('Error: Player:AddMethod - %s is not a function'):format(methodName))
|
||||
return false
|
||||
end
|
||||
Player[methodName] = handler
|
||||
return true
|
||||
end
|
||||
@@ -409,6 +413,10 @@ function Player:AddField(fieldName, data)
|
||||
if Player[fieldName] then
|
||||
return false
|
||||
end
|
||||
if type(data) == 'function' then
|
||||
print(('Error: Player:AddField - %s is a function, not a field'):format(fieldName))
|
||||
return false
|
||||
end
|
||||
Player[fieldName] = data
|
||||
return true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user