Advertisement
Emistry

[RO] Guild Pay for Temporary Entrance to Maps

Dec 9th, 2016
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. // https://rathena.org/board/topic/108466-temporary-variables-for-guilds/
  2.  
  3. /* Load the SQL table
  4.  
  5. CREATE TABLE IF NOT EXISTS `e_guild_dun_zeny` (
  6. `id` bigint(20) unsigned NOT NULL auto_increment,
  7. `gid` int(11) unsigned NOT NULL default '0',
  8. `zeny` int(11) unsigned NOT NULL default '0',
  9. `expire` int(11) unsigned NOT NULL default '0',
  10. PRIMARY KEY (`id`)
  11. ) ENGINE=MyISAM;
  12.  
  13. */
  14.  
  15.  
  16. prontera,155,181,5 script Sample#qwqe 4_F_KAFRA1,{
  17.  
  18. .@gid = getcharid(2);
  19.  
  20. if ( !.@gid ) {
  21. mes "You dont have guild.";
  22. }
  23. else {
  24. switch( select(
  25. "Enter Dungeon",
  26. "Donate to Dungeon",
  27. "Cancel"
  28. )) {
  29. case 1:
  30. query_sql( "SELECT SUM(`zeny`) FROM `e_guild_dun_zeny` WHERE `gid` = " + .@gid + " AND `expire` > "+ gettimetick(2) +" GROUP BY `gid`", .@total );
  31. if ( .@total >= .total_zeny_required ) {
  32. warp "prontera",155,181;
  33. }
  34. else {
  35. mes "You guild need to donate more zeny.";
  36. }
  37. break;
  38. case 2:
  39. if ( getcharid(0) != getguildmasterid( .@gid ) ) {
  40. mes "You're not guild leader.";
  41. }
  42. else if ( !.total_zeny_required ) {
  43. mes "Zeny not required.";
  44. }
  45. else {
  46. mes "Enter the amount you want to donate.";
  47. input .@zeny,0,MAX_ZENY;
  48. if ( .@zeny ) {
  49. .@gettimetick = gettimetick(2);
  50. query_sql( "INSERT INTO `e_guild_dun_zeny` ( `gid`,`zeny`,`expire` ) VALUES ( "+.@gid+","+.@zeny+","+( .@gettimetick + .expire_second )+" )" );
  51. Zeny -= .@zeny;
  52. query_sql( "SELECT SUM(`zeny`) FROM `e_guild_dun_zeny` WHERE `gid` = " + .@gid + " AND `expire` > "+ .@gettimetick +" GROUP BY `gid`", .@total );
  53. mes "Donated "+.@zeny+" / "+.@total+" Zeny";
  54. }
  55. }
  56. break;
  57. default: break;
  58. }
  59. }
  60. close;
  61.  
  62. OnInit:
  63. .total_zeny_required = 10000000;
  64. .expire_second = ( 86400 * 2 );
  65. end;
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement