Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 General
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 14.02.2006, 05:55   #1
Firedaemon
Архивный участник
 
Join Date: Oct 2005
Posts: 267
Default [SHARE] Create Item from PHP

This is rather simple, just creates the item from PHP. Item will not show up in inventory until next cached restart though.

[php:1:914bdacc3a]
<?php

$char_name = "";

// id, quantity, enchant

$itemid = array(
array(1466, 100000, 0), // ssa
array(1467, 50000, 0), // sss
array(1344, 50000, 0), // mithril arrow
array(3951, 50000, 0), // bssa
array(57, 400000000, 0) // adena
);

$con = mssql_connect(, , );

if ($con)
{
$db = mssql_select_db ('');

$query = "
SELECT
char_id
FROM
user_data
WHERE
char_name='".$char_name."'
";

$result = mssql_query($query);
$char = mssql_fetch_assoc($result);
$char_id = $char['char_id'];

if ($char_id)
{
echo count($itemid)." total items for CHAR_ID ".$char_id."\n";

for ($i=0; $i<count($itemid); $i++)
{
$query = "INSERT INTO
[user_item](char_id,item_type,amount,enchant,eroded,bless,ide nt,warehouse)
VALUES(".$char_id.",".$itemid[$i][0].",".$itemid[$i][1].",".$itemid[$i][2].",0,0,0,0)
SELECT
@@IDENTITY
AS
insert_id";

$result = mssql_query($query);

$pet_item = mssql_fetch_assoc($result);

if ($pet_item['insert_id'])
{
echo "Item ".$itemid[$i][0]." Insert Completed\n\n";
}
else
{
echo "Fatal Error: Did not retrieve the insert ID for item.\n";
break;
}
}
}
else
{
echo "Character ID not found for ".$char_name;
}

sleep(10);
}



?>
[/php:1:914bdacc3a]
Firedaemon is offline  
Old 14.02.2006, 11:33   #2
darkkiss
Архивный участник
 
Join Date: Sep 2005
Posts: 41
Default

yea .. it's good .. but .... the server must be offline ... to do this query
darkkiss is offline  
Old 14.02.2006, 14:08   #3
Aikeleer
Архивный участник
 
Join Date: Jun 2005
Posts: 374
Default

It's better to use l2atl funcs. That's on the fly.
Aikeleer is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 21:58.