Raised This Month: $51 Target: $400
 12% 

Set Weapon Reserve Size to 0.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
noahspaghetti
Member
Join Date: Mar 2020
Old 03-30-2020 , 01:15   Set Weapon Reserve Size to 0.
Reply With Quote #1

For example, I want an MP7 to have a layout of 30:0 instead of 30:120.


30 = Clip Size

0 = Reserves

Or... if possible is there a way to prevent others from completely reloading at all? I have looked around for other plugins, and Ammo Manager is outdated.

Edit: Solved.

Last edited by noahspaghetti; 03-31-2020 at 11:58.
noahspaghetti is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-30-2020 , 10:38   Re: Set Weapon Reserve Size to 0.
Reply With Quote #2

csgo ?
Code:
"sv_infinite_ammo" = "0"
FCVAR_GAMEDLL FCVAR_REPLICATED FCVAR_RELEASE 
- Player's active weapon will never run out of ammo. If set to 2 then player has infinite total ammo but still has to reload the magazine.

*edit
or
https://www.sourcemod.net/plugins.ph...tion=&search=1
__________________
Do not Private Message @me

Last edited by Bacardi; 03-30-2020 at 10:39.
Bacardi is offline
noahspaghetti
Member
Join Date: Mar 2020
Old 03-31-2020 , 02:28   Re: Set Weapon Reserve Size to 0.
Reply With Quote #3

Quote:
Or... if possible is there a way to prevent others from completely reloading at all? I have looked around for other plugins, and Ammo Manager is outdated.
I'm mainly looking for something like this.
noahspaghetti is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 03-31-2020 , 06:25   Re: Set Weapon Reserve Size to 0.
Reply With Quote #4

PHP Code:

#include <sourcemod>
#include <sdkhooks>
#include <sdktools>

bool g_IsPluginLoadedLate;

public 
APLRes AskPluginLoad2(Handle myselfbool latechar[] errorint err_max)
{
    
g_IsPluginLoadedLate late;
}

public 
void OnPluginStart()
{    
    if (
g_IsPluginLoadedLate)
    {
        for (
int i 1<= MaxClientsi++)
        {
            if (
IsClientInGame(i))
            {
                
OnClientPutInServer(i);
            }
        }
    }
}

public 
void OnEntityCreated(int entity, const char[] classname)
{    
    if (
StrEqual(classname"weapon_mp7"true))
    {
        
SDKHook(entitySDKHook_SpawnPostSDK_OnWeaponSpawn_Post);
    }
}

public 
void SDK_OnWeaponSpawn_Post(int weapon)
{
    if (!
IsValidEntity(weapon))
    {
        return;
    }
    
    
RequestFrame(Frame_SetWeaponAmmoEntIndexToEntRef(weapon));
}

public 
void Frame_SetWeaponAmmo(int reference)
{
    
int weapon EntRefToEntIndex(reference);
    if (
weapon == INVALID_ENT_REFERENCE)
    {
        return;
    }
    
    switch (
GetItemDefinitionIndex(weapon))
    {
        case 
33// mp7
        
{
            if (
HasOwner(weapon))
            {
                
SetEntProp(weaponProp_Send"m_iClip2"0);
            }
        }
    }
}

public 
void OnClientPutInServer(int client)
{
    
SDKHook(clientSDKHook_WeaponEquipPostSDK_OnWeaponEquip_Post);
}

public 
void SDK_OnWeaponEquip_Post(int clientint weapon)
{
    if (!
IsValidEntity(weapon))
    {
        return;
    }
    
    switch (
GetItemDefinitionIndex(weapon))
    {
        case 
33// mp7
        
{
            if (!
HasPrevOwner(weapon))
            {
                
SetEntProp(weaponProp_Send"m_iClip2"0);
            }
        }
    }
}

int GetItemDefinitionIndex(int item)
{
    return 
GetEntProp(itemProp_Send"m_iItemDefinitionIndex");
}

bool HasOwner(int entity)
{
    return 
GetEntPropEnt(entityProp_Data"m_hOwnerEntity") != -1;
}

bool HasPrevOwner(int entity)
{
    return 
GetEntPropEnt(entityProp_Send"m_hPrevOwner") != -1;

You can add more weapons.
__________________
Ilusion9 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 06:15.


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