Addon Details

Watch - Add Favorite


CoolTime Lib ScreenShot

2 out of 2 users claim this version works for them.
Does this version work for you?
2
w00ts
w00t!2

CoolTime Lib - Version 1.0

posted on 2012-04-02 08:34:12
by Freakyy



Description

With this lib you can easily manage Cool-Times. Cool-Times are GLOBAL and usable in ESS and ESP at the same time! [b]They can even communicate.[/b] [size=150]Examples for Globalized-Cooltimes[/size] [syntax="python"] import es import cooltimelib import playerlib import gamethread def player_say(ev): # > Vars userid = ev["userid"] text = ev["text"] # > Command if text == '!noblock': if cooltimelib.can('noblock'): noblock() else: es.tell(userid, '#multi', '#green[INFO] #lightgreenPlease wait until using No-Block again!') def noblock(): for userid in playerlib.getPlayerList('#alive'): es.setplayerprop(userid, "CBaseEntity.m_CollisionGroup", '2') gamethread.delayed(10, es.setplayerprop, (userid, "CBaseEntity.m_CollisionGroup", '5')) cooltimelib.append('noblock', 15) [/syntax] The above example is clear i think, with !noblock you can activate No-Block for all alive players. After 10 seconds it will turn off again, but then you will have to wait 5 more seconds until you can use it again. If you use !noblock while noblock is enabled / the cooltime is, you will get a message. The same is possible in ESS too! [syntax="es"] event player_say { if(event_var(text) == "!noblock") do { es cooltime can nbcan noblock if (server_var(nbcan) == 1) do { foreach player tempid #alive "es_setplayerprop server_var(tempid) CBaseEntity.m_CollisionGroup 2" es_delayed 10 foreach player tempid #alive "es_setplayerprop server_var(tempid) CBaseEntity.m_CollisionGroup 5" es ct_append noblock 15 } else do { es_tell event_var(userid) #multi #green[INFO] #lightgreenPlease wait until using No-Block again! } } } [/syntax] [size=150]Example for Player-Specific-Cooltimes[/size] [syntax="python"] import es import cooltimelib import playerlib import gamethread def player_say(ev): # > Vars userid = ev["userid"] text = ev["text"] # > Command if text == '!e': if cooltimelib.canUser(int(userid), 'capitulation'): es.msg('#multi', '#green[JAIL] #default%s #lightgreencapitulated!' % es.getplayername(userid)) cooltimelib.append('capitulation', 20) playerlib.getPlayer(userid).setColor(0,255,0) else: es.tell(userid, '#multi', '#green[JAIL] #lightgreenPlease wait until using this again!') [/syntax] [size=150]Python: Lib-Commands[/size] Of course, you'll have to import cooltimelib. [syntax="python"] import cooltimelib[/syntax] [size=150][b][u]User-Specific Commands[/u][/b][/size] [b]cooltimelib.canUser([User-ID], [Name of Cooltime])[/b][list] [*]Returns [color=#0000FF]True[/color] if a player is NOT in cooltime, so HE CAN use! [*]Returns [color=#0000FF]False[/color] if he can't[/list] [b]cooltimelib.appendUser([User-ID], [Name of Cooltime], [Seconds])[/b][list] [*]Does not return anything! [*]Give user Cool-Time[/list] [b]cooltimelib.removeUserCooltime([User-ID], [Name of Cooltime])[/b][list] [*]Removes cooltime from a user[/list] [size=150][b][u]Global-Cooltime Commands[/u][/b][/size] [b]cooltimelib.can([Name of Cooltime])[/b][list] [*]Returns [color=#0000FF]True[/color] if there is NO Cooltime, so you can use it. [*]Returns [color=#0000FF]False[/color] if there is currently a Cooltime, so you can't use it.[/list] [b]cooltimelib.append([Name of Cooltime], [Seconds])[/b][list] [*]Create a Cool-Time [*]Does not return anything![/list] [b]cooltimelib.removeCooltime([Name of Cooltime])[/b][list] [*]Removes Cooltime again[/list] [size=150]ES-Shell: Commands[/size] To be able to use my cooltime-lib you will have to load the ess-addon! (Tutorial at "Installation") The commands have the same "style" as in Python. Here are ALL Commands listed. [b]Global-Commands[/b] [list] [*]cooltime can <var> <cooltime-name> [*]cooltime append <cooltime-name> <seconds> [*]cooltime removeCooltime <cooltime-name>[/list] [b]User-Specific commands[/b] [list] [*]cooltime canuser <var> <userid> <cooltime-name> [*]cooltime appendUser <userid> <cooltime-name> <seconds> [*]cooltime removeUserCooltime <userid> <cooltime-name>[/list] [i]ct_can[/i] and [i]ct_canuser[/i] output a [b]1[/b], if they can or a [b]0[/b], if they can not! [b][size=200][color=red]If you have questions, or you want to know about Error-Handling, Planned Features, Credits, .. please visit the [url=http://forums.eventscripts.com/viewtopic.php?f=69&t=45404]topic[/url] on the board![/color][/size][/b]

Installation

Move all files in your addons/eventscripts-folder! If you are an ES-Shell Scripter: Add this to your autoexec.cfg [code] es_load corelib/cooltime [/code] Or you go to your corelib/es_corelib.txt and add in line 84 "es_xload corelib/cooltime" and in line 130 "es_xunload corelib/cooltime".

Version Notes For 1.0

Updated on: 2012-04-02 11:17:49 EST by Freakyy (View Zip Contents)


( Previous Versions )