diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-01-02 12:41:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-01-02 13:32:43 +0300 |
commit | 1d23256b629c02102f57b6262d261c6a4c986887 (patch) | |
tree | 5be656e8f0c4126ee8820c1d15f0d7134a211723 /src/map/script.c | |
parent | 6091f2d963bdff2e62176d9a668943ee02f57043 (diff) | |
download | plugin-1d23256b629c02102f57b6262d261c6a4c986887.tar.gz plugin-1d23256b629c02102f57b6262d261c6a4c986887.tar.bz2 plugin-1d23256b629c02102f57b6262d261c6a4c986887.tar.xz plugin-1d23256b629c02102f57b6262d261c6a4c986887.zip |
Add script command to call timer on players in area.
New script command: areatimer map, x1, y1, x2, y2, tick, event
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c index fcaf9cc..c38a377 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -747,3 +747,40 @@ BUILDIN(isPcDead) script_pushint(st, pc_isdead(sd) ? 1 : 0); return true; } + +static int areatimer_sub(struct block_list *bl, va_list ap) +{ + int tick; + char *event; + TBL_PC *sd; + + tick = va_arg(ap, int); + event = va_arg(ap, char*); + + sd = (TBL_PC *)bl; + if (!pc->addeventtimer(sd, tick, event)) + { + if (sd) + ShowWarning("buildin_addtimer: Event timer is full, can't add new event timer. (cid:%d timer:%s)\n", sd->status.char_id, event); + } + return 0; +} + +BUILDIN(areaTimer) +{ + const char *const mapname = script_getstr(st, 2); + const int x1 = script_getnum(st, 3); + const int y1 = script_getnum(st, 4); + const int x2 = script_getnum(st, 5); + const int y2 = script_getnum(st, 6); + const int time = script_getnum(st, 7); + const char *const eventName = script_getstr(st, 8); + int m; + + if ((m = map->mapname2mapid(mapname)) < 0) + return false; + + map->foreachinarea(areatimer_sub, m, x1, y1, x2, y2, BL_PC, time, eventName); + + return true; +} |