Raised This Month: $ Target: $400
 0% 

Terrorists can use hostages


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff       
Blunted1
Senior Member
Join Date: Jun 2004
Old 09-08-2004 , 17:47   Terrorists can use hostages
Reply With Quote #1

I couldn't find a fully functional plugin that allowed terrorists to use hostages (or in other words force them to follow) exactly like CT's are able to and especially not one so simple.

Running the command "use_hostage" will effectively change your team and force you to use whatever is in front of you, then switch you back to the terrorist team all within a third of a second.
(it can only be used by terrorists)

Be carefull useing the command, as the team switch could result in accidentally returning the hostages (if you are in the hostage return area) or even your team loseing the round.
Attached Files
File Type: sma Get Plugin or Get Source (use_hostage.sma - 6873 views - 674 Bytes)
Blunted1 is offline
WDUK
Senior Member
Join Date: Aug 2004
Location: Great Britain
Old 09-08-2004 , 18:19  
Reply With Quote #2

Very clever idea, and simple and all. I'm unable to test it atm but nice work
__________________
R.E.M Gig 2005
Done by VH2
Lancashire Cricket Ground
I'm There!
WDUK is offline
Send a message via MSN to WDUK
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 09-10-2004 , 07:07  
Reply With Quote #3

Why not just use cs_set_hostage_follow()?

register_concmd also registers this for server which you probably don't want. Use register_clcmd.
Johnny got his gun is offline
Blunted1
Senior Member
Join Date: Jun 2004
Old 09-10-2004 , 19:35  
Reply With Quote #4

I tried useing all of your fancy natives created for just this purpose (as have many before me by the sounds of things) and I never saw it work properly once.
Fact of the matter is, this script proves that all of those natives are unnecessary as it can be done quite simply.

Besides, doing it your way useing all the hostage natives designed for this, are you able to return the hostages for absolutily no reason whatsoever?

I'd rather not have to change teams (even though it doesnt show on the scoreboard or matter in anyway whatsoever) just to use a hostage, but this is simple and it actually works.
If anyone has a script that allows terrorists to use a hostage that doesnt involve switching teams that does work correctly, I would be more than happy to see it

The register_concmd, was simply because I am useing CZ (ingame console basically is the server) and register_clcmd gave me the unknown command message.
I was just lazy and didnt think of changeing it
Blunted1 is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 09-11-2004 , 07:27  
Reply With Quote #5

It's easy. Just use cs_set_hostage_foll(hostage, entity) and that hostage will follow that entity. It doesn't have to be a CT, nor a T it could be a any entity. I think the only important thing is that it should have an origin.
If you don't know how to use that, well...

And oh, this is for CS, not CZ (not tested). That's why its name is cstrike module and not cz module.


I created a test script, and it works. Also thanks to fakemeta (who could have guessed!). It uses fakemeta to hook use button :-) works really well! Never hooked these buttons before. You dont have to register a new command for this, just use the normal use button:

Code:
new g_buttons[33] new g_buttonsPrevious public forward_playerprethink(id) {     g_buttonsPrevious = g_buttons[id]     g_buttons[id] = entity_get_int(id, EV_INT_button)     if (g_buttons[id] & IN_USE && !(g_buttonsPrevious & IN_USE)) {     /* Trace a line from Start(X, Y, Z) to End(X, Y, Z), will return the point hit in vReturn[3]      * and an entity index if an entity is hit. */     //native trace_line(iIgnoreEnt, Float:fStart[3], Float:fEnd[3], Float:vReturn[3]);         new hitorigin[3]         new Float:fl_hitorigin[3]         IVecFVec(hitorigin, fl_hitorigin)         get_user_origin(id, hitorigin, 3)         new Float:origin[3]         entity_get_vector(id, EV_VEC_origin, origin)         new hitent = trace_line(id, origin, fl_hitorigin, origin)         new classname[33] = {"nothing"}         if (hitent != 0) {             entity_get_string(hitent, EV_SZ_classname, classname, 32)             if (equal(classname, "hostage_entity")) {                 if (cs_get_hostage_foll(hitent) != id)                     cs_set_hostage_foll(hitent, id)                 else                     cs_set_hostage_foll(hitent, 0)             }         }         client_print(id, print_center, "You pressed use! Hitent: %d (%s)", hitent, classname)     }     else if (!(g_buttons[id] & IN_USE) && (g_buttonsPrevious & IN_USE)) {         client_print(id, print_center, "You released use!")     }     return FMRES_IGNORED } public plugin_init() {     register_plugin("T uses hostages", "0.1", "jghg")     register_forward(FM_PlayerPreThink, "forward_playerprethink") }

Note that it's kind of twitchy because of the lousy trace routine, but works if you give it a little time. Also don't try to use anything being a CT, I just created this to test as a T. Just point at a hostage as a T and it should follow/stop following you. It doesn't check distance to hossie though so it might work over long distances :-D.
Maybe you can come up with a better routine to see if player is aiming at a hostage + check distance.
Johnny got his gun is offline
Blunted1
Senior Member
Join Date: Jun 2004
Old 09-11-2004 , 16:47  
Reply With Quote #6

Thats exactly my point.
Look at how "twitchy" your script is and how many limitations and problems it has.
Mine is simple as hell and it does exactly what it is supposed to.

Aim? Distance? Consistency? Already taken care of.
Works EXACTLY like it does for CT.
It works perfectly on both CS and CZ (i have tested)

And hooking the use button? thats been done numerous times before hasnt it? I was just too lazy yet again....

I have seen many scripts like yours that work sometimes, or don't stop the hostage from following, or you have to enter the command a couple times before it responds.....
but nothing that worked as consitently and flawlessy as my simple little script.

See I always imagined that of all people you would have made this plugin long ago... I even figured it was probably you who had created the natives for exactly that purpose.

Anyways until something better comes along, hopefully others will benifit from this script as much as I have.
Blunted1 is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 09-12-2004 , 05:36  
Reply With Quote #7

Of course your plugin is fine as it is, maybe aside from the extra use button (people just don't know how to bind buttons, let alone bring down the console). Remember I gave that script no more than 2 minutes and maybe if I get more time it could be made to work better.
Johnny got his gun is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 09-12-2004 , 09:36  
Reply With Quote #8

Erm, why are you people fighting?

Doesnt he have the right to make a plugin, assuming he didnt steal the code?

And dont people have the right to compliment/regect the plugin?

...seems to me, your both sort of fighting over an empty soda can here...

nice job btw, it works great!
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Blunted1
Senior Member
Join Date: Jun 2004
Old 09-12-2004 , 13:43  
Reply With Quote #9

Quote:
Originally Posted by Twilight Suzuka
Erm, why are you people fighting?

Doesnt he have the right to make a plugin, assuming he didnt steal the code?

And dont people have the right to compliment/regect the plugin?

...seems to me, your both sort of fighting over an empty soda can here...

nice job btw, it works great!
We are not fighting at all really, more exchangeing ideas and methods.
As far as what either of us has said, both of us are right.

Mine is simple and easy and worked better than anything before it from what I can tell.
He is also right however as it can be done useing those other natives, however then it cannot be used for CZ (which is the mod I have been useing most recently, so I wanted it to work with CZ)..... also his version does NOT support amxx 0.16 (yet anyways), which I consider to be the official version as of right now (when 0.20 is done it is done).

Of course the above script could be made to work better, best example as JGHG pointed out would be to implement a "use" button hook so nobody has to bind a key.
Other people have already done it better and atleast produced scripts for CS only (no CZ ) that work properly and I guess that was half the point of releaseing this simple script.


Maybe, (if I get real bored ) I will update this script so us CZ people dont have to bind a key and can press the "use" button instead
But seriously this wasnt really meant to be a major plugin of great importance, I made it more just to prove that it could be done this simply without any of the hostage natives that were created to enable this in the first place.
Blunted1 is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 09-12-2004 , 14:48  
Reply With Quote #10

Makes me wonder why we don't have a CZ category. I guess they're too similar at certain times though...
Johnny got his gun 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 20:26.


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