// https://rathena.org/board/topic/121262-custom-bring-me-event/
/*
CREATE TABLE IF NOT EXISTS `bring_me_event` (
`id` int(11) unsigned NOT NULL auto_increment,
`aid` int(11) unsigned NOT NULL default '0',
`cid` int(11) unsigned NOT NULL default '0',
`last_ip` varchar(100) NOT NULL default '',
`last_unique_id` varchar(100) NOT NULL default '',
`time` datetime NOT NULL,
) ENGINE=MyISAM;
*/
prontera,0,0,0 script Sample 444,{
.@aid = getcharid(3);
.@cid = getcharid(0);
.@ip$ = getcharip();
.@unique_id$ = get_unique_id();
query_logsql("SELECT `id`,`time` FROM `bring_me_event` WHERE `aid` = "+.@aid+" OR `last_ip` = '"+escape_sql(.@ip$)+"' OR `last_unique_id` = '"+escape_sql(.@unique_id$)+"' LIMIT 1", .@id, .@time$);
query_logsql("SELECT COUNT(`id`) FROM `bring_me_event`", .@size);
if (.@size >= .max_redeem) {
mes "you missed the reward, only "+.max_redeem+" players got the reward.";
}
else if (.@id) {
mes "You've already claimed the rewards on "+.@time$+".";
}
else {
mes "Bring me "+.amount+"x "+getitemname(.item_id);
if (countitem(.item_id) >= .amount) {
if (select("Okay","Cancel") == 1) {
delitem .item_id, .amount;
query_logsql("INSERT INTO `bring_me_event` (`aid`,`cid`,`last_ip`,`last_unique_id`,`time`) VALUES ("+.@aid+","+.@cid+",'"+escape_sql(.@ip$)+"','"+escape_sql(.@unique_id$)+"', NOW())");
getitem 501,1;
getitem 502,1;
getitem 503,1;
mes "you are the "+(.@size+1)+"/"+.max_redeem+" players who got the reward";
}
}
}
close;
OnInit:
.item_id = 512;
.amount = 300;
.max_redeem = 200;
end;
}
you can try this.