Raised This Month: $ Target: $400
 0% 

set_user_maxspeed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
znovit
Member
Join Date: Mar 2009
Location: Behind you :=
Old 06-05-2009 , 08:04   set_user_maxspeed
Reply With Quote #1

Im using this but when ive choosed any type of 'character' and switch weapon the maxspeed goes back to normal?

Is there anyway to fix the speed to go back to the speed i was setting before.

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

#define PLUGIN "Fun Mod"
#define VERSION "v1.0"
#define AUTHOR "znovit"

#define PREFIX "FUN"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /menu","MainMenu");
    
register_clcmd("drop","dropblock");
    
register_clcmd("/modinfo","information");
    
    
set_task(50.0"information"_,_,_"b");
}


public 
information(id) {
    
ColorChat(idGREEN"--- Information ---");
    
ColorChat(idGREEN"[%s] This server is running ^x03%s %s^x04 by^x03 %s"PREFIX,  PLUGINVERSIONAUTHOR);
    
ColorChat(idGREEN"You can visit our webpage:^x03 http://znovit.com/funmod^x04 and read more.");
    
ColorChat(idGREEN"By typing^x03 /modinfo^x04 this will show up again.");
}

public 
dropblock(id) {
    
ColorChat(idGREEN"[%s] You can't^x03 drop^x04 your weapons when ^x03%s^x04 is running"PREFIXPLUGIN);
    return 
PLUGIN_HANDLED
}

public 
MainMenu(id) {
    new 
menu menu_create("\r ~~ \yF\wU\yN \wM\yO\wD \r~~""fun_handler");
    
menu_additem(menu"\w Mod information""1"0);
    
menu_additem(menu"\w Pabber Pibber""2"0); 
    
menu_additem(menu"\w Flubber Flabber""3"0);
    
menu_additem(menu"\w Kibber Kabber""4"0),
    
menu_additem(menu"\w Tebber Tobber""5"0),
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}
    
public 
fun_handler(id,  menuitem) {
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[7], iName[64]
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data);
    
    
    switch(
key)
    {
        case 
1:
        {
            
ColorChat(idGREEN"--- Mod information ---");
            
ColorChat(idGREEN"[%s] This server is running ^x03%s %s^x04 by^x03 %s"PREFIX,  PLUGINVERSIONAUTHOR);
            
ColorChat(idGREEN"You can visit our webpage:^x03 http://znovit.com/funmod^x04 and read more.");
        }
        case 
2:
        {
            
strip_user_weapons(id );
            
give_item(id"weapon_hegrenade" );
            
give_item(id"weapon_scout" );
            
cs_set_user_bpammoidCSW_SCOUT90 );
            
set_user_footsteps(id1);
            
set_user_gravity(id 0.2);
            
set_user_health(id120);
            
set_user_armor(id255);
            
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25);
            
ColorChat(idGREEN"[%s] You are now^x03 Pabber Pibber"PREFIX)
        }
        case 
3
        {
            
strip_user_weapons(id );
            
give_item(id"weapon_hegrenade" );
            
give_item(id"weapon_m4a1" );
            
cs_set_user_bpammoidCSW_M4A190 );
            
give_item(id"weapon_flashbang" );
            
give_item(id"weapon_flashbang" );
            
set_user_health(id255);
            
set_user_gravity(id1.0);
            
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25);
            
ColorChat(idGREEN"[%s] You are now^x03 Flubber Flabber"PREFIX)
        }
        case 
4
        {
            
strip_user_weapons(id );
            
give_item(id"weapon_awp" );
            
cs_set_user_bpammoidCSW_AWP30 );
            
set_user_health(id155);
            
set_user_gravity(id0.5);
            
set_user_maxspeed(id555.0);
            
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25);
            
ColorChat(idGREEN"[%s] You are now^x03 Kibber Kabber"PREFIX)
        }
        case 
5
        {
            
strip_user_weapons(id );
            
give_item(id"weapon_knife" );
            
set_user_health(id50);
            
set_user_gravity(id1.0);
            
set_user_maxspeed(id800.0);
            
set_user_rendering(id,kRenderFxGlowShell,0,00,kRenderTransAlpha30); 
            
ColorChat(idGREEN"[%s] You are now^x03 Tebber Tobber"PREFIX)
        }
    }
    
    return 
PLUGIN_HANDLED;

__________________

Last edited by znovit; 06-05-2009 at 08:07.
znovit is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-05-2009 , 11:55   Re: set_user_maxspeed
Reply With Quote #2

Speed is reseted when you switch weapon so you have to set the speed again at this moment, using CurWeapon event or Ham_Item_Deploy or Ham_CS_Item_GetMaxSpeed
__________________
Arkshine is offline
znovit
Member
Join Date: Mar 2009
Location: Behind you :=
Old 06-05-2009 , 12:21   Re: set_user_maxspeed
Reply With Quote #3

So will this work?

PHP Code:
#include <amxmodx>
#include <fun>
 
public plugin_init()
        
register_event("CurWeapon""CurWeaponEvent""be""1=1");
 
public 
CurWeaponEvent(id) {
        
get_user_maxspeed(id)

__________________
znovit is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 06-05-2009 , 12:25   Re: set_user_maxspeed
Reply With Quote #4

do this:
PHP Code:
public CurWeaponEvent(id) {
      if (
get_user_maxspeed(id) == 550.0)
            
set_user_maxspeed(id550.0)

      if (
get_user_maxspeed(id) == 800.0)
            
set_user_maxspeed(id800.0)

zacky is offline
Send a message via Skype™ to zacky
znovit
Member
Join Date: Mar 2009
Location: Behind you :=
Old 06-05-2009 , 12:29   Re: set_user_maxspeed
Reply With Quote #5

Ok thanks.

Edit 1. Gonna try it

Edit 2. I cant try it cuz i cant change my sv_maxspeed cvar, every time im setting it to 1200 it changes back to 320, why? :s
__________________

Last edited by znovit; 06-05-2009 at 12:43.
znovit is offline
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-05-2009 , 16:34   Re: set_user_maxspeed
Reply With Quote #6

sv_maxspeed 2000
make sure you have this line in your server.cfg
if my memory isnt fooling me.
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com

Last edited by Atspulgs; 06-06-2009 at 15:32.
Atspulgs is offline
znovit
Member
Join Date: Mar 2009
Location: Behind you :=
Old 06-06-2009 , 08:54   Re: set_user_maxspeed
Reply With Quote #7

Doesnt work, =/
__________________
znovit is offline
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-06-2009 , 15:33   Re: set_user_maxspeed
Reply With Quote #8

does it changes back in the file or in the game the speed just drops or something/?
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com
Atspulgs is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-06-2009 , 16:00   Re: set_user_maxspeed
Reply With Quote #9

#4 will just do nothing.

What you need is a global var (array[33]) where you can store players custom speed, and if array[id] is different from 0 when CurWeapon is fired, set maxspeed to array[id].
Better would be to also filter CurWeapon to execute code only at weapon change.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
znovit
Member
Join Date: Mar 2009
Location: Behind you :=
Old 06-06-2009 , 16:58   Re: set_user_maxspeed
Reply With Quote #10

Could you please add it to my code? :p
__________________
znovit 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 14:00.


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