Hooks DataSet - brianhang/nutscript2 GitHub Wiki
Description
DataSet(key, oldValue, newValue, ignoreMap, global)
This server hook is called after a data value has been set by a call to nut.data.set.
Parameters
| Name | Description |
|---|---|
key |
The string identifier for the data value. |
oldValue |
The previous set value. |
newValue |
The new set value. |
ignoreMap |
A boolean for whether or not the data is stored only for the current map. |
global |
A boolean for whether or not the data value is only for the current gamemode. |
Example
-- Kicks non-admins if admin only mode is enabled.
function GM:DataSet(key, oldValue, newValue)
if (key == "adminOnlyMode" and newValue) then
for k, v in ipairs(player.GetAll()) do
if (not v:IsAdmin()) then
v:Kick("Admin only mode enabled")
end
end
end
end