Raised This Month: $ Target: $400
 0% 

Headshot Mode Script (set_user_hitzones problem)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dakana
New Member
Join Date: Sep 2004
Old 09-06-2004 , 00:40   Headshot Mode Script (set_user_hitzones problem)
Reply With Quote #1

Ok, basically I want to write a plugin that will set a mode where only headshots count that works with CSDM and amx_respawn.

Here's what I have so far

Code:
#pragma tabsize 0
/* 
Headshot Mode
AMXX Plugin
By: Dakana
Free for public use

Description: This plugin, when enabled, makes it so damage will only be done when they hit the head hitzone.
Commands: "amx_hsmode 1" turns HS Mode on. "amx_hsmode 0" turns HS Mode off.
Commands can only be used by admins with ADMIN_KICK level.
*/

#include <amxmodx>
#include <amxmisc>
#include <fun>

public plugin_init()
{
		register_plugin("Headshot Mode", "1.00", "Dakana")
		register_concmd("amx_hsmode", "hsmode", ADMIN_KICK, "Sets 0/1")
}

public hsmode(id, level, cid)
{
		if(!cmd_access(id, level, cid, 0)) {
			console_print(id, "[HS Mode] You do not have access to this command.")
			
			} else {
			new i
			new players[33]
			new players2[33]
				for (i=0; i<33; i++)
				{
					for (new j=0; j<33; j++) 
					{
						set_user_hitzones(players[i], players2[j], 2)
					}
				}
			console_print(id, "[HS Mode] HS Mode ENABLED")
			client_print(0, print_chat, "[HS Mode] HS Mode ENABLED")
			}
	return PLUGIN_HANDLED
}
I'm running TP4, and apparently there is a syntax change in set_user_hitzones. I've tried (players[i], 0, 2) and (0, 0, 2). Neither turned on the headshot-only mode.


By the way, this is my first plugin, so please be patient if I don't understand a reply. I've some programming background, but not much

Thanks in advance!
Dakana is offline
Send a message via AIM to Dakana
Votorx
Senior Member
Join Date: Jun 2004
Old 09-06-2004 , 01:25  
Reply With Quote #2

Code:
set_user_hitzones(players[i], players2[j], 2)

Change Player2[j] to 1

and you have to set the hitzones of all the other body parts to inactive by doing something like

Code:
 set_user_hitzones(players[i], 0, 1)

So now players[i] can't be hit in the...generic...bodypart -.-.
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 09-06-2004 , 04:33  
Reply With Quote #3

Between 0.16 and 0.20 set_user_hitzones reverted to how it was (and probably still is) from OLO's AMX Mod. I created a small plugin to test this. It's getting popular. :-)

Set HS only mode "amx_hitzones 3"
Display help "amx_hitzoneshelp"

The difference is you now can specify bodyparts "inter-individually", ie you could set it up to allow player A to hit everyone anywhere but only hit player B in head, and player B could only hit people in their legs.

This test plugin just sets the same hitzones on everyone though. The generic hitzone should always (?) be used, dunno really what it is used for. Head is 2 and generic is 1, so for a HS only mode you use 3.
Attached Files
File Type: sma Get Plugin or Get Source (hitzones.sma - 1003 views - 2.2 KB)
Johnny got his gun is offline
Dakana
New Member
Join Date: Sep 2004
Old 09-06-2004 , 12:35  
Reply With Quote #4

This is odd..

amx_hitzones 2 did not work for me. Body hitzones were still enabled.

Does TP4 have anything to do with it?
Dakana is offline
Send a message via AIM to Dakana
BAILOPAN
Join Date: Jan 2004
Old 09-06-2004 , 14:10  
Reply With Quote #5

ahem

"The generic hitzone should always (?) be used, dunno really what it is used for. Head is 2 and generic is 1, so for a HS only mode you use 3."
__________________
egg
BAILOPAN is offline
Dakana
New Member
Join Date: Sep 2004
Old 09-08-2004 , 18:08  
Reply With Quote #6

Oops, forgot to add that I tried 3 also.


3 didn't work.
Dakana is offline
Send a message via AIM to Dakana
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 17:28.


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