Raised This Month: $ Target: $400
 0% 

[SOLVED]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 06-14-2009 , 07:51   [SOLVED]set_user_maxspeed
Reply With Quote #1

PHP Code:
register_forwardFM_PlayerPreThink"client_prethink" );

public 
client_prethink(id )
{
    if(
is_user_alive(id))
    
Action(id );
}

public 
Action(id )
{
    new 
button pev(id,pev_button);

    if ( 
button IN_ATTACK2)
    {
        new 
Float:speed get_user_maxspeed(id) + 1300.0;
        
set_user_maxspeed(id speed); 
    
        
set_pev idpev_viewmodel2"" );        
    }
    else
    {
        new 
Float:speed1 get_user_maxspeed(id) + 1.0;
        
set_user_maxspeed(id speed1); 
    }
    
    return 
PLUGIN_HANDLED;

so i want by in_attack2 give xxx speed & when player dont use in_attack2 normal speed.


tried with : in_attack2 client_cmd cl_forwardspeed 9999 & by else 400 but dont like slowhack
__________________

Last edited by One; 06-17-2009 at 03:08.
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
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 06-14-2009 , 10:09   Re: set_user_maxspeed
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>
 
#define PLUGIN "Speed!"
#define AUTHOR "One"
#define VERSION "0.1"
 
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
 
    
register_forward(FM_PlayerPreThink"fwd_PlayerPreThink");
}
 
public 
fwd_PlayerPreThink(id)
{
    if(!
is_user_alive(id))
    {
        return 
PLUGIN_HANDLED;
    }
 
    new 
button pev(idpev_button);
    new 
Float:speed get_user_maxspeed(id);
 
    if((
id) && (button IN_ATTACK2))
    {
        
set_user_maxspeed(idspeed 1300.0);
    }
    return 
PLUGIN_HANDLED;

__________________
Achievements API - a simple way for you to create your OWN custom achievements!

Last edited by Xellath; 06-14-2009 at 15:10.
Xellath is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 06-15-2009 , 03:24   Re: set_user_maxspeed
Reply With Quote #3

Nope
__________________
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
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 06-15-2009 , 10:36   Re: set_user_maxspeed
Reply With Quote #4

You also need to block the maxspeed reset when changing weapons. Check this thread http://forums.alliedmods.net/showthread.php?t=94331
__________________
joaquimandrade is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 06-15-2009 , 10:52   Re: set_user_maxspeed
Reply With Quote #5

nope not changing weapon )

by in_attack2 , speed + 1000 .

when u dont press mouse2 or attack2, speed is normal. like +attack2 & - attack2. & attach2 sets ur speed on xxx. i can add new cmd but want this on attack2. i could add :

+speed
set_user_maxspeed(id,xxx)
-speed
set_user_maxspeed(id,xxx)

__________________
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
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-15-2009 , 11:10   Re: set_user_maxspeed
Reply With Quote #6

Code:
#include <amxmodx> #include <fakemeta>   #define XXX_SPEED 320.0   public plugin_init()         register_forward(FM_CmdStart, "fwdCmdStart");   public fwdCmdStart(iCl, iHandle) {         if (get_uc(iHandle, UC_Buttons) & IN_ATTACK)                 set_pev(iCl, pev_maxspeed, XXX_SPEED);         else                 set_pev(iCl, pev_maxspeed, 250.0); }
Do you really have to check what speed client currently has so you could add some more? IMO it's OK just to set default XXX_SPEED.
__________________
hleV is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-15-2009 , 11:21   Re: set_user_maxspeed
Reply With Quote #7

Quote:
Originally Posted by hleV View Post
Code:
#include <amxmodx> #include <fakemeta>   #define XXX_SPEED 320.0   public plugin_init()         register_forward(FM_CmdStart, "fwdCmdStart");   public fwdCmdStart(iCl, iHandle) {         if (get_uc(iHandle, UC_Buttons) & IN_ATTACK)                 set_pev(iCl, pev_maxspeed, XXX_SPEED);         else                 set_pev(iCl, pev_maxspeed, 250.0); }
Do you really have to check what speed client currently has so you could add some more? IMO it's OK just to set default XXX_SPEED.
Some weapons have different maxspeeds [awp/auto-snipe=210, M249=220, pistols/knife/...=250] so you should cache the current weapons maxspeed at CurWeapon so it can be set appropriately instead of using 250 for everything. I just made this fix in my speed toggle plugin [not yet posted].
__________________

Last edited by Bugsy; 06-15-2009 at 11:26.
Bugsy is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 06-15-2009 , 12:47   Re: set_user_maxspeed
Reply With Quote #8

ty both. ill test .

i know some weapons has diff speed. scout 260 & another 250 & awp ....buyzone is res. & on start player recive scout. with scout player cant user attach2 for speed, only with knife. i think i can write this part. needed just this one. so test 2morrow
__________________
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 13:56.


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