PDA

View Full Version : Placing "Groundspawns"


NatedogEZ
07-21-2013, 09:00 PM
Another silly script.. but this makes things go a bit faster if you are trying to add groundspawns to a zone!


Just type --- "groundspawn 1001" -- it spawn place a groundspawn of itemid 1001 in your current location

This requires DBI and the way it is currently written requires status 200 to be able to spawn the items

If you spawn an item that has a viewable graphic it will show up as that on the ground rather than the generic bag graphic.


sub EVENT_SAY {


if($status >= 200)
{
if($text=~/^groundspawn/i)
{
my $itemdrop = substr($text, 12);
my $CX = $client->GetX();
my $CY = $client->GetY();
my $CZ = $client->GetZ();
my $CH = $client->GetHeading();
my $dbh = DBI_CONNECT();
$sth = $dbh->prepare("SELECT idfile FROM items WHERE id = $itemdrop");
$sth->execute();
my $graphic = $sth->fetchrow_array();
$sth = $dbh->do("INSERT INTO `ground_spawns` VALUES ('', $zoneid, 0, $CX, $CY, $CZ, $CX, $CY, $CH, '".$graphic."_ACTORDEF', $itemdrop, 1, 'Auto', 300000)");
$dbh->disconnect();
$client->Message(315, "Groundspawn added to $zonesn!");
}
}

}



sub DBI_CONNECT {
use DBI;
$database = "peq";
$host = "localhost";
$username = "USERNAME";
$password = "PASSWORD";
$dbh = DBI->connect("DBI:mysql:database=$database;host=$host", "$username", "$password", {RaiseError => 1});
return $dbh;
}

Drakiyth
07-21-2013, 10:10 PM
This is a really cool script, Natedog. Thanks for making it.

jsr
07-22-2013, 07:55 AM
Great idea, cheers!