View Single Post
Old 02.08.2007, 13:16   #2
FidoW
Архивный участник
 
Join Date: Sep 2005
Posts: 1,014
Default

Quote:
Originally Posted by Fot@r@s View Post
I have made this script... it gives the heroskills in all subclasses and not only ine main.

.... .... .... .... .... ....
.... .... .... .... .... ....
.... .... .... .... .... ....
.... .... .... .... .... ....

Don't forget to make a DB BackUp and please test it and say results
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...
FidoW is offline