Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Scripted by Foereaper, assited by Alex and Laurea
- local cooldowns = {};
- function Player:SetLuaCooldown(seconds, opt_id)
- assert(type(self) == "userdata");
- seconds = assert(tonumber(seconds));
- opt_id = opt_id or 1;
- local guid, source = self:GetGUIDLow(), debug.getinfo(2, 'S').short_src;
- if (not cooldowns[guid]) then
- cooldowns[guid] = { [source] = {}; };
- end
- cooldowns[guid][source][opt_id] = os.clock() + seconds;
- end
- function Player:GetLuaCooldown(opt_id)
- assert(type(self) == "userdata");
- local guid, source = self:GetGUIDLow(), debug.getinfo(2, 'S').short_src;
- opt_id = opt_id or 1;
- if (not cooldowns[guid]) then
- cooldowns[guid] = { [source] = {}; };
- end
- local cd = cooldowns[guid][source][opt_id];
- if (not cd or cd < os.clock()) then
- cooldowns[guid][source][opt_id] = 0
- return 0;
- else
- return cooldowns[guid][source][opt_id] - os.clock();
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement