AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   [STOCK] get_current_weapon_speed (https://forums.alliedmods.net/showthread.php?t=241111)

swapped 05-28-2014 03:10

[STOCK] get_current_weapon_speed
 
Description
This stock is return the current weapon speed you handle.


The stock
PHP Code:

stock get_current_weapon_speedid )
{
    new 
iSpeed 0;

    switch( 
get_user_weaponid ) )
    {
        case 
CSW_KNIFEiSpeed 250;
        case 
CSW_SCOUTiSpeed 260;
        case 
CSW_USPiSpeed 250;
        case 
CSW_P228iSpeed 250;
        case 
CSW_HEGRENADEiSpeed 250;
        case 
CSW_XM1014iSpeed 240;
        case 
CSW_C4iSpeed 250;
        case 
CSW_AUGiSpeed 240;
        case 
CSW_SMOKEGRENADEiSpeed 250;
        case 
CSW_ELITEiSpeed 250;
        case 
CSW_FIVESEVENiSpeed 250;
        case 
CSW_UMP45iSpeed 250;
        case 
CSW_SG550iSpeed 210;
        case 
CSW_GALILiSpeed 240;
        case 
CSW_FAMASiSpeed 240;
        case 
CSW_GLOCK18iSpeed 250;
        case 
CSW_AWPiSpeed 210;
        case 
CSW_MP5NAVYiSpeed 250;
        case 
CSW_M249iSpeed 220;
        case 
CSW_M3iSpeed 230;
        case 
CSW_M4A1iSpeed 230;
        case 
CSW_TMPiSpeed 250;
        case 
CSW_G3SG1iSpeed 210;
        case 
CSW_FLASHBANGiSpeed 250;
        case 
CSW_DEAGLEiSpeed 250;
        case 
CSW_SG552iSpeed 235;
        case 
CSW_AK47iSpeed 221;
        case 
CSW_P90iSpeed 245
    
}
    return 
iSpeed;


Example:

PHP Code:

#include <amxmodx>


public plugin_init( )
{
    
register_clcmd"say /weapon_speed""HookWS" );
}

public 
HookWSid )
{
    
client_printidprint_chat" Weapon from your hand have %d speed."get_current_weapon_speedid ) );
}

stock get_current_weapon_speedid )
{
    new 
iSpeed 0;

    switch( 
get_user_weaponid ) )
    {
        case 
CSW_KNIFEiSpeed 250;
        case 
CSW_SCOUTiSpeed 260;
        case 
CSW_USPiSpeed 250;
        case 
CSW_P228iSpeed 250;
        case 
CSW_HEGRENADEiSpeed 250;
        case 
CSW_XM1014iSpeed 240;
        case 
CSW_C4iSpeed 250;
        case 
CSW_AUGiSpeed 240;
        case 
CSW_SMOKEGRENADEiSpeed 250;
        case 
CSW_ELITEiSpeed 250;
        case 
CSW_FIVESEVENiSpeed 250;
        case 
CSW_UMP45iSpeed 250;
        case 
CSW_SG550iSpeed 210;
        case 
CSW_GALILiSpeed 240;
        case 
CSW_FAMASiSpeed 240;
        case 
CSW_GLOCK18iSpeed 250;
        case 
CSW_AWPiSpeed 210;
        case 
CSW_MP5NAVYiSpeed 250;
        case 
CSW_M249iSpeed 220;
        case 
CSW_M3iSpeed 230;
        case 
CSW_M4A1iSpeed 230;
        case 
CSW_TMPiSpeed 250;
        case 
CSW_G3SG1iSpeed 210;
        case 
CSW_FLASHBANGiSpeed 250;
        case 
CSW_DEAGLEiSpeed 250;
        case 
CSW_SG552iSpeed 235;
        case 
CSW_AK47iSpeed 221;
        case 
CSW_P90iSpeed 245
    
}
    return 
iSpeed;



Arkshine 05-28-2014 04:20

Re: [STOCK] get_current_weapon_speed
 
Or you can just use Ham_CS_Item_GetMaxSpeed.

HamletEagle 05-30-2014 09:10

Re: [STOCK] get_current_weapon_speed
 
Why you made a stock when you could just make a list and post it here ?

Arkshine 05-30-2014 09:52

Re: [STOCK] get_current_weapon_speed
 
It's already here anyway : https://wiki.alliedmods.net/CS_Weapons_Information

TheDS1337 05-30-2014 14:56

Re: [STOCK] get_current_weapon_speed
 
Well, he took it from Exolent's HnS plugin I guess, I believe I saw it on it

Bos93 05-30-2014 15:47

Re: [STOCK] get_current_weapon_speed
 
Quote:

swapped
BANNED
nice tutorial

BANNED :-D

PRoSToTeM@ 05-30-2014 19:09

Re: [STOCK] get_current_weapon_speed
 
get_user_weapon not always return correct weapon


All times are GMT -4. The time now is 07:19.

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