Raised This Month: $ Target: $400
 0% 

Solved Change weapon clip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-17-2022 , 19:16   Re: Change weapon clip
Reply With Quote #1

If a method exists to do what you want, you should use it until you find something better. The excuse "I don't want to use it because they have too many other features" is a very bad excuse unless there is tangible evidence that it actually affects the behavior of the used functionality.

To what method are you referring? Maybe it can be used to create something better.
__________________

Last edited by fysiks; 01-17-2022 at 19:17.
fysiks is offline
The overrated maniac
Member
Join Date: Jun 2021
Location: Argentina
Old 01-17-2022 , 21:24   Re: Change weapon clip
Reply With Quote #2

Quote:
Originally Posted by fysiks View Post
If a method exists to do what you want, you should use it until you find something better. The excuse "I don't want to use it because they have too many other features" is a very bad excuse unless there is tangible evidence that it actually affects the behavior of the used functionality.

To what method are you referring? Maybe it can be used to create something better.
I dont understand the code so I cant change it, its cs_weapons_api and I got it from ttt, its used for newton launcher item and others.

This is the STRUCT, but I dont know where data[STRUCT_CSWA_CLIP] comes from and how to get the code to only use it and not all.
PHP Code:
//on plugin init
cvar_weapon_clip    my_register_cvar("ttt_newton_clip",    "1",    "Newton Launcher clip ammo. (Default: 1)");
    
cvar_weapon_ammo    my_register_cvar("ttt_newton_ammo",    "10",    "Newton Launcher backpack ammo. (Default: 10)");
    
cvar_weapon_speed    my_register_cvar("ttt_newton_speed",    "2.0",    "Newton Launcher attack speed delay. (Default: 2.0)");
    
cvar_weapon_damage    my_register_cvar("ttt_newton_damage",    "0.0",    "Newton Launcher damage multiplier. (Default: 0.0)");
    
cvar_weapon_reload    my_register_cvar("ttt_newton_reload",    "2.0",    "Newton Launcher reload speed. (Default: 2.0)");
    
cvar_weapon_recoil    my_register_cvar("ttt_newton_recoil",    "0.0",    "Newton Launcher recoil. (Default: 0.0)");
    
cvar_weapon_force    my_register_cvar("ttt_newton_force",    "100.0","Newton Launcher force. (Default: 100.0)");
    
cvar_weapon_price    my_register_cvar("ttt_price_newton",    "1",    "Newton Launcher price. (Default: 1)");

// after
public ttt_item_selected(iditemname[], price//ignore
{
    if(
g_iItemID == item)//ignore
    
{
        if(
user_has_weapon(idWEAPON_CSWID))//ignore
            
engclient_cmd(id"drop"WEAPON_NAME);//ignore

        
static data[STOREABLE_STRUCTURE];
        if(!
data[STRUCT_CSWA_CSW])
        {
            
data[STRUCT_CSWA_ITEMID] = g_iItemID;
            
data[STRUCT_CSWA_CSW] = WEAPON_CSWID;
            
data[STRUCT_CSWA_CLIP] = get_pcvar_num(cvar_weapon_clip);
            
data[STRUCT_CSWA_MAXCLIP] = get_pcvar_num(cvar_weapon_clip);
            
data[STRUCT_CSWA_AMMO] = get_pcvar_num(cvar_weapon_ammo);
            
data[STRUCT_CSWA_STACKABLE] = true;
            
data[STRUCT_CSWA_SILENCED] = -1;
            
data[STRUCT_CSWA_SPEEDDELAY] = _:get_pcvar_float(cvar_weapon_speed);
            
data[STRUCT_CSWA_DAMAGE] = _:get_pcvar_float(cvar_weapon_damage);
            
data[STRUCT_CSWA_RELOADTIME] = _:get_pcvar_float(cvar_weapon_reload);
            
//data[STRUCT_CSWA_RECOIL] = _:get_pcvar_float(cvar_weapon_recoil);
            
data[STRUCT_CSWA_MODEL_V] = g_szModels[0];
            
data[STRUCT_CSWA_MODEL_P] = g_szModels[1];
            
data[STRUCT_CSWA_MODEL_W] = g_szModels[2];
        }

        
cswa_give_specific(iddata);

        
client_print_color(idprint_team_default"%s %L"TTT_TAGid"TTT_ITEM2"nameid"TTT_ITEM5");//ignore
        
return PLUGIN_HANDLED;
    }

    return 
PLUGIN_CONTINUE;

below is the api, I dont know if something else is needed, but in the api I didnt found the method to do it.
Attached Files
File Type: inc cs_weapons_api.inc (2.4 KB, 30 views)
File Type: inc cs_weapons_api_stocks.inc (2.9 KB, 33 views)
The overrated maniac 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 11:30.


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