Raised This Month: $ Target: $400
 0% 

maxspeed reset?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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