Advertisement
Innos

Not Finish - User geworben v3

Jun 4th, 2013
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.73 KB | None | 0 0
  1. /*
  2. DROP TABLE IF EXISTS `geworben`;
  3. CREATE TABLE `geworben` (
  4.     `account_id` int(11) NOT NULL,
  5.     `friend_id` int(11) NOT NULL,
  6.     `message` text NOT NULL,
  7.     `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  8.     `confirmed` int(11) NOT NULL,
  9.     `name` text NOT NULL,
  10.     PRIMARY KEY (`account_id`)
  11. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  12. */
  13.  
  14. //===== ExRO Scripts =========================================
  15. //= Player advertised with accept/decline & SQL
  16. //===== By: ==================================================
  17. //= Innos [rA n00B with bad English]
  18. //===== Current Version: =====================================
  19. //= Alpha -0,001
  20. //============================================================
  21.  
  22. prontera,155,175,6  script  Test    606,{
  23.  
  24.     set .@npc$, "[^FF0000User werben User^000000]";
  25.    
  26.     mes .@npc$;
  27.     mes "Would you like to get your picture taken with Santa?";
  28.     if( Select( "^008800Recruit Friend^000000", "See all advertised", "Beenden" ) == 3 )
  29.     close;
  30.    
  31. //-> advertised friends list
  32.     if( @menu == 2 ) {
  33.     next;
  34.     set .@c1, Query_SQL( "SELECT `name`, DATE_FORMAT(`time`, '%d.%m.%Y'), `confirmed` FROM `geworben` WHERE `account_id` = " + GetCharID( 3 ), .@Friend$, .@date$, .@confirmed );
  35.     if( .@c1 == 0 ) {
  36.     mes .@npc$;
  37.     mes "^FF0000No advertised Friends found^000000";
  38.     close;
  39.     }
  40.     if( .@confirmed == 0 ) {set .@con$, "Wait";} if( .@confirmed == 1 ) {set .@con$, "declined";} if( .@confirmed == 2 ) {set .@con$, "accept";}
  41.         mes "[^FF0000Recruited Friends - " + .@c1 + " Accounts^000000]";
  42.         mes "[Nr] <Name> (<Date) [Answer]";
  43.         for( set .@i, 0; .@i < .@c1; set .@i, .@i + 1 )
  44.             mes "[" + ( .@i + 1 ) + "] " + .@Friend$[ .@i ] + " (" + .@date$[ .@i ] + ") " + .@con$[ .@i ] + "";
  45.             close;
  46.         }
  47.  
  48. //-> search player
  49.     mes "Player Name?";
  50.     do {
  51.         Input( .@name$ );
  52.         set .@c, Query_Sql( "SELECT `account_id` FROM `char` WHERE `name` = '" + .@name$ + "'", .@FriendID );
  53.         next;
  54.         if( .@c == 0 ) {
  55.         mes "^ff0000'" + .@name$ + "' not found!^000000";
  56.         if( Select( "Please try again", "Quit" ) == 2 )
  57.         close;
  58.             }
  59.         } while( .@c < 1 );
  60.         mes .@npc$;
  61.         mes "^0000FFPlayer^000000: " + .@name$ + " ";
  62.         mes "found.";
  63.         next;
  64.  
  65.  //-> add player
  66.         if( @menu == 1 ) {
  67.             if( Select( "Entry Player!", "Quit!" ) == 2 ){
  68.             mes "^ff0000cancelled...^000000";
  69.             close;
  70.             }
  71.             //-> request already exist
  72.             Query_SQL( "SELECT `friend_id` FROM `geworben` WHERE `friend_id` = '" + .@FriendID + "'", .@check );
  73.             if( .@check > 0 ){ // Friend ID already in Table
  74.             mes "^ff0000For this action an inquiry already exists!^000000";
  75.             close;
  76.             }else{
  77.                 mes "Please insert a Message!";
  78.                 Input( .@message$ );
  79.                 Query_SQL( "INSERT INTO `geworben` VALUES ( " + .@WerberID + ", " + .@FriendID + ", '" + .@message$ + "', '0000-00-00 00:00:00', '0', '" + .@name$ + "' );" );
  80.                 next;
  81.                 }
  82.             }
  83.         mes "^0000FFPlayer^000000: " + .@name$ + " ";
  84.         mes "^0000FFMessage^000000: " + .@message$ + " ";
  85.         close;
  86.  
  87. OnPCLoginEvent:
  88.         if( Query_SQL( "SELECT `message`, `account_id` FROM `geworben` WHERE `friend_id` = " + GetCharID( 3 ), .@message$, .@aid ) == 0 )
  89.         end;
  90.         Query_SQL( "UPDATE `geworben` SET `time` = NOW() WHERE `friend_id` = " + GetCharID( 3 ) );
  91.  
  92.         mes "[^FF0000User werben User^000000]";
  93.         mes "Somebody has you recruited!";
  94.         mes "^FF0000---- Name/Nachricht ----^000000";
  95.         mes .@aid[ 0 ];
  96.         mes .@message$[ 0 ];
  97.         next;
  98.         mes "Is this wrong or right?";
  99.  
  100.         if( Select( "Right!!", "Wrong." ) == 2 ){
  101.         mes "^ff0000You have rejected.^000000";
  102.         Query_SQL( "UPDATE `geworben` SET `confirmed` = '1' WHERE `account_id` = " + .@aid );
  103.         close;
  104.         }else{
  105.         mes "You have confirmed!";
  106.         Query_SQL( "UPDATE `geworben` SET `confirmed` = '2' WHERE `account_id` = " + .@aid );
  107.         mes "^008800successfully recorded!^000000";
  108.         close;
  109.         }
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement