//Author : Goddameit
//Version : 2011/7/13 - 21:53
/*
Open 'npc\guild\agit_controller.txt', find 'S_DisplayOwners:'
and add this into below loop 'for( set .@i, 0; .@i <= 19....'
//=======================================================================
if(agitcheck())
{
callfunc "AllGuildMemberEvent",.@maps$[.@i],1,
"System","WoE Victory Reward","Congratulations! Your guild succeeded in occupying "+ getcastlename(.@maps$[.@i]) +". This is your rewards.",
501,1,1,0,
"[You got a mail!! Please relogin to reupdate your mail list.]";
}
//=======================================================================
*/
function script AllGuildMemberEvent {
if(!set(.@gid,getcastledata(getarg(0),1)))
return;
query_sql("select account_id, char_id from `guild_member` where guild_id = '"+.@gid+"'", .@gmaid, .@gmcid);
for(set .@i,0;.@i<getarraysize(.@gmcid);set .@i,.@i+1)
{
if(isloggedin(.@gmaid[.@i]))
message rid2name(.@gmaid[.@i]),getarg(9);
if(!isloggedin(.@gmaid[.@i])&&!getarg(1))
continue;
query_sql "insert into mail ( send_name, dest_id, title, message, nameid, amount, identify, zeny, time ) values ( '"+escape_sql(getarg(2))+"',"+.@gmcid[.@i]+", '"+escape_sql(getarg(3))+"', '"+escape_sql(getarg(4))+"', "+getarg(5)+", "+getarg(6)+", "+getarg(7)+", "+getarg(8)+", unix_timestamp( now() ) )";
}
return;
}