AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Players maxspeed help needed (https://forums.alliedmods.net/showthread.php?t=58137)

Maurice 07-19-2007 21:06

Players maxspeed help needed
 
After i played on a scout only server i missed the fast movements on my own server and specialy with the AWP or other heavy weapon. Due this i had the idea to give every weapon the same weapon speed of 260. I've totally no idea how to make such a plugin and decided to edit a current plugin that already get close to my ideas and used v3x various weapon speeds for this.

It seems to work very well such as changing between weapons is no problem except one thing, when a new round started and i don't switch between guns or fire a bullet i use the default CS weapon speed, after i fired a shot or changed a weapon then i use again the new weapon speed.

Where i'm looking for is a script that when a player spawned his maxspeed is 260 and then the plugin would work 100%, hopefully someone know how to fix this and want to help me.


here is the edited script of v3x's script code.
Code:

#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN    "PLUGIN"
#define AUTHOR    "AUTHOR"
#define VERSION    "VERSION"

public plugin_init()
{
    register_plugin(PLUGIN,VERSION,AUTHOR)
    register_event("CurWeapon","check_speed","be")
    register_cvar("knife_speed","800")
    register_cvar("m4a1_speed","100")
    register_cvar("default_speed","400")
    register_logevent("new_round",2,"1=Round_Start")
}

public new_round(id)
{
    set_user_maxspeed(id,float(get_cvar_num("default_speed")))
    return PLUGIN_CONTINUE
}

public check_speed(id)
{
    new clip, ammo
    new weapon = get_user_weapon(id,clip,ammo)

    switch(weapon)
    {
        case CSW_KNIFE:
        {
            set_user_maxspeed(id,float(get_cvar_num("knife_speed")))
        }
        case CSW_M4A1:
        {
            set_user_maxspeed(id,float(get_cvar_num("m4a1_speed")))
        }
        default:
        {
            set_user_maxspeed(id,float(get_cvar_num("default_speed")))
        }
    }
    return PLUGIN_CONTINUE
}


Rolnaaba 07-19-2007 21:45

Re: Players maxspeed help needed
 
try using
Code:
register_event("ResetHUD", "new_round", "b");
instead of the newround function you are using. This event is called on player spawn, and other stuff too. Try that. (remember to do a is_user_alive check in your new_round function if you use this event.)

Mini_Midget 07-22-2007 09:16

Re: Players maxspeed help needed
 
Don't call that event "new_round"
It actually is called on spawn and some other commands.

Just a small tip though

Rolnaaba 07-22-2007 11:38

Re: Players maxspeed help needed
 
I know I just made it new_round becuase that is what he called his function.
Quote:

Originally Posted by Rolnaaba
This event is called on player spawn, and other stuff too



All times are GMT -4. The time now is 21:30.

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