Raised This Month: $ Target: $400
 0% 

set_user_maxspeed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-02-2010 , 19:09   set_user_maxspeed
Reply With Quote #1

hi,

i tried to define 2 teams.
team catcher & team fleer.
every round willbe start a countdown and the catchers are while the countdown freeze.( should be freeze )
the problem : users can change the weapon to run.i tried to set the maxspeed @ curweapon but happend nothing.

here the full code. i hope anyone can say me why it's so

PHP Code:
public plugin_init() 
{
    
register_plugin"Hide 'n' Seek""0.0.1""One" );
    
register_logevent("startround",2,"0=World triggered","1=Round_Start")
    
g_MaxPlayers get_maxplayers()
    
register_event("CurWeapon""ev_CheckWeapon""be""1=1")
}

        for(
id 1id <= g_MaxPlayersid++)
        {
            if(
is_user_connected(id) && cs_get_user_team(id) & CS_TEAM_T)
            {
                
g_Player_is_catcher[id] = false
                set_user_rendering
(id)
            }
            if(
is_user_connected(id) && cs_get_user_team(id) & CS_TEAM_CT)
            {
                
g_Player_is_catcher[id] = true
                set_user_rendering
(id,kRenderFxGlowShell,255,0,0,kRenderNormal,40)
            }
        }
            
    }
   
}
public 
do_fade(id)
{
    
set_task(1.0,"counter",id""0"b")
}
public 
counter(id)
{
    if(
g_counter <= 30)
    {
        
g_counter++
        
client_print(0,print_chat,"%d counter",g_counter)
        for(
id 1id <= g_MaxPlayersid++)
        {
            if(
g_Player_is_catcher[id] && is_user_alive(id))
            {
                
set_user_maxspeed(id,0.1)
                
set_user_gravity(id,10.0)
            }
            else if(!
g_Player_is_catcher[id] && is_user_alive(id))
            {
                
set_user_gravity(id,0.5)
                
set_user_maxspeed(id,400.0)
            }
        }
    }
    else
    {
        
remove_task(id)
        
g_counter 0
        
for(id 1id <= g_MaxPlayersid++)
        {
            if(
g_Player_is_catcher[id] && is_user_alive(id))
            {
                
set_user_gravity(id,0.5)
                
set_user_maxspeed(id,400.0)
            }
            else if(!
g_Player_is_catcher[id] && is_user_alive(id))
            {
                
set_user_maxspeed(id,0.1)
                
set_user_gravity(id,10.0)
            }
        }
        
    }
}
public 
ev_CheckWeapon(id)
{
    if(
g_Player_is_catcher[id] && is_user_alive(id))
    {
        
set_user_maxspeed(id,400.0)
    }
    else if(!
g_Player_is_catcher[id] && is_user_alive(id))
    {
        
set_user_maxspeed(id,0.1)
    }

__________________

Last edited by One; 03-02-2010 at 19:23.
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-02-2010 , 19:19   Re: set_user_maxspeed
Reply With Quote #2

PHP Code:
set_pevindexpev_maxspeed, -1.0 
?

Off-Topic: Shouldn't it be
PHP Code:
if( cs_get_user_teamid ) == CS_TEAM_CT )

// instead of

if( cs_get_user_teamid ) & CS_TEAM_CT 
or is it the same thing?
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-02-2010 , 19:22   Re: set_user_maxspeed
Reply With Quote #3

Fixed

both are the same ( the same function )

added new bool.

for other ppl. who maybe will search for the same problem

PHP Code:
new bool:g_Player_is_freeze[33]

for(
id 1id <= g_MaxPlayersid++)
        {
            if(
g_Player_is_catcher[id] && is_user_alive(id))
            {
                
set_user_maxspeed(id,0.1)
                
g_Player_is_freeze[id] = true
                set_user_gravity
(id,10.0)
            }
            else if(!
g_Player_is_catcher[id] && is_user_alive(id))
            {
                
set_user_gravity(id,0.5)
                
g_Player_is_freeze[id] = false
                set_user_maxspeed
(id,400.0)
            }



public 
ev_CheckWeapon(id)
{
    if(!
g_Player_is_freeze[id] && is_user_alive(id))
    {
        
set_user_maxspeed(id,400.0)
    }
    else if(
g_Player_is_freeze[id] && is_user_alive(id))
    {
        
set_user_maxspeed(id,0.1)
    }

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-02-2010 , 20:12   Re: set_user_maxspeed
Reply With Quote #4

cs_get_user_team(id) & CS_TEAM_T
is not the same as
cs_get_user_team(id) == CS_TEAM_T

It may provide the same result you need since 1/2 (T/CT) are individual bits and a team cannot be a bitsum.
But it will not work properly if you try & CS_TEAM_SPECTATOR.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-02-2010 , 20:30   Re: set_user_maxspeed
Reply With Quote #5

oh i tough both are the same

do i need to change it to == ?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-02-2010 , 22:00   Re: set_user_maxspeed
Reply With Quote #6

I don't see any reason not to, if it has the possibility to cause confusion.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-02-2010 , 22:29   Re: set_user_maxspeed
Reply With Quote #7

Quote:
Originally Posted by One View Post
do i need to change it to == ?
Yes.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-03-2010 , 00:57   Re: set_user_maxspeed
Reply With Quote #8

Use HAM instead of CurWeapon for more efficienty

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

public plugin_init()
{
    const 
Ham:Ham_Player_ResetMaxSpeed Ham_Item_PreFrame
    RegisterHam
(Ham_Player_ResetMaxSpeed"player""Player_ResetMaxSpeed_Post"1)
}

public 
Player_ResetMaxSpeed_Postid )
{
    if( 
is_user_alive(id) )
    {
        new 
Float:flMaxSpeed
        pev
(idpev_maxspeedflMaxSpeed)
        if( 
flMaxSpeed == 1.0 // this is freezetime
        
{
            
//
        
}
        else
        {
            if( 
g_Player_is_freeze[id] )
            {
                
set_pev(idpev_maxspeed1.0)
            }
            else
            {
                
set_pev(idpev_maxspeed400.0)
            }
        }
    }
    else 
// user is dead/spectator
    
{
        
// set_pev(id, pev_maxspeed, 1000.0)
    
}

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 03-03-2010 at 01:00.
ConnorMcLeod is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-03-2010 , 07:28   Re: set_user_maxspeed
Reply With Quote #9

yay. done & ty
i have a new question but i will open a new thread for this
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
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 08:40.


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