[AMX] Tổng hợp Code, Plug do Mem chế hoặc giới thiệu

  • Thread starter Thread starter Orpheus
  • Ngày gửi Ngày gửi
Làm xong extractor cho gõ name ^v^
cậu xem thử, mình dùng cái này extract ra đc 1ltb 1dtx 212wav trg file test.rez đó
PHP:
<?php
function hexToStr($hex){ $string='';   for ($i=0; $i < strlen($hex)-1; $i+=2)    {   $string .= chr(hexdec($hex[$i].$hex[$i+1]));   }return $string;}
function read_stdin()
{
        $fr=fopen("php://stdin","r");   // open our file pointer to read from stdin
        $input = fgets($fr,128);        // read a maximum of 128 characters
        $input = rtrim($input);         // trim any trailing spaces.
        fclose ($fr);                   // close the file handle
        return $input;                  // return the text entered
}

echo "Nhap ten file rez: ";
$tenfile = read_stdin();
echo "\nNhap 1 de extract sounds";
echo "\nNhap 2 de extract textures";
echo "\nNhap 3 de extract models\n";
$loai = read_stdin();

while($loai<=3)
{
if ($loai=="1")
{
$rez = file_get_contents($tenfile); // get the rez as a string

$wavs = explode(hexTostr('52494646'),$rez); //make an array containing the wavs, its header is cut off, but we gonna fix that

foreach($wavs as $k => $v) {
   if($k==0) continue; //skip the first, its the rez header
  $f = fopen("sound_".$k.".wav","a+"); //save as sound_NUMBER
  fwrite($f,hexTostr('52494646 ').$v); //write the header + the wav itself
  fclose($f);
}
echo "\nExtract sounds thanh cong";
break;
}

else if ($loai=="2")
{
$rez = file_get_contents($tenfile); // get the rez as a string

$dtxs = explode(hexTostr('00000000FBFFFFFF'),$rez); //make an array containing the dtxs, its header is cut off, but we gonna fix that

foreach($dtxs as $k => $v) {
   if($k==0) continue; //skip the first, its the rez header
  $f = fopen("texture_".$k.".dtx","a+"); //save as texture_NUMBER
  fwrite($f,hexTostr('00000000FBFFFFFF ').$v); //write the header + the dtx itself
  fclose($f);
}
echo "\nExtract textures thanh cong";
break;
}

else if ($loai=="3")
{
$rez = file_get_contents($tenfile); // get the rez as a string

$ltbs = explode(hexTostr('0100090000000000'),$rez); //make an array containing the ltbs, its header is cut off, but we gonna fix that

foreach($ltbs as $k => $v) {
   if($k==0) continue; //skip the first, its the rez header
  $f = fopen("model_".$k.".ltb","a+"); //save as model_NUMBER
  fwrite($f,hexTostr('0100090000000000 ').$v); //write the header + the ltb itself
  fclose($f);
}
echo "\nExtract models thanh cong";
break;
}

else
{
  echo "\nBan nhap sai, xin nhap lai so 1 hoac 2 hoac 3\n";
  $loai = read_stdin();
}
}
sleep(5);
?>
 

Attachments

Chỉnh sửa cuối:
@@ TRishty làm được rồi còn bảo mình viết lại bằng cái khác làm gì nữa. Cứ dùng cái tools ^ đó đi.
Mà cái tools trên extract vào đâu đấy. Nhấn extract nó thông báo bạn đã extract thành công mà chả thấy đâu ???
 
Chỉnh sửa cuối:
@@ TRishty làm được rồi còn bảo mình viết lại bằng cái khác làm gì nữa. Cứ dùng cái tools ^ đó đi.

Mới vừa mò viết xong mấy tiếng trước thôi :D
 
Mà cái tools trên extract vào đâu đấy. Nhấn extract nó thông báo bạn đã extract thành công mà chả thấy đâu ???

.......................................................
 
Thử cái này xem. Mình compile = 3 tool khác nhau
https://mega.co.nz/#!dNBBDKSB!3Q3OMqSIcP9b6qjIev0j_nxQYjopy8VuUCZhBQehbfM

ko đc thì thử tự compile xem sao =_=

rezextract và test.rez chung folder. File extract ra cũng chung 1 folder
chay gõ test.rez enter -> gõ 1 enter

Vừa nãy cụt code bỏ vào phpextractor.php ->replace thì đc !
Nên làm trên winfrom sẽ tiện hơn là cứ ngồi nhập char vào như thế này, nếu làm số lượng lớn rez. Multi select, multi extract..
 
Extract nhiều lúc thì phải set luồng, còn phải sắp xếp thứ tự ưu tiên ! Nói chung cũng hơi khó đấy ^_^

- - - Updated - - -

Extract nhiều lúc thì phải set luồng, còn phải sắp xếp thứ tự ưu tiên ! Nói chung cũng hơi khó đấy ^_^
Extract rez bh không phải là khó lắm, nhưng cái cần là cấu tạo mấy file bên trong để còn giải thuật ^_^. Tôi giải ra lỗi hết cả dtx ^_^
 
Có cách nào để lấy icon sprites từ file hud.txt dựa vào cái này hay không vậy các bạn
Mã:
/*
#include <amxmodx>

#define PLUGIN "Weapon Icon"
#define VERSION "1.2"
#define AUTHOR "aaa"

#define MAX_PLAYERS 32

new iconstatus, pcv_iloc
new user_icons[MAX_PLAYERS+1][16]


public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_event("CurWeapon", "update_icon", "be", "1=1")
	register_event("AmmoX", "draw_icon", "be")
	register_event("DeathMsg", "event_death", "a")
	
	pcv_iloc = register_cvar("amx_weapon_location", "1")
	
	check_icon_loc()
}

public update_icon(id) 
{
	remove_weapon_icon(id)
	
	check_icon_loc()
		
	if( get_pcvar_num(pcv_iloc) == 0 || is_user_bot(id) )
		return
		
	static sprite[16], iwpn, clip, ammo

	iwpn = get_user_weapon(id, clip, ammo)
	
	switch(iwpn) 
	{
		case CSW_P228: 
		sprite = "d_p228"
		case CSW_SCOUT: 
		sprite = "d_scout"
		case CSW_HEGRENADE: 
		sprite = "d_grenade"
		case CSW_XM1014:
		sprite = "d_xm1014"
		case CSW_MAC10: 
		sprite = "d_mac10"
		case CSW_AUG: 
		sprite = "d_aug"
		case CSW_SMOKEGRENADE: 
		sprite = "d_flashbang"
		case CSW_ELITE: 
		sprite = "d_elite"
		case CSW_FIVESEVEN: 
		sprite = "d_fiveseven"
		case CSW_UMP45: 
		sprite = "d_ump45"
		case CSW_SG550: 
		sprite = "d_sg550"
		case CSW_GALIL: 
		sprite = "d_galil"
		case CSW_FAMAS: 
		sprite = "d_famas"
		case CSW_USP: 
		sprite = "d_usp"
		case CSW_MP5NAVY: 
		sprite = "d_mp5navy"
		case CSW_M249: 
		sprite = "d_m249"
		case CSW_M3: 
		sprite = "d_m3"
		case CSW_M4A1: 
		sprite = "d_m4a1"
		case CSW_TMP: 
		sprite = "d_tmp"
		case CSW_G3SG1: 
		sprite = "d_g3sg1"
		case CSW_FLASHBANG:
		sprite = "d_flashbang"
		case CSW_DEAGLE: 
		sprite = "d_deagle"
		case CSW_SG552: 
		sprite = "d_sg552"
		case CSW_AK47: 
		sprite = "d_ak47"
		case CSW_KNIFE: 
		sprite = "d_knife"
		case CSW_P90: 
		sprite = "d_p90"
		case CSW_GLOCK18: 
		sprite = "d_glock18"
		case CSW_AWP: 
		sprite = "d_awp"
		default: 
		return
	}	
	user_icons[id] = sprite
	
	draw_icon(id)
	
	return
} 


public draw_icon(id)
{
	static iwpn, clip, ammo, icon_color[3]
	
	iwpn = get_user_weapon(id, clip, ammo)
	
	// ammo check, this is for the color of the icon
	if ((ammo == 0 && clip == 0))
		icon_color = {255, 0, 0} // outta ammo!
	else if ( ammo==0 && iwpn!=CSW_KNIFE)
		icon_color = {255, 160, 0} // last clip!
	else 
		icon_color = {0, 160, 0}//green icon...decent ammo
	
	
	// draw the sprite itself
	message_begin(MSG_ONE,iconstatus,{0,0,0},id)
	write_byte(1) // status (0=hide, 1=show, 2=flash)
	write_string(user_icons[id]) // sprite name
	write_byte(icon_color[0]) // red
	write_byte(icon_color[1]) // green
	write_byte(icon_color[2]) // blue
	message_end()
}


public remove_weapon_icon(id) 
{
	message_begin(MSG_ONE,iconstatus,{0,0,0},id)
	write_byte(0)
	write_string(user_icons[id])
	message_end()
}


public event_death() 
{
	new id = read_data(2) // the dead player's ID (1-32)
	
	if (!is_user_bot(id)) 
		remove_weapon_icon(id) 
}


public check_icon_loc() 
{
	new value = get_pcvar_num(pcv_iloc)
	
	if (value == 1)
		iconstatus = get_user_msgid("StatusIcon")
	else if (value == 2)
		iconstatus = get_user_msgid("Scenario")
	else
		iconstatus = 0
	
	return PLUGIN_CONTINUE
}
 
Làm thế nào để lấy được mấy hàm trong dll lạ mà mình không biết nhỉ ?
 
lấy tên hàm đc nhưng ko lấy arg của nó đc 8-|
 
mò từng char à -_- Mà không phải lấy bằng amx đâu nhé, vs C object cơ
 
Nhưng trong đây biết C nhiều hơn :v.
 
vứt đây thử xem nào.....................
 
^: vứt gì :v
proj à ?

- - - Updated - - -

^: vứt gì :v
proj à ?
 
arg phải mò thôi -_-". xài dllexport thử
 
............................................................
 
Chỉnh sửa cuối:
Ai có ý tưởng nào về tìm đường đi ngắn nhất của bot đến đích không nhỉ ?
 
Back
Top