Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://rathena.org/board/topic/108466-temporary-variables-for-guilds/
- /* Load the SQL table
- CREATE TABLE IF NOT EXISTS `e_guild_dun_zeny` (
- `id` bigint(20) unsigned NOT NULL auto_increment,
- `gid` int(11) unsigned NOT NULL default '0',
- `zeny` int(11) unsigned NOT NULL default '0',
- `expire` int(11) unsigned NOT NULL default '0',
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM;
- */
- prontera,155,181,5 script Sample#qwqe 4_F_KAFRA1,{
- .@gid = getcharid(2);
- if ( !.@gid ) {
- mes "You dont have guild.";
- }
- else {
- switch( select(
- "Enter Dungeon",
- "Donate to Dungeon",
- "Cancel"
- )) {
- case 1:
- query_sql( "SELECT SUM(`zeny`) FROM `e_guild_dun_zeny` WHERE `gid` = " + .@gid + " AND `expire` > "+ gettimetick(2) +" GROUP BY `gid`", .@total );
- if ( .@total >= .total_zeny_required ) {
- warp "prontera",155,181;
- }
- else {
- mes "You guild need to donate more zeny.";
- }
- break;
- case 2:
- if ( getcharid(0) != getguildmasterid( .@gid ) ) {
- mes "You're not guild leader.";
- }
- else if ( !.total_zeny_required ) {
- mes "Zeny not required.";
- }
- else {
- mes "Enter the amount you want to donate.";
- input .@zeny,0,MAX_ZENY;
- if ( .@zeny ) {
- .@gettimetick = gettimetick(2);
- query_sql( "INSERT INTO `e_guild_dun_zeny` ( `gid`,`zeny`,`expire` ) VALUES ( "+.@gid+","+.@zeny+","+( .@gettimetick + .expire_second )+" )" );
- Zeny -= .@zeny;
- query_sql( "SELECT SUM(`zeny`) FROM `e_guild_dun_zeny` WHERE `gid` = " + .@gid + " AND `expire` > "+ .@gettimetick +" GROUP BY `gid`", .@total );
- mes "Donated "+.@zeny+" / "+.@total+" Zeny";
- }
- }
- break;
- default: break;
- }
- }
- close;
- OnInit:
- .total_zeny_required = 10000000;
- .expire_second = ( 86400 * 2 );
- end;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement