Raised This Month: $ Target: $400
 0% 

Knife Speed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 04-15-2009 , 07:39   Knife Speed
Reply With Quote #1

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")) ... 
Debesėlis is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 04-15-2009 , 07:47   Re: Knife Speed
Reply With Quote #2

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 :}
__________________
Hunter-Digital is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-15-2009 , 08:12   Re: Knife Speed
Reply With Quote #3

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;     }
Arkshine is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 04-15-2009 , 09:17   Re: Knife Speed
Reply With Quote #4

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"))

Debesėlis is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 04-15-2009 , 09:41   Re: Knife Speed
Reply With Quote #5

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

__________________

Last edited by Dr.G; 04-15-2009 at 09:44.
Dr.G is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 04-15-2009 , 09:53   Re: Knife Speed
Reply With Quote #6

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

__________________
Dr.G is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 04-15-2009 , 10:06   Re: Knife Speed
Reply With Quote #7

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


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"))


Last edited by Debesėlis; 04-15-2009 at 12:48.
Debesėlis is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 04-15-2009 , 13:52   Re: Knife Speed
Reply With Quote #8

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
__________________
Dr.G is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 04-15-2009 , 14:25   Re: Knife Speed
Reply With Quote #9

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"))

Debesėlis is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 04-15-2009 , 16:30   Re: Knife Speed
Reply With Quote #10

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?
__________________
Dr.G 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 02:17.


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