viewing paste Unknown #22698 | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
// Load the following SQL Table in your Server before use the NPC
   
/*
   
CREATE TABLE IF NOT EXISTS `E-Inquiry` (
    `ID` bigint(20) unsigned NOT NULL auto_increment,
    `Sender_ID` int(11) unsigned NOT NULL default '0',
    `Sender_Name` varchar(30) NOT NULL default '',
    `Title` text,
    `Message` text,
    `Status` tinyint(2) NOT NULL default '0',
    `Inquiry_Time` datetime NOT NULL default '0000-00-00 00:00:00',
    `Reply` text,
    `Reply_Time` datetime NOT NULL default '0000-00-00 00:00:00',
    `Reply_Name` varchar(30) NOT NULL default '',
    PRIMARY KEY  (`ID`)
) ENGINE=MyISAM;
 
*/
 
-       script  E-Inquiry       FAKE_NPC,{
OnStartMenu:
mes "Do you having problems and wish to inform GM Staffs about this ?";
switch( select( "View Messages",
                "Write Messages",
                ( getgmlevel() < .GMLevel )?"":"^FF0000[ GM ]^000000 Manage Messages" )){
 
case 1:
    do{
        mes "What types of Messages you would like to View ?";
        for( set .@i,0; .@i < 3; set .@i,.@i + 1 )
            set .@Found[.@i],query_sql("SELECT `ID` FROM `E-Inquiry` WHERE `Status` = "+.@i+" AND `Sender_ID`='"+getcharid(3)+"'",.@ID );
 
        set .@Msg,select("^FF0000Un-Replied Messanges [ ^FF0000"+.@Found[0]+"^000000 ]",
                        "^0000FFReplied Messages^000000 [ ^FF0000"+.@Found[1]+"^000000 ]",
                        "Archieved Messages [ ^FF0000"+.@Found[2]+"^000000 ]" ) - 1;
        set .@Replied,query_sql(" SELECT `ID`,`Title`,`Message`,`Inquiry_Time`,`Reply`,`Reply_Time`,`Reply_Name` FROM `E-Inquiry` WHERE `Status`= "+.@Msg+" AND `Sender_ID`='"+getcharid(3)+"' ",.@ID, .@Title$,.@Message$,.@Time$,.@Reply$,.@ReplyTime$,.@ReplyName$ );
        if( !.@Replied ){
            mes "You didnt have Messages to read.";
            next;
        }else{
            set .@Menu$,"";
            for( set .@i,0; .@i < .@Replied; set .@i,.@i + 1 )
                set .@Menu$,.@Menu$ + "^FF0000[ "+( .@i+1 )+". ]^0000FF "+.@Title$[.@i]+":";
            next;
            set .@Select,select( .@Menu$ ) - 1;
            mes "^00FF00____________________________^000000";
            mes "^FF0000Date :^000000 : "+.@Time$[.@Select];
            mes "^FF0000Title^000000 : "+.@Title$[.@Select];
            mes "^00FF00____________________________^000000";
            mes "^FF0000Messages^000000 : "+.@Message$[.@Select];
            mes "^00FF00____________________________^000000";
            if( .@Msg > 0 ){
                mes "^0000FFReply from ^FF0000"+.@ReplyName$[.@Select]+" ^000000 : "+.@Reply$[.@Select];
                mes "^00FF00____________________________^000000";
                mes "^0000FFTime ^000000 : "+.@ReplyTime$[.@Select];
            }
            next;
            set .@MsgOpt1,select("View Other Messages",( .@Msg == 1 )?"Move to Archieve":"","Delete Message" );
            switch( .@MsgOpt1 ){
                case 2:
                    query_sql("UPDATE `E-Inquiry` SET `Status` = 2 WHERE `ID` = "+.@ID[.@Select]+" ");
                    mes "Message has been moved to Archieve.";
                    break;
                case 3:
                    query_sql("DELETE FROM `E-Inquiry` WHERE `ID` = "+.@ID[.@Select]+" ");
                    mes "Message has been DELETED.";
                    break;
                default:
                    break;
            }
        }
    }while( .@MsgOpt1 < 3 );
    break;
 
case 2:
    mes "^00FF00____________________________^000000";
    mes "^FF0000NOTES :^000000 All the Messages will be recorded for future references, so please do not abuse this. Otherwise action will be taken on you";
    do{
        next;
        mes "^00FF00____________________________^000000";
        mes "^FF0000Title^000000 : "+.@Title$;
        mes "^00FF00____________________________^000000";
        mes "^FF0000Messages^000000 : "+.@Message$;
        mes "^00FF00____________________________^000000";
   
        next;
        set .@Select,select(( .@Title$ == "" )?"[ ^FF0000Incomplete^000000 ] Title":"[ ^0000FFCompleted^000000 ] Title",
                            ( .@Message$ == "" )?"[ ^FF0000Incomplete^000000 ] Message":"[^0000FFCompleted^000000 ] Title",
                            ( .@Title$ == "" || .@Message$ == "" )?"":"^FF0000SEND MESSAGE^000000" );
   
        switch( .@Select ){
            case 1:
                mes "Enter a Title for your Problems";
                input .@Title$;
                break;
            case 2:
                mes "Briefly explain what's your Problem";
                set .@i,0;
                do{
                    input getd(".@Message"+.@i+"$");
                    set .@Message$,.@Message$ + getd(".@Message"+.@i+"$")+" ";
                    set .@Continue,select("Complete:Continue Messages");
                }while( .@Continue == 2 );
                break;
            default:
                mes "Your message has been sent.";
                query_sql( "INSERT INTO `E-Inquiry` ( `Sender_ID`,`Sender_Name`,`Title`,`Message`,`Status`,`Inquiry_Time` ) VALUES ( "+getcharid(3)+",'"+escape_sql(strcharinfo(0))+"','"+escape_sql(.@Title$)+"','"+escape_sql(.@Message$)+"',0,'"+gettimestr("%Y-%m-%d %H:%M:%S",21)+"' ) ");
                break;
        }
    }while( .@Select != 3 );
    break;
   
case 3:
    do{
    mes "Alright, what next ?";
    next;
    for( set .@i,0; .@i < 3; set .@i,.@i + 1 )
        set .@Found[.@i],query_sql("SELECT `ID` FROM `E-Inquiry` WHERE `Status` = "+.@i+"",.@ID );
 
    set .@Types,select("^FF0000View All Unread Messanges [ ^FF0000"+.@Found[0]+"^000000 ]",
                        "View All Replied Messages^000000 [ ^FF0000"+.@Found[1]+"^000000 ]",
                        "View All Archieved Messages [ ^FF0000"+.@Found[2]+"^000000 ]" ) - 1;
 
    set .@ManageMSG,query_sql(" SELECT `ID`,`Sender_Name`,`Title`,`Message`,`Inquiry_Time`,`Reply`,`Reply_Time`,`Reply_Name` FROM `E-Inquiry` WHERE `Status`= "+.@Types+" LIMIT 127",.@ID,.@Sender$, .@Title$,.@Message$,.@Time$,.@Reply$,.@ReplyTime$,.@ReplyName$ );
        if( !.@ManageMSG ){
            mes "You didnt have Messages to read.";
            next;
        }else{
            set .@Menu$,"";
                for( set .@i,0; .@i < .@ManageMSG; set .@i,.@i + 1 )
                set .@Menu$,.@Menu$ +"^FF0000[ "+( .@i+1 )+". ]^0000FF "+.@Title$[.@i]+":";
            next;
            set .@Select,select( .@Menu$ ) - 1;
            mes "^00FF00____________________________^000000";
            mes "^FF0000Date :^000000 : "+.@Time$[.@Select];
            mes "^FF0000Aurthor :^000000 : "+.@Sender$[.@Select];
            mes "^FF0000Title^000000 : "+.@Title$[.@Select];
            mes "^00FF00____________________________^000000";
            mes "^FF0000Messages^000000 : "+.@Message$[.@Select];
            mes "^00FF00____________________________^000000";
            if( .@Types > 0 ){
                mes "^0000FFReply from ^FF0000"+.@ReplyName$[.@Select]+" ^000000 : "+.@Reply$[.@Select];
                mes "^00FF00____________________________^000000";
                mes "^0000FFTIme ^000000 : "+.@ReplyTime$[.@Select];
            }
            next;
            set .@MsgOpt1,select( ( .@Types == 2 )?"":"Reply Message","View Other Messages","Delete Message" );
            switch( .@MsgOpt1 ){
                case 1:
                    set .@i,0;
                    do{
                        input getd(".@Reply"+.@i+"$");
                        set .@Reply$,.@Reply$ + getd(".@Reply"+.@i+"$")+" ";
                        set .@Continue,select("Complete:Continue Messages");
                    }while( .@Continue == 2 );
                   
                    query_sql("UPDATE `E-Inquiry` SET `Status` = 1,`Reply`='"+escape_sql(.@Reply$)+"',`Reply_Name`='"+escape_sql(strcharinfo(0))+"',`Reply_Time`='"+gettimestr("%Y-%m-%d %H:%M:%S",21)+"' WHERE `ID` = "+.@ID[.@Select]+" ");    
                    message strcharinfo(0),"Reply has been sent.";
                    break;
                case 3:
                    query_sql("DELETE FROM `E-Inquiry` WHERE `ID` = "+.@ID[.@Select]+" ");
                    mes "Message has been Deleted.";
                default:
                    break;
            }
        }
    }while( .@MsgOpt1 != 1 );
    break;
}
 
OnInit:
// Min. GM Level to Read / Manage Messages.
set .GMLevel,80;
 
OnPCLoginEvent:
if( getgmlevel() < .GMLevel ){
    set .@Replied,query_sql("SELECT `ID` FROM `E-Inquiry` WHERE `Status` = 1 AND `Sender_ID`='"+getcharid(3)+"'",.@ID );
    if( .@Replied )
        message strcharinfo(0),"You have "+.@Replied+" Replied Messages from GM Team.";
}else{
    set .@Unread,query_sql("SELECT `ID` FROM `E-Inquiry` WHERE `Status` = 0 ",.@ID );
    if( .@Unread )
        message strcharinfo(0),"GM Team received "+.@Unread+" New Message from Players.";
}
if( .@Replied || .@Unread ){
    if( select("Read the Messages:Cancel") == 2 ) close;
        goto OnStartMenu;
}
 
}
 
// Main NPC
prontera,156,153,5      script  E-Inquiry#Main  4_WOODPILE,{
    doevent "E-Inquiry::OnStartMenu";
        end;
       
        OnInit:
        waitingroom "GM Room", 0;
        end;
}
   
// Duplicates NPC
// prontera,155,181,5    duplicate(E-Inquiry#Main)    E-Inquiry#1    757
// prontera,155,182,5    duplicate(E-Inquiry#Main)    E-Inquiry#2    757
// prontera,155,183,5    duplicate(E-Inquiry#Main)    E-Inquiry#3    757
Viewed 397 times, submitted by unknown.