teobrvt1995
T.E.T.Я.I.S
- 19/9/10
- 691
- 2
cứ vọc mấy file inc const là có hết 

Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.

cs_set_user_death(id, deaths)Vậy thế bây giờ get số death thế nào.

. Trước tui sài set_task(0.1 set model liên tục = cs_set_user_model, nó output như phim thế là crash luôn. Cho hỏi 1 câu là mình set_task(0.1 để write message liên tục thì có bị lag ko 
static = new có điều static chỉ dùng trong public khai báo nó, ra ngoài là mất luônXin hỏi stock với static là cái gì vậy các đại ka??
Cái này mình cũng nghĩ ra r`, nhưng mà làm thế nào để mỗi lần 1 người kill là nó tự động + thêm vào kill của cả đội nhểđây là vd lấy số kill của team ts vào 1 thời điểm
PHP:stock get_ts_team_kills() { new i, iKill; for(i = 0; i < Max_player; i++) { if(is_user_connected(i) && cs_get_user_team(i) == CS_TEAM_T) { iKill += get_user_frags(i); } } return iKill; }
Ta giải thích stock từ hồi lâu rồi còn gìstatic = new có điều static chỉ dùng trong public khai báo nó, ra ngoài là mất luôn
còn stock hình như = public, cũng chưa hiểu rõ cái này lắm .
---------- Post added at 08:11 ---------- Previous post was at 07:56 ----------
Cái này mình cũng nghĩ ra r`, nhưng mà làm thế nào để mỗi lần 1 người kill là nó tự động + thêm vào kill của cả đội nhể

#include <amxmodx>
#include <fakemeta>
const OFFSET_CSTEAMS = 114
enum
{
CSTEAM_UNASSIGNED = 0,
CSTEAM_TE,
CSTEAM_CT,
CSTEAM_SPECTATOR
}
new iTRKill, iCTKill
public plugin_init()
{
register_plugin("...", "0.1", "...")
register_event("DeathMsg", "event_DeathMsg", "a")
}
public event_DeathMsg()
{
static id
static victim
static teamk
static teamv
id = read_data(1)
victim = read_data(2)
teamk = get_pdata_int(id, OFFSET_CSTEAMS)
teamv = get_pdata_int(victim, OFFSET_CSTEAMS)
if (id == victim || !teamk || !teamv || !is_user_connected(victim) || !is_user_connected(id)) return;
if (teamk == CSTEAM_TE) iTRKill++
else if (teamk == CSTEAM_CT) iCTKill++
}
Thông minh đấy, dùng DeathMSG à. Để ta thử xem đãTa giải thích stock từ hồi lâu rồi còn gì
PHP:#include <amxmodx> #include <fakemeta> const OFFSET_CSTEAMS = 114 enum { CSTEAM_UNASSIGNED = 0, CSTEAM_TE, CSTEAM_CT, CSTEAM_SPECTATOR } new iTRKill, iCTKill public plugin_init() { register_plugin("...", "0.1", "...") register_event("DeathMsg", "event_DeathMsg", "a") } public event_DeathMsg() { static id static victim static teamk static teamv id = read_data(1) victim = read_data(2) teamk = get_pdata_int(id, OFFSET_CSTEAMS) teamv = get_pdata_int(victim, OFFSET_CSTEAMS) if (id == victim || !teamk || !teamv || !is_user_connected(victim) || !is_user_connected(id)) return; if (team == CSTEAM_TE) iTRKill++ else if (team == CSTEAM_CT) iCTKill++ }

#include <amxmodx>
#include <fakemeta>
const OFFSET_CSTEAMS = 114
enum
{
CSTEAM_UNASSIGNED = 0,
CSTEAM_TE,
CSTEAM_CT,
CSTEAM_SPECTATOR
}
new iTRKill, iCTKill
public plugin_init()
{
register_plugin("...", "0.1", "...")
register_event("DeathMsg", "event_DeathMsg", "a")
}
public event_DeathMsg()
{
static id
static victim
static teamk
static teamv
id = read_data(1)
victim = read_data(2)
teamk = get_pdata_int(id, OFFSET_CSTEAMS)
teamv = get_pdata_int(victim, OFFSET_CSTEAMS)
if (id == victim || !teamk || !teamv || !is_user_connected(victim) || !is_user_connected(id)) return;
if (team == CSTEAM_TE) iTRKill++
else if (team == CSTEAM_CT) iCTKill++
}

Mong là từ nay về sau bạn hãy đọc kỹ INCAi cho mình 1 ví dụ dễ hiểu về:
set_task
remove_task
change_task
...
với..
Với cả is_user_connected nghĩa là gì thế?

set_task(1.0, "task_test", 1234) // sau 1.0 giây, plugin thực hiện func task_test (task_test bắt buộc phải là public) với id = 1234
change_task(1234, 0.5) // chỉnh thời gian của task có id = 1234 về 0.5 giây
remove_task(1234) // gỡ bỏ task có id = 1234
is_user_connected(id) // kiểm tra xem id đã kết nối đến server chưa

