Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Cool down system by ππ ·π */
- cooldown <- {};
- TimeLeft <- {};
- function SetCooldown(p, taime) {
- cooldown.rawget(p.Name).rawset("Time", time() + taime);
- }
- onPlayerJoin:
- cooldown.rawset(player.Name, {} );
- if ( TimeLeft.rawin(player.UniqueID) )
- {
- local R = TimeLeft.rawget(player.UniqueID);
- local S = time() + R;
- cooldown.rawget(player.Name).rawset("Time", S);
- TimeLeft.rawdelete(player.UniqueID);
- }
- onPlayerPart:
- if ( cooldown.rawget(player.Name).rawin("Time") && cooldown.rawget(player.Name) ["Time"] > 0 )
- {
- local remainingtime = cooldown.rawget(player.Name) ["Time"] - time();
- TimeLeft.rawset(player.UniqueID, remainingtime);
- }
- onPlayerCommand:
- if ( cooldown.rawget(player.Name).rawin("Time") && cooldown.rawget(player.Name) ["Time"] > time() ) return MessagePlayer(format("Kindly wait %i seconds.", cooldown.rawget(player.Name) ["Time"] - time()), player);
- At the end of onPlayerCommand function end or below the last command ending:
- SetCooldown(player, 20); // It'll set 20 seconds as default time, use this function to set cooldowns.
- /*
- π ΄ππ °π Όπ Ώπ »π ΄:
- SetCooldown(player, 10); //set the instance(player)'s cooldown to 10 seconds. Remember: don't use time in milliseconds or it'll goto hours lol or you can edit it to milliseconds on your own..
- SetCooldown(player, 120); //2 minute cooldown
- SetCooldown(plr, 180); //3 minute cooldown for other instance plr. */
- /* Any bugs, feel free to report on discord: Shy#3344 :) */
Add Comment
Please, Sign In to add comment