Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Server Modifications ONLY!
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 02.08.2007, 19:07   #25
mexekanez
Архивный участник
 
Join Date: Apr 2006
Posts: 82
Default

Quote:
Originally Posted by FidoW View Post
And why give skills to others subjobs ? Retail works that way ? Anyway, like i say, this way sucks, need server restart, what are you going to do, restart each 1st of month ?

Execute a small PHP would be the solution... for example... you execute this script each 30 minutes or so... or whatever, will check heros in 1st subjob and will add the skill thought cached... no restarts... and hero have the skill quickly.


PHP Code:
<?php

$skill1 
= 396;
$skill2 = 1374;
$skill3 = 1375;
$skill4 = 1376;

$query = "
SELECT char_name,user_data.char_id
FROM user_nobless
INNER JOIN user_data ON user_data.char_id = user_nobless.char_id
WHERE builder = 0 AND account_id > 0 AND subjob_id = 0
AND user_data.char_id NOT IN 
(
  SELECT DISTINCT char_id 
  FROM user_skill 
  WHERE 
  ( 
    skill_id = 
$skill1 OR skill_id = $skill2 OR skill_id = $skill3 OR skill_id = $skill4
  )
  AND subjob_id = 0
)
ORDER BY 2
"
;


$result = mssql_query($query);
$rows = mssql_num_rows($result);

if (
$rows) {
  for(
$i=0;$i<$rows;$i++) {
    
$char_name = mssql_result($result, $i, 0);
    
$char_id = mssql_result($result, $i, 1);
  
    
AddSkillPacket($char_id, $skill1, 1);
    
AddSkillPacket($char_id, $skill2, 1);
    
AddSkillPacket($char_id, $skill3, 1);
    
AddSkillPacket($char_id, $skill4, 1);
    
    echo 
"$char_name - OK<br>";
    
  }
}
else echo 
"No heros need skills at this moment";

?>
Of course isnt tested... but have no reason to not work i think... i just write it in 2 minutes, i only check the sql query and works good.

How to execute a PHP script each XX time ?... look for a way... there are thousands... you can execute even from a store proc if you want...
thnks dude, but it dosen't work
Code:
<?
include("load.php");
mssql_connect($mssql_server,$mssql_user,$mssql_pass);
mssql_select_db($mssql_db);

$skill1 = 396;
$skill2 = 1374;
$skill3 = 1375;
$skill4 = 1376;
$skill5 = 395;


$query="SELECT char_name,user_data.char_id
FROM user_nobless
INNER JOIN user_data ON user_data.char_id = user_nobless.char_id
WHERE builder = 0 AND account_id > 0 AND subjob_id = 0 
AND user_data.char_id NOT IN 
(
  SELECT DISTINCT char_id 
  FROM user_skill 
  WHERE 
  ( 
    skill_id = $skill1 OR skill_id = $skill2 OR skill_id = $skill3 OR skill_id = $skill4 OR skill_id = $skill5
  )
  AND subjob_id = 0
)
ORDER BY 2
";


$result = mssql_query($query);
$rows = mssql_num_rows($result);

if ($rows) {
  for($i=0;$i<$rows;$i++) {
    $char_name = mssql_result($result, $i, 0);
    $char_id = mssql_result($result, $i, 1);
  
    AddSkillPacket($char_id, $skill1, 1);
    AddSkillPacket($char_id, $skill2, 1);
    AddSkillPacket($char_id, $skill3, 1);
    AddSkillPacket($char_id, $skill4, 1);
    AddSkillPacket($char_id, $skill5, 1);
    
    echo "$char_name - OK<br>";
    
  }
}
else echo "No heros need skills at this moment";

?>
i have error:
Fatal error: Call to undefined function addskillpacket() in /var/www/***************/htdocs/hero.php on line 39
mexekanez 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 23:27.