viewing paste samuel_timer_atcommand | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#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 countdown( int tid, int64 tick, int id, intptr data ) {
        TBL_PC *sd;
        sd = map->id2sd(id);
        if ( sd ) {
                clif->specialeffect( &sd->bl, 49, SELF );
                clif->message( sd->fd, "BOOM !! just kidding." );
        }
        return false;
}
 
ACMD(test) {
        timer_id = timer->add( timer->gettick() + 5000, countdown, sd->bl.id, 0 );
        clif->message( sd->fd, "After 5 seconds, you'll die ..." );
        return true;
}
       
HPExport void plugin_init (void) {
        addAtcommand( "test", test );
}
Viewed 700 times, submitted by AnnieRuru.