Please help me with how to do this: select 5 random online players no repeat, and before they are chosen, the script should check the SQL table event_pick to ensure that the qualified field has a value of 1 for them to be eligible for the event.
heres my event_pick database
CREATE TABLE `event_pick` (
`id` int(10) unsigned NOT NULL auto_increment,
`char_id` int(11) NOT NULL,
`qualified` int(11) NOT NULL default '0',
PRIMARY KEY USING BTREE (`id`),
UNIQUE KEY `char_id` (`char_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
And here's the script from the forum that I want to be modified.
byako,83,154,4 script Who's Online Event 99,{
mes "[Who's Online Event]";
if (getgroupid() < 99) {
mes "Only GM's are allowed to use this NPC.";
}
else {
mes "Enable event?";
if (select("Yes", "No") == 1) {
mes "Event started.";
donpcevent strnpcinfo(3)+"::OnStart";
}
}
close;
OnHour00:
OnHour03:
OnHour06:
OnHour09:
OnHour12:
OnHour15:
OnHour18:
OnHour21:
OnStart:
do {
query_sql "select `account_id`, `name` from `char` where online = 1 order by rand() limit 1", .@aid, .@name$;
attachrid .@aid;
} while (checkvending() || getgroupid() >= 2 || inarray(.map$, strcharinfo(3)) == -1);
announce strcharinfo(0) +" won 1 Lucky Pick Box in Exiled Lucky Pick", bc_all, 0x00FF00;
getitem 50043,1;
end;
OnInit:
setarray .map$, "prontera", "izlude", "payon";
end;
}
Question
Mice
Please help me with how to do this: select 5 random online players no repeat, and before they are chosen, the script should check the SQL table
event_pick
to ensure that thequalified
field has a value of 1 for them to be eligible for the event.heres my event_pick database
CREATE TABLE `event_pick` ( `id` int(10) unsigned NOT NULL auto_increment, `char_id` int(11) NOT NULL, `qualified` int(11) NOT NULL default '0', PRIMARY KEY USING BTREE (`id`), UNIQUE KEY `char_id` (`char_id`) ) ENGINE=MyISAM AUTO_INCREMENT=1;
And here's the script from the forum that I want to be modified.
byako,83,154,4 script Who's Online Event 99,{ mes "[Who's Online Event]"; if (getgroupid() < 99) { mes "Only GM's are allowed to use this NPC."; } else { mes "Enable event?"; if (select("Yes", "No") == 1) { mes "Event started."; donpcevent strnpcinfo(3)+"::OnStart"; } } close; OnHour00: OnHour03: OnHour06: OnHour09: OnHour12: OnHour15: OnHour18: OnHour21: OnStart: do { query_sql "select `account_id`, `name` from `char` where online = 1 order by rand() limit 1", .@aid, .@name$; attachrid .@aid; } while (checkvending() || getgroupid() >= 2 || inarray(.map$, strcharinfo(3)) == -1); announce strcharinfo(0) +" won 1 Lucky Pick Box in Exiled Lucky Pick", bc_all, 0x00FF00; getitem 50043,1; end; OnInit: setarray .map$, "prontera", "izlude", "payon"; end; }
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.