[AMX][Codes] Hỏi đáp về các code của AMX ...

  • Thread starter Thread starter sontung0
  • Ngày gửi Ngày gửi
Status
Không mở trả lời sau này.
Mấy bác cho hỏi.
Mình làm cái Evolution Cho Bio roài nhưng mà có chút vấn đề ở show hud

PHP:
			set_hudmessage(0,100,0, 0.22, 0.87, _, 0.2, 0.2)
			ShowSyncHudMsg(id, g_SyncHud, "Evolution Point: %s / 5", g_point_zombie)

cái chỗ "%s" là chỗ hiển thị số point đang có

Hud thì đã dc, và khi lây nhiễm 5 còn thì có thể evolution nhưng mà cái chỗ Evolution Point thì nó hiện thế này

untitled.png


Chả thấy cái số báo số point đang có đâu cả. Sửa thế nào vậy mấy bác ?
 
Chỉnh sửa cuối:
Mấy bác cho hỏi.
Mình làm cái Evolution Cho Bio roài nhưng mà có chút vấn đề ở show hud

PHP:
			set_hudmessage(0,100,0, 0.22, 0.87, _, 0.2, 0.2)
			ShowSyncHudMsg(id, g_SyncHud, "Evolution Point: %s / 5", g_point_zombie)

cái chỗ "%s" là chỗ hiển thị số point đang có

Hud thì đã dc, và khi lây nhiễm 5 còn thì có thể evolution nhưng mà cái chỗ Evolution Point thì nó hiện thế này

Uploading...

Chả thấy cái số báo số point đang có đâu cả. Sửa thế nào vậy mấy bác ?

nếu muốn hiển thị số thì phải dùng %i hoặc %d..
 
ai xem hộ cái plugins này với ko complied dc http://share.megaplus.vn/dl.php/2534680

lêch dòng nh` quá, tâp đọc các error đi
nhớ edit cái HEALTIME...
PHP:
#include <amxmodx>
#include <hamsandwich>
#include <fun>
#include <zombieplague>
new bool:g_p_alive[33]
new g_max_players
new nhp[33]
new g_heal
#define HEALTIME 1.0 // edit heal time vao` day !!!

public plugin_precache() 
{ 
g_heal=precache_model("sprites/zb3_heal.spr") 
} 
public plugin_init(){
    register_plugin("AutoRegeneration", "1.0", "Sylwester")
    RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
    RegisterHam(Ham_Killed, "player", "Player_Killed" )
    g_max_players = get_maxplayers()
    set_task(1.0, "regen", 2152, _, _, "b")
     RegisterHam(Ham_TakeDamage, "player", "fw_takedamage")
   }
public fw_takedamage(victim, inflictor, attacker, Float:damage, bits)
{
    if (attacker == inflictor)
    {
        if (zp_get_user_zombie(attacker))
            set_task(HEALTIME, "heal_thing", victim)
    }
  
}

public Player_Spawn(id){
    if(!is_user_alive(id))
        return
    g_p_alive[id] = true
}

public Player_Killed(id){
    g_p_alive[id] = false
}

public client_disconnect(id){
    g_p_alive[id] = false
}

public regen(){
    new victim
    victim = read_data(2)
    
    static id, hp
    for(id=1; id<=g_max_players; id++){
        if(!g_p_alive[id])
            continue
	nhp[id] = zp_get_zombie_maxhealth(id);
        hp = get_user_health(id)
        if(hp >= nhp[id])
        {
            set_user_health(id, hp+100)
	   set_task(0.001, "fire", victim)
        }
    }
}  
fire_zombie(origin[3]) 
{ 
   message_begin(MSG_BROADCAST,SVC_TEMPENTITY) 
   write_byte(TE_SPRITE) 
   write_coord(origin[0]) 
   write_coord(origin[1]) 
   write_coord(origin[2]+=30) 
   write_short(g_heal) 
   write_byte(8) 
   write_byte(255) 
   message_end() 
} 
public fire(victim) 
{ 
   new origin[3] 
   get_user_origin(victim,origin) 
    
   fire_zombie(origin) 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
*/
 
à được rồi. Thanks You :D.........

123.png
 
Chỉnh sửa cuối:
các bác cho xin đoạn code show hud giống cái này đi:
31161264992880.jpg


Chứ thế này thì hơi chán:
123.png
 
@dias dùng đc cái đó thì cũng chả ai thấy , search icon...
 
Thế àh. Chán nhở :|. Evolution gì mà toàn là chữ :))
 
@huucuong_2107198: plugin đây.thay đổi hand bằng cvar nst_wpn_hand nhớ
nếu bị lỗi thì chịu.test ở nhà không bị sao cả
 

Attachments

Chỉnh sửa cuối:
lêch dòng nh` quá, tâp đọc các error đi
nhớ edit cái HEALTIME...
PHP:
#include <amxmodx>
#include <hamsandwich>
#include <fun>
#include <zombieplague>
new bool:g_p_alive[33]
new g_max_players
new nhp[33]
new g_heal
#define HEALTIME 1.0 // edit heal time vao` day !!!

public plugin_precache() 
{ 
g_heal=precache_model("sprites/zb3_heal.spr") 
} 
public plugin_init(){
    register_plugin("AutoRegeneration", "1.0", "Sylwester")
    RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
    RegisterHam(Ham_Killed, "player", "Player_Killed" )
    g_max_players = get_maxplayers()
    set_task(1.0, "regen", 2152, _, _, "b")
     RegisterHam(Ham_TakeDamage, "player", "fw_takedamage")
   }
public fw_takedamage(victim, inflictor, attacker, Float:damage, bits)
{
    if (attacker == inflictor)
    {
        if (zp_get_user_zombie(attacker))
            set_task(HEALTIME, "heal_thing", victim)
    }
  
}

public Player_Spawn(id){
    if(!is_user_alive(id))
        return
    g_p_alive[id] = true
}

public Player_Killed(id){
    g_p_alive[id] = false
}

public client_disconnect(id){
    g_p_alive[id] = false
}

public regen(){
    new victim
    victim = read_data(2)
    
    static id, hp
    for(id=1; id<=g_max_players; id++){
        if(!g_p_alive[id])
            continue
	nhp[id] = zp_get_zombie_maxhealth(id);
        hp = get_user_health(id)
        if(hp >= nhp[id])
        {
            set_user_health(id, hp+100)
	   set_task(0.001, "fire", victim)
        }
    }
}  
fire_zombie(origin[3]) 
{ 
   message_begin(MSG_BROADCAST,SVC_TEMPENTITY) 
   write_byte(TE_SPRITE) 
   write_coord(origin[0]) 
   write_coord(origin[1]) 
   write_coord(origin[2]+=30) 
   write_short(g_heal) 
   write_byte(8) 
   write_byte(255) 
   message_end() 
} 
public fire(victim) 
{ 
   new origin[3] 
   get_user_origin(victim,origin) 
    
   fire_zombie(origin) 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
*/

nó hồi máu cho cả Human +-+ hic hic

---------- Post added at 16:43 ---------- Previous post was at 16:37 ----------

lêch dòng nh` quá, tâp đọc các error đi
nhớ edit cái HEALTIME...
PHP:
#include <amxmodx>
#include <hamsandwich>
#include <fun>
#include <zombieplague>
new bool:g_p_alive[33]
new g_max_players
new nhp[33]
new g_heal
#define HEALTIME 1.0 // edit heal time vao` day !!!

public plugin_precache() 
{ 
g_heal=precache_model("sprites/zb3_heal.spr") 
} 
public plugin_init(){
    register_plugin("AutoRegeneration", "1.0", "Sylwester")
    RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1)
    RegisterHam(Ham_Killed, "player", "Player_Killed" )
    g_max_players = get_maxplayers()
    set_task(1.0, "regen", 2152, _, _, "b")
     RegisterHam(Ham_TakeDamage, "player", "fw_takedamage")
   }
public fw_takedamage(victim, inflictor, attacker, Float:damage, bits)
{
    if (attacker == inflictor)
    {
        if (zp_get_user_zombie(attacker))
            set_task(HEALTIME, "heal_thing", victim)
    }
  
}

public Player_Spawn(id){
    if(!is_user_alive(id))
        return
    g_p_alive[id] = true
}

public Player_Killed(id){
    g_p_alive[id] = false
}

public client_disconnect(id){
    g_p_alive[id] = false
}

public regen(){
    new victim
    victim = read_data(2)
    
    static id, hp
    for(id=1; id<=g_max_players; id++){
        if(!g_p_alive[id])
            continue
	nhp[id] = zp_get_zombie_maxhealth(id);
        hp = get_user_health(id)
        if(hp >= nhp[id])
        {
            set_user_health(id, hp+100)
	   set_task(0.001, "fire", victim)
        }
    }
}  
fire_zombie(origin[3]) 
{ 
   message_begin(MSG_BROADCAST,SVC_TEMPENTITY) 
   write_byte(TE_SPRITE) 
   write_coord(origin[0]) 
   write_coord(origin[1]) 
   write_coord(origin[2]+=30) 
   write_short(g_heal) 
   write_byte(8) 
   write_byte(255) 
   message_end() 
} 
public fire(victim) 
{ 
   new origin[3] 
   get_user_origin(victim,origin) 
    
   fire_zombie(origin) 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
*/

nó hồi máu cho cả Human +-+ hic hic
 
thêm rồi vẫn bị ><
...................
 
thêm vào đâu ? này thì 30 cục chả
 
Chắc tên kakaan96 ko biết thêm :))
 
>< nói nghe chán .......................
 
@kakaan code đó chả có tác dụng gì ,làm lại cái mới cho lành
 
OnLine mà ko chịu lên ym :-w hả tên kakaan96

---------- Post added at 20:34 ---------- Previous post was at 18:56 ----------

Ta vừa làm Code Evolution For ZombiePlague.
Anh Em test xem nhé :)

Code này tự ta viết. No Copy Paste, No Steal :)

PHP:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <fun>
#include <zombieplague>

#define PLUGIN "ZombiePlague: Evolution"
#define VERSION "1.0"
#define AUTHOR "Sophia - Dias"

new g_point_zombie[33] // Biến để lưu trữ point cho 32 player + 1 sv  là 33
new g_SyncHud
new evolved[33] = 0 // Biến này là biến Evolution nếu là 1 thì tức là user đã evolution, nếu là 0 thì là zombie thường. Thực ra thì không có cái biến này. nhưng để dễ xác định User evolution và user not evolution thì dias tạo switch này cho dễ xác định

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    g_SyncHud = CreateHudSyncObj()
    register_logevent("event_round_end", 2, "1=Round_End")
}

public client_putinserver(id)
{
    set_task(0.1, "task_show_evolution", id, _, _, "b") // Hiển thị evolution Point
}

public task_show_evolution(id)
{
    if(is_user_alive(id) && zp_get_user_zombie(id))
    {
        if(evolved[id] == 1) // Nếu User là zombie và đã tiến hóa thì
        {
            set_hudmessage(255,0,0, 0.015, 0.68, _, 0.2, 0.2)
            ShowSyncHudMsg(id, g_SyncHud, "Evolution Point: 1000 / 1000 Point^nEvolution Status: Evolved") // Hud Đã tiến hóa
            } else {
            set_hudmessage(0,100,0, 0.1, 0.68, _, 0.2, 0.2)
            ShowSyncHudMsg(id, g_SyncHud, "Evolution Point: %i / 1000 Point^nEvolution Status: Not Evolved", g_point_zombie[id]) // Hud Chưa tiến hóa
             }
    }   
     
}


public zp_user_infected_post(victim, infector)
{
    g_point_zombie[victim] = 0 // trả point của victim về 0
    evolved[victim] = 0 // Victim mới bị nhiễm thì làm gì dc Tiến hóa phải ko ^^
     
    if (is_user_alive(infector) && zp_get_user_zombie(infector))
    {
        g_point_zombie[infector]+= 200 // +200 Point Khi Infect 1 ai đó
        evolution(infector) // Tiến hóa(chưa hết đâu. trong phần tiến hóa con có check point nữa cơ :). ko phải tiến hóa ngay đâu)
    }
}

public zp_user_humanized_post(id)
{
 // Trả point về 0 và tắt sự tiến hóa khi làm Human
    g_point_zombie[id] = 0 
    evolved[id] = 0
}

public evolution(id)
{
    if(is_user_alive(id) && zp_get_user_zombie(id) && g_point_zombie[id] >= 1000) // Đây là phần check point để tiến hóa. 1000 là point yêu cầu để tiến hóa. vậy là 1 lần infect là 200 point => infect 5 lần là Tiến lên -> Evol :))
    {
       evolved[id] = 1
        set_hudmessage(255, 40, 40, -1.0, -1.0, 1, 0.0, 10.0, 0.01, 0.2, -1)
        show_hudmessage(id, "You Are Evolved") // Hiển thị hud khi tiến hóa

// Muốn Zombie sau khi tiến hóa thê nào thì thêm code vào đây

    }
     else
    {
        set_hudmessage(255, 40, 40, -1.0, -1.0, 0, 0.0, 3.0, 0.01, 0.01, -1)
                  show_hudmessage(id, "[Evolution] +200 Point") // Hiển thị hud khi infect 1 ai đó và nhận 200 Point
     }
   
}
 
public event_round_end(id)
{
// Trả point về 0, và tắt evolution Khi ván kết thúc
    g_point_zombie[id] = 0
    evolved[id] = 0
}
 
Chỉnh sửa cuối:
NICE nhưng vẫn ko chuyển dc models khi tiến hóa

---------- Post added at 21:38 ---------- Previous post was at 21:12 ----------

mà làm SVEX LAUncher có khó không nhỉ
 
nên để đk trong cái infect post :| , ủa mà tiến hóa nó có tác dụng gì rứa ? show hud hả ? O.o
 
@huucuong_2107198: plugin đây.thay đổi hand bằng cvar nst_wpn_hand nhớ
nếu bị lỗi thì chịu.test ở nhà không bị sao cả

Thanks cậu ! Thực ra tớ fix được rồi ! Dù sao cũng thanks cậu nhiều!
Có một vấn đề mà lần trước nhờ cậu. Đó là trong nst wpn của cậu viết thêm 1 cái native, trong sự kiện curwpn cậu làm sao lưu dùm 1 biến toàn cục dạng string cái tên model súng đang cầm (tên model này khai báo trong file nst_wpn.ini ). Tớ muốn nhờ như vậy vì tớ muốn hiện hud súng mới. Được không cậu? Được giúp tớ cái, nhanh chóng hoàn thành cái CSCFE.
Còn nếu cậu không tính toán so đo thì có thể share tớ code bộ WPN của cậu. Vì Red cũng đang gặp vấn đề, vả lại cái của cậu chạy ổn định.
Nếu cậu share thì tất nhiên tớ không cần cậu viết native rùi hihi
yahoomail: [email protected]
 
Status
Không mở trả lời sau này.
Back
Top