Post Pacific

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

Firedaemon 14.02.2006 05:50

[SHARE] Create Strider/Pet from PHP
 
The script is rather simple. It is configured to work with creation of a Stryder but really you can use it for any pet type.

[php:1:140b734d0a]
<?php

$char_name = '';
$itemid = 4423;
$enchant = 71;
$npcid = 1012527;
$exp = 70853089;
$hp = 14303;
$mp = 1714;
$meal = 6670;

$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'];

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

$result = mssql_query($query);

$pet_item = mssql_fetch_assoc($result);

if ($pet_item['insert_id'])
{
$query = "INSERT INTO
[pet_data](pet_id,npc_class_id,expoint,nick_name,hp,mp,sp,me al,slot1,slot2)
VALUES(".$pet_item['insert_id'].",".$npcid.",".$exp.",'',".$hp.",".$mp.",0,".$mea l.",'','')";

$result = mssql_query($query);

echo "Strider Insert Completed for CHAR_ID ".$char_id;
}
else
{
echo "Fatal Error: Did not retrieve the insert ID for item.";
}

sleep(60);
}



?>
[/php:1:140b734d0a]


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