Raised This Month: $ Target: $400
 0% 

maxspeed reset?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 01-22-2013 , 19:13   maxspeed reset?
Reply With Quote #1

I am trying to freeze the whole ct team for 5 seconds. I wrote this:

PHP Code:
#include < amxmodx >
#include < cstrike >
#include < fun >

new bool:g_bFreeze;
new 
g_msgShakeScreen;

public 
plugin_init( ) {
    
register_event"CurWeapon" ,     "Event_WeaponSwitch" ,     "be" ,     "1=1" );
    
    
register_clcmd"say /test""Freeze" );
    
    
g_msgShakeScreen get_user_msgid"ScreenShake" );
}

// called when player switch weapons (because maxspeed changes with every gun
public Event_WeaponSwitchiPlayerID ) {
    new 
CsTeams:iTeam cs_get_user_teamiPlayerID );
    
    if( 
g_bFreeze && iTeam == CS_TEAM_CT ) {
        
set_user_maxspeediPlayerID0.1 );
        
        return 
PLUGIN_HANDLED;
    }
        
    return 
PLUGIN_CONTINUE;
}

public 
Freeze( ) {
    static 
iPlayers32 ], iNumiTempid;
    
get_playersiPlayersiNum"ae""CT" );
    
    
g_bFreeze true;
    
    for( new 
iLoop 0iLoop iNumiLoop++ ) {
        
iTempid iPlayersiLoop ];
        
        
// shake screen when become frozen
        
message_beginMSG_ONEg_msgShakeScreen, { 00}, iTempid );
        
write_short255 << 14 );
        
write_short10 << 14 );
        
write_short255 << 14 );
        
message_end( );
        
        
set_user_maxspeediTempid0.1 );
    }
    
    
// unfreeze after 5 seconds
    
set_task5.0"Unfreeze" );
}

public 
Unfreeze( ) {
    static 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum"ae""CT" );
    
    for( new 
iLoop 0iLoop iNumiLoop++ ) {
        
g_bFreeze false;
        
ResetUserMaxSpeediPlayersiLoop ] );
    }
}

ResetUserMaxSpeediPlayerID ) {
    
// credits to connor?
    
new Float:fMaxSpeed;
    
    switch( 
get_user_weaponiPlayerID ) )
    {
        case 
CSW_SG550CSW_AWPCSW_G3SG1 :                 fMaxSpeed 210.0;
        case 
CSW_M249 :                                     fMaxSpeed 220.0;
        case 
CSW_AK47 :                                     fMaxSpeed 221.0;
        case 
CSW_M3CSW_M4A1 :                             fMaxSpeed 230.0;
        case 
CSW_SG552 :                                     fMaxSpeed 235.0;
        case 
CSW_XM1014CSW_AUGCSW_GALILCSW_FAMAS :     fMaxSpeed 240.0;
        case 
CSW_P90 :                                         fMaxSpeed 245.0;
        case 
CSW_SCOUT :                                     fMaxSpeed 260.0;
        default :                                             
fMaxSpeed 250.0;
    }
    
    
set_user_maxspeediPlayerIDfMaxSpeed );

I tested it and it works great.

BUT, when i implement the same idea into my mod (a big plugin), it doesn't seem to work. So what i am asking is when will the user speed be reset (or changed)? Maybe something is interfering with it.

Posting the whole code won't help, cause its 4000+ lines.
__________________

Last edited by n0br41ner; 01-22-2013 at 19:14.
n0br41ner is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-22-2013 , 20:48   Re: maxspeed reset?
Reply With Quote #2

To freeze people, you should not use speed to do it. You should use pev_flags:

PHP Code:
set_pev(id,pev_flags,pev(id,pev_flags) | FL_FROZEN); // Freeze
set_pev(player,pev_flags,pev(player,pev_flags) & ~FL_FROZEN); // Unfreeze 

Quote:
Originally Posted by n0br41ner View Post
Posting the whole code won't help, cause its 4000+ lines.
Why do people post these kinds of lies!?!?!?!
__________________

Last edited by fysiks; 01-22-2013 at 20:49.
fysiks is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 01-22-2013 , 21:28   Re: maxspeed reset?
Reply With Quote #3

if i use set_pev then the player won't be able to fire and inflict damage. That's why i went with maxspeed.

Here you go, and i don't lie (look at the picture)
Attached Thumbnails
Click image for larger version

Name:	lines.jpg
Views:	281
Size:	31.7 KB
ID:	114812  
__________________
n0br41ner is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 01-23-2013 , 00:26   Re: maxspeed reset?
Reply With Quote #4

Quote:
Originally Posted by n0br41ner View Post
Posting the whole code won't help
Quote:
Originally Posted by fysiks View Post
Why do people post these kinds of lies!?!?!?!
@n0br41ner
I don't think fysiks was talking about how many lines your plugin is. I think he was talking about you saying " posting the whole code wouldn't help".
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 01-23-2013 , 00:54   Re: maxspeed reset?
Reply With Quote #5

Oh okay.

Is thereany other way of freezing a player ad that he can still shoot and inflict damage?
__________________
n0br41ner is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-23-2013 , 01:14   Re: maxspeed reset?
Reply With Quote #6

To block players, set speed to 1.0, not 0.1.
Hook Ham_CS_Player_ResetMaxspeed and block it when player is blocked.
To reset speed just set the variable 'block[ player_index ]' to false and call Ham_CS_Player_ResetMaxspeed.

Don't bother with CurWeapon !!
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 01-23-2013 at 01:14.
ConnorMcLeod is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 01-23-2013 , 01:19   Re: maxspeed reset?
Reply With Quote #7

Okay great and thanks.
I will try it when i get back home.
__________________
n0br41ner is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 01-23-2013 , 13:26   Re: maxspeed reset?
Reply With Quote #8

It's not working i guess, and i am pretty sure i made something wrong.

Here is what i wrote:
PHP Code:
#include < amxmodx >
#include < cstrike >
#include < fun >
#include < hamsandwich >

new bool:g_bFreeze;
new 
g_msgShakeScreen;

public 
plugin_init( ) {
    
// register_event( "CurWeapon" ,     "Event_WeaponSwitch" ,     "be" ,     "1=1" );
    
RegisterHamHam_CS_Player_ResetMaxSpeed,    "player",    "Reset",    false );
    
    
register_clcmd"say /test""Freeze" );
    
    
g_msgShakeScreen get_user_msgid"ScreenShake" );
}

public 
Resetid ) {
    new 
CsTeams:iTeam cs_get_user_teamid );
    
    if( 
g_bFreeze && iTeam == CS_TEAM_CT ) {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}
/*
// called when player switch weapons (because maxspeed changes with every gun
public Event_WeaponSwitch( iPlayerID ) {
    new CsTeams:iTeam = cs_get_user_team( iPlayerID );
    
    if( g_bFreeze && iTeam == CS_TEAM_CT ) {
        set_user_maxspeed( iPlayerID, 0.1 );
        
        return PLUGIN_HANDLED;
    }
        
    return PLUGIN_CONTINUE;
}
*/
public Freeze( ) {
    static 
iPlayers32 ], iNumiTempid;
    
get_playersiPlayersiNum"ae""CT" );
    
    
g_bFreeze true;
    
    for( new 
iLoop 0iLoop iNumiLoop++ ) {
        
iTempid iPlayersiLoop ];
        
        
// shake screen when become frozen
        
message_beginMSG_ONEg_msgShakeScreen, { 00}, iTempid );
        
write_short255 << 14 );
        
write_short10 << 14 );
        
write_short255 << 14 );
        
message_end( );
        
        
set_user_maxspeediTempid1.0 );
    }
    
    
// unfreeze after 5 seconds
    
set_task5.0"Unfreeze" );
}

public 
Unfreeze( ) {
    static 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum"ae""CT" );
    
    
g_bFreeze false;
    
    for( new 
iLoop 0iLoop iNumiLoop++ ) {
        
ExecuteHamBHam_CS_Player_ResetMaxSpeediPlayersiLoop ] );
    }
}
/*
ResetUserMaxSpeed( iPlayerID ) {
    // credits to connor?
    new Float:fMaxSpeed;
    
    switch( get_user_weapon( iPlayerID ) )
    {
        case CSW_SG550, CSW_AWP, CSW_G3SG1 :                 fMaxSpeed = 210.0;
        case CSW_M249 :                                     fMaxSpeed = 220.0;
        case CSW_AK47 :                                     fMaxSpeed = 221.0;
        case CSW_M3, CSW_M4A1 :                             fMaxSpeed = 230.0;
        case CSW_SG552 :                                     fMaxSpeed = 235.0;
        case CSW_XM1014, CSW_AUG, CSW_GALIL, CSW_FAMAS :     fMaxSpeed = 240.0;
        case CSW_P90 :                                         fMaxSpeed = 245.0;
        case CSW_SCOUT :                                     fMaxSpeed = 260.0;
        default :                                             fMaxSpeed = 250.0;
    }
    
    set_user_maxspeed( iPlayerID, fMaxSpeed );
}*/ 
Appreciate any help.
__________________
n0br41ner is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 02-05-2013 , 17:42   Re: maxspeed reset?
Reply With Quote #9

bump: please help?
__________________
n0br41ner is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-06-2013 , 00:39   Re: maxspeed reset?
Reply With Quote #10

PHP Code:
RegisterHamHam_CS_Player_ResetMaxSpeed,  "player""Reset"false ); 
>

PHP Code:
RegisterHam(Ham_CS_Player_ResetMaxSpeed"player""OnCBasePlayerResetMaxSpeed_P"true 


PHP Code:
public Resetid ) {
    new 
CsTeams:iTeam cs_get_user_teamid );
    
    if( 
g_bFreeze && iTeam == CS_TEAM_CT ) {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;

->

PHP Code:
public OnCBasePlayerResetMaxSpeed_Pid )
{
    if( 
g_bFreeze && cs_get_user_teamid ) == CS_TEAM_CT )
    {
        
set_pev(idpev_maxspeed1.0)
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 02-06-2013 at 00:40.
ConnorMcLeod 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:39.


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