AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   amx freeze (https://forums.alliedmods.net/showthread.php?t=134516)

drekes 08-05-2010 17:24

amx freeze
 
10 Attachment(s)
Code:

    amx_freeze
    by Drekes
   
    Description:
        Makes it able for admins to freeze a player, this will make him unable to move or jump.
       
    Cvars:
        amx_freeze_knife_only 0/1    Makes a frozen player hold only his knife
       
    Command:
        amx_freeze <@all/@T/@CT/player> <0/1> <seconds>
       
        seconds is optional.
       
    Changelog:
        v1.0: - Release
       
        v1.1: - Merged several functions.                    darkgod's suggestion
              - Remade the activity code.                    darkgod's suggestion
              - Changed the numtime code.                    darkgod's suggestion
              - Added a timer.                                Elite Taco's suggestion
              - Added cvar for game-monitor
             
        v1.2: - Changed way of freezing                      Many peoples suggestion
              - knife only (cvar)
       
        v1.3: - Added @ct/@t/@all support                    ConnorMcleod's suggestion.
              - Filtered curweapon                            ConnorMcleod's suggestion.
              - changed timer code.
           
        v1.4: - Converted to fakemeta.
              - Made cstrike version.
       
        v1.5: - Blocked players view when frozen.            ConnorMcleod's suggestion.
              - Used bits to check and set frozen players.    ConnorMcleod's suggestion.
           
        v1.6: - Remove reduntant code.                        ConnorMcleod's suggestion.
              - Removed cstrike version since
                get_user_team isn't used anymore.
              - unregistered PlayerPreThink when it's not
                needed.                                        ConnorMcLeod's suggestion.
           
        v1.7: - optimized code                                ConnorMcLeod's suggestion.
       
        v1.8: - Changed syntax of command                    Seta00's suggestion.
             
    Credits:
        - RedRobster: Helping me find an annoying mistake that kept crashing my server.
        - Bugsy: For the bitfield tutorial and the macro's.
        - ConnorMcleod / ArkShine / Seta00: Suggestions to improve the plugin.
        - All the other people that suggested and helped improving the plugin


Alucard^ 08-05-2010 18:19

Re: amx freeze
 
One question, why you are using set_user_gravity( )?

fysiks 08-05-2010 18:25

Re: amx freeze
 
There are better ways of freezing them using fakemeta.

Quote:

Originally Posted by Alucard^ (Post 1262662)
One question, why you are using set_user_gravity( )?

Probably so they can't jump I'm assuming.

drekes 08-05-2010 18:26

Re: amx freeze
 
to prevent him from jumping around. If an admin freezes a player for some reason, and he wants to kill him, it sucks if he keeps jumping all the time.

Edit:
@ fysiks: Could you guide me in the right direction?

Alucard^ 08-05-2010 18:30

Re: amx freeze
 
PHP Code:

set_pev(idpev_velocity, { 0.0 0.0 0.0 } )
set_pev(idpev_flagspev(ipev_flags) | FL_FROZEN


drekes 08-05-2010 18:31

Re: amx freeze
 
Nice, i'll check that out.

fysiks 08-05-2010 19:04

Re: amx freeze
 
Quote:

Originally Posted by Alucard^ (Post 1262684)
PHP Code:

set_pev(idpev_velocity, { 0.0 0.0 0.0 } )
set_pev(idpev_flagspev(ipev_flags) | FL_FROZEN


Why would you set velocity if they are frozen? I guess so they stop mid-air?

@drekes, I originally found it in Gungame for when the game was won.

ConnorMcLeod 08-05-2010 19:23

Re: amx freeze
 
fysiks is right, set velocity is useless, frozen flag will stop the player wherever he is.
If you also want to block player from using his mouse, reset his v_angle every pre or post think (don't remember which one but both could work).

Alucard^ 08-06-2010 01:59

Re: amx freeze
 
Quote:

Originally Posted by ConnorMcLeod (Post 1262748)
fysiks is right, set velocity is useless, frozen flag will stop the player wherever he is.
If you also want to block player from using his mouse, reset his v_angle every pre or post think (don't remember which one but both could work).

Yep, i know that, i tested some time ago... BUT, if i am not wrong, that fix some bugs, for example with push/teleports, but i am really not sure about this, correct me if i am wrong... i used the velocity things becouse i read some of that thing some time ago.

Sry for my english.

drekes 08-06-2010 04:37

Re: amx freeze
 
Updated

@Connor:
I tried to block the v_angles with this:
Code:

entity_set_vector(id, EV_VEC_v_angles, {0.0, 0.0, 0.0})
But i got tag mismatch.
And when i used an empty float, nothing happened. I added a client_print in PreThink and PostThink to check if i did it right, and it is being called.
Could you show an example how i should do it?

@ all:
Thanks for the suggestions.


All times are GMT -4. The time now is 09:35.

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