This should work if plugin is correct!
Code:
#include <amxmodx>
#include <fun>
#include <engine>
#include <ns>
#define CDICONFLAG 32
#define CUSTOMICONFLAG 256
new g_nocdkills[33]
public plugin_init()
{
register_plugin("C-D Incentive", "1.3", "Darkns")
register_cvar("amx_cdincent", "1")
register_cvar("cdi_nokills", "1")
register_cvar("cdi_nodeaths", "1") //not sure why you'd want this, but whatever...configurability++
register_cvar("cdi_customicon", "1")
if (get_cvar_num("amx_cdincent"))
register_message(get_user_msgid("ScoreInfo"), "scoreinfomsghook")
}
public scoreinfomsghook(id)
{
if (!get_cvar_num("amx_cdincent"))
return BLOCK_NOT
new mid = get_msg_arg_int(1)
if (!is_user_connected(mid))
return BLOCK_NOT
if (pass_cd_check(mid))
{
new flags = get_msg_arg_int(6)
if (!get_cvar_num("cdi_customicon") || !(flags & CUSTOMICONFLAG)) //no custom or they don't have it anyways...
flags |= CDICONFLAG //or'd in
set_msg_arg_int(6, ARG_SHORT, flags)
return BLOCK_SET
}
//else
new kills = get_msg_arg_int(3)
set_msg_arg_int(1, ARG_BYTE, mid) //id
if (get_cvar_num("cdi_nokills")) //kills
{
if (kills)
g_nocdkills[mid] += kills
set_msg_arg_int(2, ARG_SHORT, 0) //score: tried to null this, doesn't work properly...
set_msg_arg_int(3, ARG_SHORT, 0)
set_user_frags(mid, 0) //prevents hidden kills moving them up the board
}
else
{
set_msg_arg_int(2, ARG_SHORT, get_msg_arg_int(2))
set_msg_arg_int(3, ARG_SHORT, kills)
}
if (get_cvar_num("cdi_nodeaths")) //deaths
set_msg_arg_int(4, ARG_SHORT, 0)
else
set_msg_arg_int(4, ARG_SHORT, get_msg_arg_int(4))
set_msg_arg_int(5, ARG_BYTE, get_msg_arg_int(5)) //class
set_msg_arg_int(6, ARG_SHORT, get_msg_arg_int(6)) //auth
set_msg_arg_int(7, ARG_SHORT, get_msg_arg_int(7)) //team
if (g_nocdkills[mid] >= 5)
{
if (get_cvar_num("cdi_nokills"))
ns_popup(mid, "Because you are not running C-D, you will not gain kills or points")
g_nocdkills[mid] = 0
}
return BLOCK_SET
}
//Credit: Asskicr
public pass_cd_check(id)
{
// Ok C-D is required Check the Name
new name[32]
get_user_name(id, name, 31)
if (equal(name,"[MyClan]") || equal(name,"[Old C-D]",9))
return false
return true
}
__________________