Monthly Target: $400 Donations: $72
 18% 

[REQ]Some edits for AMX_shot_admin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ajrjvjv
Junior Member
Join Date: Mar 2012
Old 03-29-2012 , 06:23   [REQ]Some edits for AMX_shot_admin
Reply With Quote #1

hello guy's here is the mod:

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>

#define PLUGIN "Shot Administration"
#define VERSION "1.1"
#define AUTHOR "Nomexous"

/*

Version 1.0
 - Initial release.
 
Version 1.1
 - Small optimization with the menu.
 
 */

new settings[33] = { 0, ... }
new menu

new traceline_forward = -1, tracehull_forward = -1

new mode[] = {    0, // None
                  1, // Makes headshots (shooter)
	         2, // Reflects bullets back to shooter
                 3, // Gets headshot (victim)
                 4, // Bad aimer (shots randomly directed to left or right leg)
                 5, // Deals no damage (shots directed to HIT_SHIELD)
                 6, // Suicider
                 7  // Uber suicider
              }

#pragma unused mode // Gets rid of "symbol mode not used" warning.

new label[][] = { "None", // Yellow text if it's good, red if bad
		  "\yShooter",
		  "\yBullect reflector",
		  "\rVictim",
		  "\rBad Aim",
		  "\rNo Damage",
		  "\rSuicider",
		  "\rUber Suicider"
		}

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
		
	register_clcmd("amx_shot_admin", "conjure_menu", ADMIN_SLAY, "Displays shot administration menu.")
}

public client_disconnect(id)
{
	settings[id] = 0
}

public set_forwards_registered(bool:condition)
{
	if (condition && traceline_forward == -1 && tracehull_forward == -1)
	{
		traceline_forward = register_forward(FM_TraceLine, "fw_traceline")
		tracehull_forward = register_forward(FM_TraceHull, "fw_tracehull", 1)
	}
	
	if (!condition && traceline_forward != -1 && tracehull_forward != -1)
	{
		unregister_forward(FM_TraceLine, traceline_forward)
		unregister_forward(FM_TraceHull, tracehull_forward, 1)
		
		traceline_forward = -1
		tracehull_forward = -1	
	}
	return PLUGIN_HANDLED
}

public conjure_menu(id, level, cid)
{
	if (cmd_access(id, level, cid, 1))
	{
		build_menu(id)
	}
	return PLUGIN_HANDLED
}

// For some reason, they don't allow default argument items in public functions.
stock build_menu(id, page = 0)
{
	menu = menu_create("Shot Administration Menu", "menu_handler")
	
	static players[32], num, name[32], cmd[5], itemtxt[60]
	
	get_players(players, num)
	for (new i; i < num; i++)
	{
		get_user_name(players[i], name, 31)
		
		formatex(cmd, 4, "%i", players[i])
		formatex(itemtxt, 59, "%s: %s", name, label[settings[players[i]]])
		
		menu_additem(menu, itemtxt, cmd)
	}
	
	menu_display(id, menu, page)
	return PLUGIN_CONTINUE
}

public menu_handler(id, menu, item)
{
	if (item < 0)
	{
		for (new i; i < 33; i++)
		{
			if (settings[i] != 0)
			{
				set_forwards_registered(true)
				return PLUGIN_HANDLED
			}
		}
		
		set_forwards_registered(false)
		return PLUGIN_HANDLED
	}
	
	static cmd[5], callback, access, pid
	menu_item_getinfo(menu, item, access, cmd, 4, _, _, callback)
	
	pid = str_to_num(cmd)
	
	if (is_user_connected(pid))
	{
		settings[pid] = ++settings[pid] % (sizeof mode)
	}
	
	menu_destroy(menu)
		
	build_menu(id, item / 7)
	return PLUGIN_HANDLED
}

public fw_traceline(Float:start[3], Float:end[3], conditions, id, ptr)
{
	return process_trace(id, ptr)
}

public fw_tracehull(Float:start[3], Float:end[3], conditions, hull, id, ptr)
{
	return process_trace(id, ptr)
}

public process_trace(id, ptr)
{
	if (!is_user_alive(id)) return FMRES_IGNORED
	new target = get_tr2(ptr, TR_pHit)
	
	switch (settings[id])
	{
		// Shooter (headshots galore) mode. See how many kills you can get before people notice...
		case 1:
		{
			if (!is_user_alive(target)) return FMRES_IGNORED
			
			new Float:origin[3], Float:angles[3]
			engfunc(EngFunc_GetBonePosition, target, 8, origin, angles)
			set_tr2(ptr, TR_vecEndPos, origin)
			// Why get bone origin? Well, CS will draw the blood spray from the headshot where ever your bullet was supposed to
			// land, as defined by the end[3] coordinates passed to the forward. So that meant shooting a person in the foot with the
			// shot being redirected to the head would produce a blood spray coming out of the foot. This made it a little harder
			// to hide the fact that you were 'cheating.' So, we just reset end[3] to the coordinates of the head bone of whomever
			// we're shooting, and we're in business!
			set_tr2(ptr, TR_iHitgroup, HIT_HEAD)
		}
		
		// Bad aiming. It doesn't help much. Usually it only takes 1 more hit than normal to kill. But they can't headshot, no matter
		// how hard they try.
		case 4:
		{
			if (!is_user_alive(target)) return FMRES_IGNORED
			set_tr2(ptr, TR_iHitgroup, random_num(HIT_LEFTLEG, HIT_RIGHTLEG))
			return FMRES_IGNORED
		}
		
		// Redirects hitgroup to HIT_SHIELD. This might be annoying to the person who gets shot, but it won't hurt them. Might throw
		// off their aim. I was going to use set_tr2(ptr, TR_flFraction, 100.0) but it does something weird with shotguns. Instead of
		// dealing no damage, shotguns actually give the target a gigantic boost in health! I couldn't figure it out, so I just left
		// it as this.
		case 5:
		{
			if (!is_user_alive(target)) return FMRES_IGNORED
			set_tr2(ptr, TR_iHitgroup, 8)
		}
		
		// A hit on the enemy is redirected onto the shooter. Pretty simple.
		case 6:
		{
			if (is_user_alive(target) && cs_get_user_team(target) != cs_get_user_team(id))
			{
				set_tr2(ptr, TR_pHit, id)
			}
		}
		
		// A hit anywhere (teammate, wall, or enemy) is redirected onto the shooter's head.
		case 7:
		{
			set_tr2(ptr, TR_pHit, id)
			set_tr2(ptr, TR_iHitgroup, HIT_HEAD)
			return FMRES_IGNORED
		}
	}
	
	// Person gets shot anywhere, it's turned into a headshot.
	if (is_user_alive(target) && settings[target] == 3)
	{
		set_tr2(ptr, TR_iHitgroup, HIT_HEAD)
	}
	
	// Shot is reflected to shooter. Giving this to someone makes them immune to guns.
	if (is_user_alive(target) && settings[target] == 2)
	{
		set_tr2(ptr, TR_pHit, id)
	}
	
	return FMRES_IGNORED
}
If u can remove all other functions please - and make only
1.None
2.Shooter

and more 1 request please
if u can change that when i hit in the legs or hands it wont be headshot
only when i hit chest , neck and head (ofcurse ;P) please.

thanks :S

Last edited by ajrjvjv; 03-29-2012 at 06:26.
ajrjvjv is offline
DarkT1
Member
Join Date: Oct 2011
Old 03-29-2012 , 07:27   Re: [REQ]Some edits for AMX_shot_admin
Reply With Quote #2

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>

#define PLUGIN "Shot Administration i am noob"
#define VERSION "1.1"
#define AUTHOR "Nomexous"

/*

Version 1.0
- Initial release.

Version 1.1
- Small optimization with the menu.

*/

new settings[33] = { 0, ... }
new menu

new traceline_forward = -1, tracehull_forward = -1

new mode[] = { 0, // None
1, // Makes headshots (shooter)
2, // Reflects bullets back to shooter
3, // Gets headshot (victim)
4, // Bad aimer (shots randomly directed to left or right leg)
5, // Deals no damage (shots directed to HIT_SHIELD)
6, // Suicider
7 // Uber suicider
}

#pragma unused mode // Gets rid of "symbol mode not used" warning.

new label[][] = { "None", // Yellow text if it's good, red if bad
"\yShooter",
}

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

register_clcmd("amx_shot_noob", "conjure_menu", ADMIN_SLAY, "Displays shot administration menu.")
}

public client_disconnect(id)
{
settings[id] = 0
}

public set_forwards_registered(bool:condition)
{
if (condition && traceline_forward == -1 && tracehull_forward == -1)
{
traceline_forward = register_forward(FM_TraceLine, "fw_traceline")
tracehull_forward = register_forward(FM_TraceHull, "fw_tracehull", 1)
}

if (!condition && traceline_forward != -1 && tracehull_forward != -1)
{
unregister_forward(FM_TraceLine, traceline_forward)
unregister_forward(FM_TraceHull, tracehull_forward, 1)

traceline_forward = -1
tracehull_forward = -1
}
return PLUGIN_HANDLED
}

public conjure_menu(id, level, cid)
{
if (cmd_access(id, level, cid, 1))
{
build_menu(id)
}
return PLUGIN_HANDLED
}

// For some reason, they don't allow default argument items in public functions.
stock build_menu(id, page = 0)
{
menu = menu_create("Shot Administration Menu", "menu_handler")

static players[32], num, name[32], cmd[5], itemtxt[60]

get_players(players, num)
for (new i; i < num; i++)
{
get_user_name(players[i], name, 31)

formatex(cmd, 4, "%i", players[i])
formatex(itemtxt, 59, "%s: %s", name, label[settings[players[i]]])

menu_additem(menu, itemtxt, cmd)
}

menu_display(id, menu, page)
return PLUGIN_CONTINUE
}

public menu_handler(id, menu, item)
{
if (item < 0)
{
for (new i; i < 33; i++)
{
if (settings[i] != 0)
{
set_forwards_registered(true)
return PLUGIN_HANDLED
}
}

set_forwards_registered(false)
return PLUGIN_HANDLED
}

static cmd[5], callback, access, pid
menu_item_getinfo(menu, item, access, cmd, 4, _, _, callback)

pid = str_to_num(cmd)

if (is_user_connected(pid))
{
settings[pid] = ++settings[pid] % (sizeof mode)
}

menu_destroy(menu)

build_menu(id, item / 7)
return PLUGIN_HANDLED
}

public fw_traceline(Float:start[3], Float:end[3], conditions, id, ptr)
{
return process_trace(id, ptr)
}

public fw_tracehull(Float:start[3], Float:end[3], conditions, hull, id, ptr)
{
return process_trace(id, ptr)
}

public process_trace(id, ptr)
{
if (!is_user_alive(id)) return FMRES_IGNORED
new target = get_tr2(ptr, TR_pHit)

switch (settings[id])
{
// Shooter (headshots galore) mode. See how many kills you can get before people notice...
case 1:
{
if (!is_user_alive(target)) return FMRES_IGNORED

new Floatrigin[3], Float:angles[3]
engfunc(EngFunc_GetBonePosition, target, 8, origin, angles)
set_tr2(ptr, TR_vecEndPos, origin)
// Why get bone origin? Well, CS will draw the blood spray from the headshot where ever your bullet was supposed to
// land, as defined by the end[3] coordinates passed to the forward. So that meant shooting a person in the foot with the
// shot being redirected to the head would produce a blood spray coming out of the foot. This made it a little harder
// to hide the fact that you were 'cheating.' So, we just reset end[3] to the coordinates of the head bone of whomever
// we're shooting, and we're in business!
set_tr2(ptr, TR_iHitgroup, HIT_HEAD)
}

// Bad aiming. It doesn't help much. Usually it only takes 1 more hit than normal to kill. But they can't headshot, no matter
// how hard they try.
case 4:
{
if (!is_user_alive(target)) return FMRES_IGNORED
set_tr2(ptr, TR_iHitgroup, random_num(HIT_LEFTLEG, HIT_RIGHTLEG))
return FMRES_IGNORED
}

// Redirects hitgroup to HIT_SHIELD. This might be annoying to the person who gets shot, but it won't hurt them. Might throw
// off their aim. I was going to use set_tr2(ptr, TR_flFraction, 100.0) but it does something weird with shotguns. Instead of
// dealing no damage, shotguns actually give the target a gigantic boost in health! I couldn't figure it out, so I just left
// it as this.
case 5:
{
if (!is_user_alive(target)) return FMRES_IGNORED
set_tr2(ptr, TR_iHitgroup,
}

// A hit on the enemy is redirected onto the shooter. Pretty simple.
case 6:
{
if (is_user_alive(target) && cs_get_user_team(target) != cs_get_user_team(id))
{
set_tr2(ptr, TR_pHit, id)
}
}

// A hit anywhere (teammate, wall, or enemy) is redirected onto the shooter's head.
case 7:
{
set_tr2(ptr, TR_pHit, id)
set_tr2(ptr, TR_iHitgroup, HIT_HEAD)
return FMRES_IGNORED
}
}

// Person gets shot anywhere, it's turned into a headshot.
if (is_user_alive(target) && settings[target] == 3)
{
set_tr2(ptr, TR_iHitgroup, HIT_HEAD)
}

// Shot is reflected to shooter. Giving this to someone makes them immune to guns.
if (is_user_alive(target) && settings[target] == 2)
{
set_tr2(ptr, TR_pHit, id)
}

return FMRES_IGNORED
}
DarkT1 is offline
bLacK-bLooD
Senior Member
Join Date: Jun 2008
Location: Copenhagen, Denmark
Old 03-29-2012 , 07:45   Re: [REQ]Some edits for AMX_shot_admin
Reply With Quote #3

Here you go.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>

#define PLUGIN "Shot Administration"
#define VERSION "1.1"
#define AUTHOR "Nomexous"

/*

Version 1.0
 - Initial release.
 
Version 1.1
 - Small optimization with the menu.
 
 */

new settings[33] = { 0, ... }
new 
menu

new traceline_forward = -1tracehull_forward = -1

new mode[] = {    0// None
                  
1// Makes headshots (shooter)
              
}

#pragma unused mode // Gets rid of "symbol mode not used" warning.

new label[][] = { "None"// Yellow text if it's good, red if bad
          
"\yShooter"
        
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
        
    
register_clcmd("amx_shot_admin""conjure_menu"ADMIN_SLAY"Displays shot administration menu.")
}

public 
client_disconnect(id)
{
    
settings[id] = 0
}

public 
set_forwards_registered(bool:condition)
{
    if (
condition && traceline_forward == -&& tracehull_forward == -1)
    {
        
traceline_forward register_forward(FM_TraceLine"fw_traceline")
        
tracehull_forward register_forward(FM_TraceHull"fw_tracehull"1)
    }
    
    if (!
condition && traceline_forward != -&& tracehull_forward != -1)
    {
        
unregister_forward(FM_TraceLinetraceline_forward)
        
unregister_forward(FM_TraceHulltracehull_forward1)
        
        
traceline_forward = -1
        tracehull_forward 
= -1    
    
}
    return 
PLUGIN_HANDLED
}

public 
conjure_menu(idlevelcid)
{
    if (
cmd_access(idlevelcid1))
    {
        
build_menu(id)
    }
    return 
PLUGIN_HANDLED
}

// For some reason, they don't allow default argument items in public functions.
stock build_menu(idpage 0)
{
    
menu menu_create("Shot Administration Menu""menu_handler")
    
    static 
players[32], numname[32], cmd[5], itemtxt[60]
    
    
get_players(playersnum)
    for (new 
inumi++)
    {
        
get_user_name(players[i], name31)
        
        
formatex(cmd4"%i"players[i])
        
formatex(itemtxt59"%s: %s"namelabel[settings[players[i]]])
        
        
menu_additem(menuitemtxtcmd)
    }
    
    
menu_display(idmenupage)
    return 
PLUGIN_CONTINUE
}

public 
menu_handler(idmenuitem)
{
    if (
item 0)
    {
        for (new 
i33i++)
        {
            if (
settings[i] != 0)
            {
                
set_forwards_registered(true)
                return 
PLUGIN_HANDLED
            
}
        }
        
        
set_forwards_registered(false)
        return 
PLUGIN_HANDLED
    
}
    
    static 
cmd[5], callbackaccesspid
    menu_item_getinfo
(menuitemaccesscmd4__callback)
    
    
pid str_to_num(cmd)
    
    if (
is_user_connected(pid))
    {
        
settings[pid] = ++settings[pid] % (sizeof mode)
    }
    
    
menu_destroy(menu)
        
    
build_menu(iditem 7)
    return 
PLUGIN_HANDLED
}

public 
fw_traceline(Float:start[3], Float:end[3], conditionsidptr)
{
    return 
process_trace(idptr)
}

public 
fw_tracehull(Float:start[3], Float:end[3], conditionshullidptr)
{
    return 
process_trace(idptr)
}

public 
process_trace(idptr)
{
    if (!
is_user_alive(id)) return FMRES_IGNORED
    
new target get_tr2(ptrTR_pHit)
    
    switch (
settings[id])
    {
        
// Shooter (headshots galore) mode. See how many kills you can get before people notice...
        
case 1:
        {
            if (!
is_user_alive(target)) return FMRES_IGNORED
            
            
new Float:origin[3], Float:angles[3]
            
engfunc(EngFunc_GetBonePositiontarget8originangles)
            
set_tr2(ptrTR_vecEndPosorigin)
            
set_tr2(ptrTR_iHitgroupHIT_HEAD)
        }
    }
    
    
// Person gets shot anywhere, it's turned into a headshot.
    
if (is_user_alive(target) && settings[target] == 3)
    {
        
set_tr2(ptrTR_iHitgroupHIT_HEAD)
    }
    
    
// Shot is reflected to shooter. Giving this to someone makes them immune to guns.
    
if (is_user_alive(target) && settings[target] == 2)
    {
        
set_tr2(ptrTR_pHitid)
    }
    
    return 
FMRES_IGNORED

__________________
We all live under the same sky but we have different horizons.

Last edited by bLacK-bLooD; 03-29-2012 at 07:47. Reason: Edited the code a bit.
bLacK-bLooD is offline
Reply


Thread Tools
Display Modes

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 11:23.


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