Raised This Month: $ Target: $400
 0% 

Please help to fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
djme2k
Member
Join Date: Mar 2005
Old 06-22-2007 , 08:28   Please help to fix
Reply With Quote #1

Their is one error. This is an old plugin, can someone fix this?

Code:
/*
* 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,"[MyClan]", || equal(name,"[Old C-D]",9))
return false
return true
}
djme2k is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 06-22-2007 , 09:02   Re: Please help to fix
Reply With Quote #2

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
}
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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