/////////////////////////////////////////////////////////////////////////
//#####################################################################//
//### ##### ## #### ### ##### ## ###//
//### #### ## # ## ### ## #### ### ## #### ###//
//### ### ## ### ### ### ### ### ### ## #### ###//
//### ## ## ## ### #### ## ### ## #### ###//
//### ## ############ ### ##### # ### ## #### ###//
//### ## ############ ### ##### # ### ## #### ###//
//### ## ## ###### ## ### #### ## ### ## #### ###//
//### ### ## #### ### ### ### ### ### ## #### ###//
//### #### ## #### # ## #### ### ## #### ###//
//### ##### ############# ## ##### ###############//
//#####################################################################//
//=====================================================================//
//GM Status Checker for SQL Servers Only //
//Made by: Keldon a.k.a. joecalis //
//Forum Topic: http://www.eathena.ws/board/index.php?showtopic=275490 //
//=====================================================================//
//--Features: //
//=====================================================================//
//Can leave messages (tweets). //
//Shows the date the tweet was posted. //
//Displays up to 30 messages. //
//Pay cash points to leave a message. //
//GMs can Create table automatically on npc click. //
//GMs can delete all messages (messages will be deleted when the GM //
//that deleted it logs out, sometimes it takes longer to delete). //
//Announces the Tweet automatically after it is sent. //
//=====================================================================//
//--Configs: //
//=====================================================================//
//-getgmlevel()==99 //Change to what minimum GM Level you want for it //
//to activate GM Options. //
//-set @statusb$,"^XXXXXX" //The X represents the numbers and letters //
//that makes up the color of the text, Change it to what ever you like.//
//-izlude,136,93,3 //Change to what ever map you want. //
//-#CASHPOINTS<10 //Change 10 to what minimum cash points needed to //
//post you want. //
//-#CASHPOINTS-10 //Change 10 to what amount you want it to cost when //
//posting. //
//-set @npcname$,"[^ff0000Twitter^000000]" //Change Twitter to what //
//name of your npc you want to be //
/////////////////////////////////////////////////////////////////////////
izlude,136,90,3 script Twitter 857,{
if(getgmlvl==99){
if($twitteron==0){
query_sql "CREATE TABLE IF NOT EXIST `twitter` (`char_id` int(11) unsigned NOT NULL ,`char_name` varchar(30) NOT NULL ,`message` varchar(100) NOT NULL ,`date` varchar(30) NOT NULL ,`week` varchar(30) NOT NULL ,`number` int(2) unsigned NOT NULL ,PRIMARY KEY ( `number` ) )";
set $twitteron,1;
}
}
set @npcname$,"[^ff0000Twitter^000000]";
mes @npcname$;
mes "Do you want to leave a ^0000fftweet^000000 for 10 Credits?";
next;
switch(select("Read Tweets:Leave Tweet:Quit")){
case 1:
set @twt,0;
query_sql("select char_id,char_name,message,date,week from `twitter` ORDER BY `number` DESC LIMIT 30", @twtid, @twtnames$, @twtmes$,@twtdate$,@twtweek$);
if(getarraysize(.twtid))
{
mes @npcname$;
mes "No entries found.";
close;
}
while(@twt<getarraysize(@twtid))
{
mes @npcname$;
mes "MESSAGE by NAME on DATE";
set @twtstart,@twt;
while((@twt<@twtstart+10) && @twtid[@twt])
{
mes "^0000ff"+@twtmes$[@twt]+"^000000 by ^ff0000"+@twtnames$[@twt]+"^000000 on";
mes "^00ff00"+@twtdate$[@twt]+"^000000";
mes "^00ff00"+@twtweek$[@twt]+"^000000";
mes "^0000ff============================^000000";
set @twt,@twt+1;
}
next;
}
if(getgmlevel()==99)callfunc "twittergm";
mes @npcname$;
mes "You reached the end of the list.";
close;
case 2:
if(#CASHPOINTS<10){
mes @npcname$;
mes "You don't have enough credits.";
close;
}
mes @npcname$;
mes "Insert Your Message,";
mes "Tweet must be equal or lower than 100 characters.";
input @mytweet$;
next;
mes @npcname$;
mes "If your tweet is longer than 100 characters it will not be added.";
mes "Are you sure you want to put this message?";
mes "^00ff00"+@mytweet$+"^000000";
next;
switch(select("Yes:No")){
case 1:
set $twtnumbers,$twtnumbers+1;
set @week,gettime(4);
if(@week==0)set @week$,"Sunday";
if(@week==1)set @week$,"Monday";
if(@week==2)set @week$,"Tuesday";
if(@week==3)set @week$,"Wednesday";
if(@week==4)set @week$,"Thursday";
if(@week==5)set @week$,"Friday";
if(@week==6)set @week$,"Saturday";
set #CASHPOINTS,#CASHPOINTS-10;
query_sql ("INSERT INTO `twitter` (char_id,char_name,message,date,week,number) VALUES ("+getcharid(0)+",'"+strcharinfo(0)+"','"+@mytweet$+"',NOW(),'"+@week$+"',"+$twtnumbers+")");
dispbottom "You now have a total of "+#CASHPOINTS+" Credits.";
announce "[Tweet] "+strcharinfo(0)+" : "+@mytweet$+"",bc_all,"0x2B60DE";
mes @npcname$;
mes "Tweet sent.";
close;
case 2:
close;
}
case 3:
close;
}
}
function script twittergm {
mes @npcname$;
mes "What would you like to do?.";
next;
switch(select("Delete All:Quit")){
case 1:
set $twtnumbers,0;
query_sql "DROP TABLE `twitter`;";
query_sql "CREATE TABLE `twitter` (`char_id` int(11) unsigned NOT NULL ,`char_name` varchar(30) NOT NULL ,`message` varchar(100) NOT NULL ,`date` varchar(30) NOT NULL ,`week` varchar(30) NOT NULL ,`number` int(2) unsigned NOT NULL ,PRIMARY KEY ( `number` ) )";
mes @npcname$;
mes "Done.";
close;
case 2:
close;
}
}