View Single Post
  #2  
Old 09-22-2018, 02:08 PM
superpally1
Sarnak
 
Join Date: Jul 2018
Location: Tennessee
Posts: 33
Default

I dont think this is posted in the right area. But this should do what you want.


Code:
# Must have status of 150+ to use add/remove commands.
# Usage: /say add hotzone zonesn
# Usage: /say remove hotzone zonesn
# Example: /say add hotzone nro        This will add nro to the hotzone list.
# Example: /say remove hotzone nro     This will remove nro from the hotzone list.

sub EVENT_SAY {
    @args = split(' ', $text);
 	
    if($text=~/hail/i) {
	    $client->Message(15, quest::saylink("Current hotzones", 1));
	}
	if($text=~/Current hotzones/i) {
		$client->Message(15,"Current hotzones are : ");
		my $connect = plugin::LoadMysql();
		my $found_zone = 0;
                my $sql_query = "SELECT short_name FROM zone WHERE hotzone=1";
		my $sql_handler = $connect->prepare($sql_query);
		$sql_handler->execute();
		    while (@zone_row = $sql_handler->fetchrow_array()) {
			$found_zone++;
    		    $say_links = quest::saylink("$zone_row[0]", 1);
		    $client->Message(15,"$say_links.");
		}
		$connect->disconnect();
	}
	if($status > 150) {    #Change this to the status you want.
	    if($text=~/add hotzone/i) {
                my $connect = plugin::LoadMysql();
                $query = "UPDATE zone SET hotzone = 1 WHERE short_name = '$args[2]'";
	        $client->Message(14,"$args[2], added to hotzone list.");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
                $connect->disconnect;				
	    }
	    if($text=~/remove hotzone/i) {
                my $connect = plugin::LoadMysql();
                $query = "UPDATE zone SET hotzone = 0 WHERE short_name = '$args[2]'";
	        $client->Message(13,"$args[2], removed from hotzone list.");
                $query_handle = $connect->prepare($query);
                $query_handle->execute();
                $connect->disconnect;				
	    }
       }
}
Reply With Quote