Raised This Month: $32 Target: $400
 8% 

Solved Change weapon clip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The overrated maniac
Member
Join Date: Jun 2021
Location: Argentina
Old 01-17-2022 , 18:43   Change weapon clip
Reply With Quote #1

I have a deagle with 1 bullet and 35 to load. I shoot that bullet, I reaload and I want to have only 1 bullet and not 7.
I saw apis that do that, I dont want to use them because they have a lot of things and I only need one

Last edited by The overrated maniac; 01-18-2022 at 22:09. Reason: Solved
The overrated maniac is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-17-2022 , 19:16   Re: Change weapon clip
Reply With Quote #2

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 #3

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, 23 views)
File Type: inc cs_weapons_api_stocks.inc (2.9 KB, 27 views)
The overrated maniac is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 01-17-2022 , 21:32   Re: Change weapon clip
Reply With Quote #4

Why not cs_set_weapon_ammo?
__________________
DJEarthQuake is offline
The overrated maniac
Member
Join Date: Jun 2021
Location: Argentina
Old 01-17-2022 , 22:24   Re: Change weapon clip
Reply With Quote #5

Quote:
Originally Posted by DJEarthQuake View Post
I want only 1 bullet after the user reload. Shoot, reload, shoot, reload. Not shoot shoot shoot shoot reload shoot shoot shoot shoot reload. Can it be done with that? max 1 shoot?
The overrated maniac is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-17-2022 , 23:15   Re: Change weapon clip
Reply With Quote #6

You already said that and he gave you an option to try. Try it and see if you can get it to work. FYI, GunGame does this for the AWP in event_curweapon() using cs_set_weapon_ammo().
__________________

Last edited by fysiks; 01-17-2022 at 23:16.
fysiks is offline
The overrated maniac
Member
Join Date: Jun 2021
Location: Argentina
Old 01-18-2022 , 22:08   Re: Change weapon clip
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
FYI, GunGame does this for the AWP in event_curweapon() using cs_set_weapon_ammo().
Thanks
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 18:19.


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