AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Old Plug to update (https://forums.alliedmods.net/showthread.php?t=56723)

djme2k 06-19-2007 18:05

Old Plug to update
 
Hi,
can someone help to fix this ?

/*
* Blocks a client's (score/kills/deaths) if they don't have C-D
*
* Note: This is based by name, so they'll have a normal score 'til the name changes to [No C-D] or [Old C-D]
* Also, the NS client seems to calculate score as score + kills, so with noscore 1, but nokills 0, they will have a score equal to their kills...
*
* Cvars: amx_cdincent Disable(0) or enable(1) plugin.
* cdi_nokills No C-D: No kills or score
* cdi_nodeaths No C-D: No deaths shown, this is here for the sake of configurability...
* cdi_customicon If player has a custom icon, it won't be overwritten by the C-D icon. <unfortunately untested>
*
* Author: Darkns
* Date: 25-December-2004
*
* Credits: Asskicr: passCheatDeathCheck function
*
*/

#include <amxmodx>
#include <engine>
#include <ns>

#define CDICONFLAG 32
#define CUSTOMICONFLAG 256

new g_nocdkills[33]

public plugin_modules()
{
require_module("engine")
require_module("ns")
}


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,"[No C-D]",8) || equal(name,"[Old C-D]",9))
return false
return true
}


All times are GMT -4. The time now is 21:30.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.