AlliedModders

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

Debesėlis 04-15-2009 07:39

Knife Speed
 
How do I make a player, holding a knife in his hand run faster? (than default speed)
This thing I've written only works during freezetime and then resets to normal...

PHP Code:

...  register_cvar("amx_knife_speed""330")

...  
set_user_maxspeed(idget_user_maxspeed(id)+get_cvar_num("amx_knife_speed")) ... 


Hunter-Digital 04-15-2009 07:47

Re: Knife Speed
 
Use it in the curweapon event, when the weapon is knife change the speed, when is NOT, leave it alone...

PHP Code:

new cvar_knife_speed
 
public plugin_init()
{
    
register_event("CurWeapon""curWeap""be""1=1")
    
cvar_knife_speed register_cvar("amx_knife_speed""330")
}
 
public 
curWeap(id)
{
    static 
weapon
    weapon 
read_data(2)
 
    if(
weapon == CSW_KNIFE)
        
set_user_maxspeed(idget_pcvar_float(cvar_knife_speed))


Or something like it :}

Arkshine 04-15-2009 08:12

Re: Knife Speed
 
This is better :

Code:
    #include <amxmodx>     #include <hamsandwich>         new pCvarKnifeSpeed;         public plugin_init()     {         register_plugin( "Knife Speed", "1.0.0", "Arkshine" );                 pCvarKnifeSpeed = register_cvar( "knife_speed", "320" );         RegisterHam( Ham_CS_Item_GetMaxSpeed, "weapon_knife", "Event_ChangeKnifeSpeed" );     }     public Event_ChangeKnifeSpeed ( const Entity )     {         SetHamReturnFloat( get_pcvar_float( pCvarKnifeSpeed ) );         return HAM_SUPERCEDE;     }

Debesėlis 04-15-2009 09:17

Re: Knife Speed
 
I don't need the entire plugin, I need to add the code into my own plugin, so that when you enable it from a menu, you'd be given armor, hp and increased run speed.

PHP Code:

public plugin_init()
{
register_cvar("amx_knife_speed""330")
}

public 
knifemod(id)
{
        
cs_set_user_armor(id100CS_ARMOR_VESTHELM)
        
set_user_health(idget_user_health(id)+get_cvar_num("amx_knife_hp"))
        
set_user_maxspeed(idget_user_maxspeed(id)+get_cvar_num("amx_knife_speed"))
        
client_print(idprint_chat"%L"LANG_PLAYER"KNIFE_HP"get_cvar_num("amx_knife_hp"))



Dr.G 04-15-2009 09:41

Re: Knife Speed
 
i think like this but i really dont know jack about CS


PHP Code:

/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
 
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
 
new p_enablep_speedp_health
 
new const g_lang_file[] = "the_lang_file_you_wanna_to_print_from.txt"
 
public plugin_init()
{
 
/* on / off cvar */
 
p_enable register_cvar("amx_knife_mod""1"/* 1 is positive... */
 
 /* the speed cvar */
 
p_speed register_cvar("amx_knife_speed""330")
 
 
/* the health cvar */
 
p_health register_cvar("amx_knife_health""100")
 
 
/* a say command for testing??? */
 
register_clcmd("say /knifetest""knifemod")
 
 
 
register_dictionaryg_lang_file )
}
 
public 
knifemod(id)
{
 
 if(!
get_pcvar_num(p_enable))/* p_enable is NOT positiv STOP */
  
return PLUGIN_HANDLED
 
 cs_set_user_armor
(id100CS_ARMOR_VESTHELM)
 
 
set_user_health(idget_user_health(id) + get_pcvar_num(p_health))
 
 
set_user_maxspeed(idget_user_maxspeed(id) + get_pcvar_num(p_speed))
 
 
client_print(idprint_chat"%L"LANG_PLAYER"KNIFE_HP"get_cvar_num("amx_knife_hp"))
 
 return 
PLUGIN_CONTINUE



Dr.G 04-15-2009 09:53

Re: Knife Speed
 
if you wanna strip him btw...


PHP Code:

public knifemod(id)
{
 
 if(!
get_pcvar_num(p_enable))/* p_enable is NOT positiv STOP */
  
return PLUGIN_HANDLED
 
 strip_user_weapons
(id/* strip */
 
 
give_item(id"weapon_knife"/* give */
 
 
cs_set_user_armor(id100CS_ARMOR_VESTHELM)
 
 
set_user_health(idget_user_health(id) + get_pcvar_num(p_health))
 
 
set_user_maxspeed(idget_user_maxspeed(id) + get_pcvar_num(p_speed))
 
 
client_print(idprint_chat"%L"LANG_PLAYER"KNIFE_HP"get_cvar_num("amx_knife_hp"))
 
 return 
PLUGIN_CONTINUE



Debesėlis 04-15-2009 10:06

Re: Knife Speed
 
I editted your plugin and glued it into my own. The problem is, that during freezetime it works, but after it - it doesn't :down:


Its a part of the menu... When I open the menu and turn on a function, I want my speed with the knife to be increased (beyond the default speed). Hp and armor work just fine!

PHP Code:

public plugin_init()
{
register_cvar("amx_knife_speed""330")
}

public 
knifemod(id)
{
        
set_user_maxspeed(idget_user_maxspeed(id)+get_cvar_num("amx_knife_speed"))



Dr.G 04-15-2009 13:52

Re: Knife Speed
 
oh its a float http://www.amxmodx.org/funcwiki.php?...peed&go=search

set_user_maxspeed(id, get_user_maxspeed(id) + get_pcvar_float(p_speed))

try setting it to 3 or something

Debesėlis 04-15-2009 14:25

Re: Knife Speed
 
Only works during freezetime and then resets to normal...

PHP Code:

new p_speed;

public 
plugin_init()
{
    
p_speed register_cvar("amx_knife_speed""330");
}

public 
knifemod(id)
{
        
cs_set_user_armor(id100CS_ARMOR_VESTHELM)
        
set_user_health(idget_user_health(id)+get_cvar_num("amx_knife_hp"))
        
set_user_maxspeed(idget_user_maxspeed(id) + get_pcvar_float(p_speed))
        
client_print(idprint_chat"%L"LANG_PLAYER"KNIFE_HP"get_cvar_num("amx_knife_hp"))



Dr.G 04-15-2009 16:30

Re: Knife Speed
 
well fell free to take the code i made and put your name, i dont care. What happen if you say /knifetest after freeze time?


All times are GMT -4. The time now is 02:17.

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