Post Pacific

Post Pacific (https://postpacific.loc-online.com/index.php)
-   Темы без сохранившегося раздела (https://postpacific.loc-online.com/forumdisplay.php?f=10001)
-   -   [SHARE] Create Item from PHP (https://postpacific.loc-online.com/showthread.php?t=3343)

Firedaemon 14.02.2006 05:55

[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]

darkkiss 14.02.2006 11:33

yea .. it's good .. but .... the server must be offline ... to do this query

Aikeleer 14.02.2006 14:08

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


All times are GMT. The time now is 16:19.