AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set_user_maxspeed (https://forums.alliedmods.net/showthread.php?t=93989)

znovit 06-05-2009 08:04

set_user_maxspeed
 
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;



Arkshine 06-05-2009 11:55

Re: set_user_maxspeed
 
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

znovit 06-05-2009 12:21

Re: set_user_maxspeed
 
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)



zacky 06-05-2009 12:25

Re: set_user_maxspeed
 
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)



znovit 06-05-2009 12:29

Re: set_user_maxspeed
 
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

Atspulgs 06-05-2009 16:34

Re: set_user_maxspeed
 
sv_maxspeed 2000
make sure you have this line in your server.cfg
if my memory isnt fooling me.

znovit 06-06-2009 08:54

Re: set_user_maxspeed
 
Doesnt work, =/

Atspulgs 06-06-2009 15:33

Re: set_user_maxspeed
 
does it changes back in the file or in the game the speed just drops or something/?

ConnorMcLeod 06-06-2009 16:00

Re: set_user_maxspeed
 
#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.

znovit 06-06-2009 16:58

Re: set_user_maxspeed
 
Could you please add it to my code? :p


All times are GMT -4. The time now is 14:00.

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