Raised This Month: $ Target: $400
 0% 

Sound and frozen flag


Post New Thread Reply   
 
Thread Tools Display Modes
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-15-2011 , 11:11   Re: Sound and frozen flag
Reply With Quote #11

Quote:
Originally Posted by Doc-Holiday View Post
i use ham caps or w/e to catch 'use' so when i hit the player i set

set_pev(id, pev_maxspeed, 1.0);
set_pev(target, pev_maxspeed, 1.0);

on reset speed i had it the same didnt seem to work i will check it out again. Thanks for the replies.
You didn't say that you want to stop players when they use +use.
You should tell exactly what you want to do, if you want to stop players during the whole time they hold +use, then you will need CmdStart or PreThink.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 08-15-2011 , 16:15   Re: Sound and frozen flag
Reply With Quote #12

Quote:
Originally Posted by ConnorMcLeod View Post
You didn't say that you want to stop players when they use +use.
You should tell exactly what you want to do, if you want to stop players during the whole time they hold +use, then you will need CmdStart or PreThink.
setting velocity to 0 in prethink he crept away lol.. it was weird but on the players screen he was just like shaking.

and yes i did

Quote:
Originally Posted by Doc-Holiday View Post
tried it there too but reset speed isnt called when i need to stop the player..

Its when a nothe rplayer comes and presses use on them.


tried it there too but reset speed isnt called when i need to stop the player..

Its when a nothe rplayer comes and presses use on them.


thats not what i want...

My medic or support walks up to a player heals or gives ammo
Both players need to stop. and cant move..

setting the pev to -1.0 or 0.0 kept him in stoped but on the other screen he moved away. setting velocity to 0 didnt work ither.

When i walk up to player and pres use key using HamObjectCaps i set a bool. reset speed isnt called unless they switch weapons. so if i set speed in ObjCap and in reset speed it should be fine right??

Ill be trying this soon as im home from school.
Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-15-2011 , 16:29   Re: Sound and frozen flag
Reply With Quote #13

PreThink/CmdStart would only be relevant if you need to catch begin and end of +use hold.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 08-15-2011 , 17:03   Re: Sound and frozen flag
Reply With Quote #14

Quote:
Originally Posted by ConnorMcLeod View Post
PreThink/CmdStart would only be relevant if you need to catch begin and end of +use hold.

This what i use now but like i said ill give it a shot later when i get home

PHP Code:
public fwdObjectCaps(id)
{
    if(!
is_user_alive(id))
    {
        return 
HAM_IGNORED;
    }
    
    if(
g_XP[id][Class] == CLASS_MEDIC)
    {
        if(
get_pdata_int(idm_afButtonPressed) & IN_USE)
        {
            
//Pressed Use
        
}
        else if(
get_pdata_int(idm_afButtonReleased) & IN_USE)
        {
            
//Released Use
            
return HAM_IGNORED;
        }
    }
    
    if(
g_XP[id][Class] == CLASS_SUPPORT)
    {
        if(
get_pdata_int(idm_afButtonPressed) & IN_USE)
        {
            
//Pressed Use
        
}
        else if(
get_pdata_int(idm_afButtonReleased) & IN_USE)
        {
            
//Let go of use
            
return HAM_IGNORED;
        }
    }
    return 
HAM_IGNORED;

Doc-Holiday is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-15-2011 , 17:50   Re: Sound and frozen flag
Reply With Quote #15

Have you put come client prints to see exactly when it is called ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-15-2011 , 18:24   Re: Sound and frozen flag
Reply With Quote #16

Not sure if I understand what exactly you need, even after reading all of your posts. Freeze player when holding-down Use? This is pretty much what Connor was saying to do:

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new const Version[] = "0.1";

#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

new bool:bHoldingUse33 ];

public 
plugin_init() 
{
    
register_plugin"Freeze when Use" Version "bugsy" );
    
    
register_forwardFM_CmdStart "fw_CmdStart" );
    
RegisterHamHam_Player_ResetMaxSpeed "player" "fw_ResetMaxSpeed" );
}

public 
client_connectid )
{
    
bHoldingUseid ] = false;
}

public 
fw_CmdStartid handle seed )
{
    static 
iButton iOldButtons;
    
    
iButton get_uchandle UC_Buttons );
    
iOldButtons pevid pev_oldbuttons );
    
    
//Initially pressed
    
if ( ( iButton IN_USE ) && !( iOldButtons IN_USE ) )
    {
        
bHoldingUseid ] = true;
        
set_pevid pev_maxspeed 1.0 );
    }
    
    
//Holding
    //if ( ( iButton & IN_USE ) && ( iOldButtons & IN_USE ) )

    //Released
    
if ( !( iButton IN_USE ) && ( iOldButtons IN_USE ) )
    {
        
bHoldingUseid ] = false;
        
ExecuteHamHam_Player_ResetMaxSpeed id );
    }
}

public 
fw_ResetMaxSpeediPlayer )
{
    if ( 
bHoldingUseiPlayer ] )
        
set_peviPlayer pev_maxspeed 1.0 );

__________________

Last edited by Bugsy; 08-15-2011 at 20:25.
Bugsy is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-16-2011 , 22:43   Re: Sound and frozen flag
Reply With Quote #17

Just a side note, if you're going with the reset velocity thing, first get the player's velocity and reset index 0 and 1 and leave index 2 (Z axis) untouched.
The reason would be to prevent abuse, you could just throw yourself from a great height and just press use before touching the ground xD
__________________
Hunter-Digital is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 08-17-2011 , 01:11   Re: Sound and frozen flag
Reply With Quote #18

Quote:
Originally Posted by Hunter-Digital View Post
Just a side note, if you're going with the reset velocity thing, first get the player's velocity and reset index 0 and 1 and leave index 2 (Z axis) untouched.
The reason would be to prevent abuse, you could just throw yourself from a great height and just press use before touching the ground xD
Pressing use doesnt do anything unless your within 50 units of the player your aiming at and on the same team. The point is for when im healing or giving ammo they shouldnt be able to run around.. Still shoot yes but while im patching up your leg you shouldnt be able to run across the map side by side haha

max_speed worked great thanks

Last edited by Doc-Holiday; 08-17-2011 at 02:20.
Doc-Holiday 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 01:06.


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