#include "common/hercules.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "map/pc.h"
#include "map/clif.h"
#include "map/atcommand.h"
#include "common/timer.h"
#include "common/nullpo.h"
#include "common/HPMDataCheck.h"
HPExport struct hplugin_info pinfo = {
"samuel",
SERVER_TYPE_MAP,
"^.^",
HPM_VERSION,
};
int timer_id = INVALID_TIMER;
int timer_countdown = 0;
int countdown( int tid, int64 tick, int id, intptr data ) {
TBL_PC *sd = map->id2sd(id);
if ( sd ) {
if ( --timer_countdown ) {
char aaa[CHAT_SIZE_MAX];
safesnprintf( aaa, CHAT_SIZE_MAX, "%d", timer_countdown );
clif->message( sd->fd, aaa );
timer_id = timer->add( timer->gettick() + 1000, countdown, sd->bl.id, 0 );
}
else {
clif->specialeffect( &sd->bl, 49, SELF );
clif->message( sd->fd, "BOOM !! just kidding." );
}
}
else
timer_countdown = 0;
return false;
}
ACMD(test) {
if ( timer_countdown )
return false;
timer_id = timer->add( timer->gettick() + 1000, countdown, sd->bl.id, 0 );
clif->message( sd->fd, "After 5 seconds, you'll die ..." );
timer_countdown = 5;
return true;
}
HPExport void plugin_init (void) {
addAtcommand( "test", test );
}