AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Headshot Mode Script (set_user_hitzones problem) (https://forums.alliedmods.net/showthread.php?t=5589)

Dakana 09-06-2004 00:40

Headshot Mode Script (set_user_hitzones problem)
 
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 :oops:

Thanks in advance!

Votorx 09-06-2004 01:25

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 -.-.

Johnny got his gun 09-06-2004 04:33

1 Attachment(s)
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 :arrow: "amx_hitzones 3"
Display help :arrow: "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.

Dakana 09-06-2004 12:35

This is odd..

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

Does TP4 have anything to do with it?

BAILOPAN 09-06-2004 14:10

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."

Dakana 09-08-2004 18:08

Oops, forgot to add that I tried 3 also.


3 didn't work.


All times are GMT -4. The time now is 17:28.

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