Advertisement
NatedogServer

Storage

Sep 6th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.22 KB | None | 0 0
  1.     if($text=~/^#store/i)
  2.     {
  3.         my $qitem = $client->GetItemAt(30);
  4.         my $itemid = $client->GetItemIDAt(30);
  5.         if($qitem)
  6.         {      
  7.    
  8.             ## WE HAVE AN ITEM ZOMG NOW CHECK FOR NO DROP
  9.             $dbh = DBI_CONNECT();
  10.             $query = "SELECT nodrop FROM items WHERE id = $itemid";
  11.             $sth = $dbh->prepare($query);
  12.             $sth->execute();
  13.             my $nodrop = $sth->fetchrow_array();
  14.            
  15.             if($nodrop == 0 || $qitem->IsAttuned())
  16.             {
  17.                 $client->Message(335, "That item is No Trade!");
  18.                 $sth->finish();
  19.                 $dbh->disconnect();
  20.                 return;
  21.             }
  22.            
  23.             #ITEM IS TRADEABLE CONTINUE!
  24.             if($qitem->GetCharges() > 1)
  25.             {
  26.                 $charges = $qitem->GetCharges();
  27.             }
  28.             else
  29.             {
  30.                 $charges = 1;
  31.             }
  32.             my $accid = $client->AccountID();
  33.             my $itemid = $qitem->GetID();
  34.             my $itemname = $qitem->GetName();
  35.             $sth = $dbh->prepare("SELECT max(slot) FROM storage
  36.                                 WHERE accid = $accid
  37.                                 ");
  38.             $sth->execute();
  39.             my $SLOT = $sth->fetchrow_array()+1;
  40.             $query = "INSERT INTO storage VALUES ($accid, $SLOT, $itemid, $charges)";
  41.             $sth = $dbh->do($query);
  42.             $client->Message(335, "$charges - $itemname now in Storage!");
  43.            
  44.             $client->DeleteItemInInventory(30, 0, true);
  45.         }
  46.         $sth->finish();
  47.         $dbh->disconnect();
  48.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement