AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Freeze 'em Mk2 (https://forums.alliedmods.net/showthread.php?t=42351)

jRaven 07-31-2006 12:45

Freeze 'em Mk2
 
3 Attachment(s)
/**
|** Description:
|** Kensai's "Freeze 'em", rewritten from scratch using
|** some new methods thanks to GHW_Chronic.
|**
|** A frozen user cannot shoot, move, or be moved by admin.
|**
|** I rewrote this because I wanted a frozen player to be
|** neutralized and protected by godmode. That combination
|** makes them truly "frozen", not "stuck". I don't play
|** cstrike so UAIO is out of the picture. I never did like
|** how bury just shoves you into a brush to be stuck.
|**
|** "Stuck" makes you vulnerable to attack or TFC grenades.
|** "Frozen" makes you unable to move until suicide or thaw.
|**
|** I also didn't like having to type two commands,
|** so I made it into a single toggle command of amx_freeze.
|**
|**
|** Idea: Toggle the ability of a player to move.
|** Usage: amx_freeze <name or #userid>
|**
|** Module Required: "fun" for get+set of user_godmode natives.
|** Module Required: "engine" for the client_PreThink stuff.
|** Module Optional: "tfcx" for setbammo,setweaponbammo. See USE_TFC define.
|**
|** Changelog:
|** 2006-12-05 @ v1.6r - cleaned up a third time. Thank you, Hawk552, for your help.
|** 2006-11-29 @ v1.5r - cleaned up again.
|** 2006-11-26 @ v1.4r - cleaned up code.
|** 2006-09-11 @ v1.3r - borrowed method from Sonic to disallow suicide via "kill"
|** 2006-08-09 @ v1.2r - added is_user_alive trap to auto-thaw dead players that have been slayed/suicided. ammo strip no longer required so only tfc nades will be stripped (if use_tfc==1).
|** 2006-08-09 @ v1.1r - added PreThink code to freeze user instead of maxspeed from GHW_Chronic
|** 2006-07-30 @ v1.0r - Yay! fixed the linux TFCX. ready for release.
|** 2006-07-28 @ v0.70 - cleaned up comments/documentation, permission from Kensai to release.
|** 2006-07-28 @ v0.66 - now remembering last user maxspeed to avoid assumptions.
|** 2006-07-28 @ v0.65 - code split into more functions. tfcx ammo natives still broken on linux.
|** 2006-07-13 @ v0.64 - freeze,glow,alpha work. ammo strip fails on linux.
*\*
**\
**/

You should be able to use this plugin on any mod now.

There is a TFC-specific grenade stripping feature in the second version posted here as jr_freeze2-tfc.

The only difference in the "tfc" version is that USE_TFC is true and some preprocessor directives include the tfc/TFCX grenade-stripping feature.

A fixed linux-TFCX-module is attached because of a small bug in 1.75a and below that causes ammo-stripping in TFC to fail on a linux box. You may need it if using linux AMXX<=1.75a. I'll leave this file here, but you should upgrade to 1.76 or whatever is current so that you get more than one fix.

Last updated: 2006-12-05

george7004 07-31-2006 13:02

Re: Freeze 'em TFC
 
yaaay nice job lol.. another TFC plugin! :D We should have more of them

GHW_Chronic 08-02-2006 03:42

Re: Freeze 'em TFC
 
I swear this code made my eyes bleed :O

Code:
set_user_maxspeed()
This is why they can run again and such. You have to find a way to hook when their maxspeed is changed. I don't personally know many TFC events but I could tell you a way to do it through prethink if you cant find nothing :O

Code:
public client_PreThink(id) {     if(is_frozen[id]) entity_set_int(id,EV_INT_button,0) }

If you did that there would be no need to record their old speed, they wouldnt be able to use their attack1 or attack2 buttons (except on their own screen) and they couldnt jump or move or nothing.

GHW_Chronic 08-08-2006 22:51

Re: Freeze 'em TFC
 
Since you like, refused to do it:

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <engine> new bool:is_frozen[33] public plugin_init() {     register_plugin("Freeze'em","1.0","GHW_Chronic")     register_concmd("amx_freeze","toggle_freeze",ADMIN_LEVEL_H,"<name or #userid> - freeze/thaw players") } public client_disconnect(id) {     is_frozen[id] = false } public toggle_freeze(id,level,cid) {     if(!cmd_access(id,level,cid,2))     {         return PLUGIN_HANDLED     }     new arg[32]     read_argv(1,arg,31)     new target = cmd_target(id,arg,3)     if(!target)     {         return PLUGIN_HANDLED     }     new name[32]     get_user_name(target,name,31)     if(is_frozen[target])     {         client_print(0,print_chat,"[AMXX] %s has been thawed.",name)         console_print(id,print_chat,"[AMXX] %s has been thawed.",name)         set_user_rendering(target)         set_user_godmode(target)         is_frozen[target]=false     }     else     {         client_print(0,print_chat,"[AMXX] %s has been frozen.",name)         console_print(id,print_chat,"[AMXX] %s has been frozen.",name)         set_user_rendering(target,kRenderFxGlowShell,0,0,255,kRenderTransAlpha,70)         set_user_godmode(target,1)         is_frozen[target]=true     }     return PLUGIN_HANDLED } public client_PreThink(id) {     if(is_frozen[id]) entity_set_int(id,EV_INT_button,0) }

jRaven 08-09-2006 13:26

Re: Freeze 'em TFC
 
I didn't refuse to do it. I PM'd you that it didn't work right.

When I tried your client_PreThink() code, I was still able to run around and build things. The attack1,attack2 were "frozen" by engine but it wasn't a perfect fix.

Edit: I tried this again to be sure. The advantage is they cannot shoot their remaining 8 rounds or upgrade buildings if engr class. They can still build them, though. The code is helpful but it does *not* keep them from moving. I was able to run around, build things, spray my logo, and discard ammo provided I was given ammo after having it stripped.

GHW_Chronic 08-09-2006 14:18

Re: Freeze 'em TFC
 
Code:
//#define Use_TFC 1 #include <amxmodx> #include <amxmisc> #include <fun> #include <engine> #if defined Use_TFC   #include <tfcx> #endif new bool:is_frozen[33] new Float:origin[33][3] public plugin_init() {     register_plugin("Freeze'em","1.0","GHW_Chronic")     register_concmd("amx_freeze","toggle_freeze",ADMIN_LEVEL_H,"<name or #userid> - freeze/thaw players") } public client_disconnect(id) {     is_frozen[id] = false } public toggle_freeze(id,level,cid) {     if(!cmd_access(id,level,cid,2))     {         return PLUGIN_HANDLED     }     new arg[32]     read_argv(1,arg,31)     new target = cmd_target(id,arg,3)     if(!target)     {         return PLUGIN_HANDLED     }     new name[32]     get_user_name(target,name,31)     if(is_frozen[target])     {         client_print(0,print_chat,"[AMXX] %s has been thawed.",name)         console_print(id,print_chat,"[AMXX] %s has been thawed.",name)         set_user_rendering(target)         set_user_godmode(target)         is_frozen[target]=false     }     else     {         client_print(0,print_chat,"[AMXX] %s has been frozen.",name)         console_print(id,print_chat,"[AMXX] %s has been frozen.",name)         set_user_rendering(target,kRenderFxGlowShell,0,0,255,kRenderTransAlpha,70)         set_user_godmode(target,1)         is_frozen[target]=true         entity_get_vector(id,EV_VEC_origin,origin[id])     }     return PLUGIN_HANDLED } public client_PreThink(id) {     if(is_frozen[id])     {         entity_set_vector(id,EV_VEC_origin,origin[id])         entity_set_int(id,EV_INT_button,0) #if defined Use_TFC         tfc_setbammo(id,TFC_AMMO_CELLS,0) #endif     } }

jRaven 08-09-2006 14:54

Re: Freeze 'em TFC
 
I suppose you'd need a...
Code:

get_user_origin(target,origin[target])
But that can't be right. I get a tag mismatch.

GHW_Chronic 08-09-2006 14:58

Re: Freeze 'em TFC
 
It's in there. Notice it says:

entity_get_vector

it says tag mismatch because entity_get_vector is a float and get_user_origin is not.

jRaven 08-09-2006 15:03

Re: Freeze 'em TFC
 
Will this cause any lag if they are frozen mid-air?

jRaven 08-09-2006 15:07

Re: Freeze 'em TFC
 
It's not very pleasant to fall over and over again if frozen mid air.


All times are GMT -4. The time now is 11:59.

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