Thông báo (resets, nạp card) trong game.

Admin

Lính đánh thuê
Staff member
Cái này hồi trước có thấy bạn nào cần mà vẫn chưa có ai giải đáp. Sau mấy ngày vọc MU sv và giờ quyết định bỏ nữa nên share luôn cho AE nào cần

Cái này cũng rất dễ làm, các bạn làm như sau:

- Tạo 1 file .php chứa code sau(VD funct_msg.php):
PHP Code:
<?php
/*Function goi thong tin vao server MU BUZZ!!! Online*/

function ascii2hex($ascii) {
$hex = '';
for (
$i = 0; $i < strlen($ascii); $i++) {
$byte = strtoupper(dechex(ord($ascii{$i})));
$byte = str_repeat('0', 2 - strlen($byte)).$byte;
$hex.=$byte." ";
}
$hex=str_replace(" ", "", $hex);
return
$hex;
}

function
hex2ascii($hex){
$ascii='';
$hex=str_replace(" ", "", $hex);
for(
$i=0; $i<strlen($hex); $i=$i+2) {
$ascii.=chr(hexdec(substr($hex, $i, 2)));
}
return(
$ascii);
}
function
int_int_divide($x, $y) {
if (
$x == 0) return 0;
if (
$y == 0) return FALSE;
return (
$x % $y >= $y / 2) ?
((
$x - ($x % $y)) / $y) + 1 : ($x - ($x % $y)) / $y;
}

function
send_msg($host, $port, $msg)
{
$header = "C144A10024000000";
$msglength = strlen($msg);

if (
$msglength < 34 && $msglength != 0){
$divisor = (34 - $msglength);
$start_space = int_int_divide($divisor , 2);

for (
$i=0;$i<=$start_space;$i++){
$header .= "20";
}
$header .= ascii2hex($msg);

for (
$j=0;$j<=($divisor-$start_space);$j++){
$header .= "20";
}
}else{
$header .= ascii2hex($msg);
}

$header .= "00BED3410000F8BBB90400000000FCBBB904A4FF1A06F8F04100FFFFFFFF";
$packet = hex2ascii($header);
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);

if (!
$x = @socket_connect($socket, $host, $port))
{
echo
"No access to the Joinserver or Server is down.";
}
else
{
socket_write($socket, $packet , strlen($packet));
socket_close($socket);
}

}
?>


Ở file muốn tạo thông báo, VD bạn muốn khi reset thì hệ thống tự thông báo vào game chẳng hạn?
Ở file chứa cấu hình thông tin reset ra, ở đây Ale lấy Mu web 0.8 làm VD(web của lamphuong đó)

mở file do_reset_normal.php hoặc do_reset_vip.php hoặc FW_reset.php ra và kéo xuống gần cuối sẽ thấy 1 đoạn dạng:
PHP Code:
$logfile = 'logs/resets_logs.php';
$ip = $_SERVER['REMOTE_ADDR'];
$date = date('d-m-Y H:i');
$data = "Character $info[character] Has Been <font color=#FF0000>Normal Reseted</font>, Before Reset:$row[1](resets), After Reset:$resetup(resets), All Those On $date By ip:$ip \n";
$fp = fopen($logfile, 'a');
fputs($fp, $data);
fclose($fp);


Thêm vào ở trên nó đoạn code sau:
PHP Code:
include("funct_msg.php");
send_msg("127.0.0.1", "55970", "[HeThong]$info[character] da Reset tu $row[1] len $resetup lan thanh cong!");


Lưu ý: 55970 là port mặc định của joinserver, các bạn nên đổi lại port này khi run onl để bảo mật

Sau đó save lại là xong. Demo:
You must be registered for see images

You must be registered for see images

You must be registered for see images


Tương tự các bạn có thể làm vs các chức năng khác (nạp card chẳng hạn)

Merry Xmas cả nhà
You must be registered for see images
 
Bên trên