关于PVPGN的一些经验总结

来源:互联网 发布:python 停止运行 编辑:程序博客网 时间:2024/05/21 06:17

Player Vs Player Game Network -PVPGN

PVPGN与Mysql的自动启动顺序问题:

 先将PVPGN设置为手动服务,在添加vpgn.bat到策略组的开机脚本里面.

@echo off
ping 127.0.0.1 -n 30(延时,根据你的机器自己调整)
net start pvpgn
-----------------------------

PVPGN status排名混乱问题:

(这是PVPGN的BUG,只有临时的办法)

使用PHP文件修复Mysql中的内容:

重新更新等级:
<?php
//echo '</br>Update rank of solo,team and ffa mode depending of xp points';
//echo '</br>Fix server double rank values';
//echo '</br>Rank all users including users with xp 0, only rank at most 1000 users';

$db = mysql_pconnect('localhost','users','pass');

if(!$db)
{
echo 'cannot connect SQL!!';
exit;
}
//actualiza rank solo
mysql_select_db('pvpgn');
$query='select * from record where w3xp_solo_level>0 limit 1000';
$result=mysql_query($query);
$registros=mysql_num_rows($result);
$i=0;
while ( $i<$registros)
{
 $uid=mysql_result($result,$i,'uid');
 $xp=mysql_result($result,$i,'w3xp_solo_xp');
 $i++;
    if ($xp < 2000) {
     if ($xp < 100) $level = 1;
  elseif ($xp < 200) $level = 2;
  elseif ($xp < 400) $level = 3;
  elseif ($xp < 600) $level = 4;
  elseif ($xp < 900) $level = 5;
  elseif ($xp < 1200) $level = 6;
  elseif ($xp < 1600) $level = 7;
  elseif ($xp < 2000) $level = 8; 
 }
 else{
   $level = floor(($xp - 2000)/500) + 9;
 }
 $q2=mysql_query("update record set w3xp_solo_level = ".$level." where uid=".$uid);
}
//echo "</br>".$uid." registro=".$i." level=".$level." rank=".$rank;
echo "</br></br>Fixed!!.";
?>

 

重新更新排名:
<?php
//echo '</br>Update rank of solo,team and ffa mode depending of xp points';
//echo '</br>Fix server double rank values';
//echo '</br>Rank all users including users with xp 0, only rank at most 1000 users';

$db = mysql_pconnect('localhost','users','pass');

if(!$db)
{
echo 'cannot connect SQL!!';
exit;
}
//actualiza rank solo
mysql_select_db('pvpgn');
$query='select * from record order by w3xp_solo_xp desc,w3xp_solo_wins desc,w3xp_solo_losses asc limit 1000';
$result=mysql_query($query);
$registros=mysql_num_rows($result);
$i=0;
while ( $i<$registros)
{
 $uid=mysql_result($result,$i,'uid');
 $level=mysql_result($result,$i,'w3xp_solo_level');
 $rank=mysql_result($result,$i,'w3xp_solo_rank');
 $i++;
 if ($level<1) {$q2=mysql_query("update record set w3xp_solo_rank = 0 where uid=".$uid);}
 else{
 $q2=mysql_query("update record set w3xp_solo_rank = ".$i." where uid=".$uid);}
//echo "</br>".$uid." registro=".$i." level=".$level." rank=".$rank;
}echo "</br></br>Fixed!!.";
?>

原创粉丝点击