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

[CSGO] Deagle 1 bullet, can someone help me fix bug?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ivenuss
Junior Member
Join Date: Nov 2019
Location: Czech Republic
Old 01-05-2020 , 17:56   [CSGO] Deagle 1 bullet, can someone help me fix bug?
Reply With Quote #1

Hello can someone help me fix bug? Sometimes players gets deagle with 1 bullet (thats right) but sometimes they get deagle with 1/35 ammo. + If someone can help me how to disable deagle when Is noscope round.
Noscope round plugin: https://forums.alliedmods.net/showthread.php?p=2528532
Code:
#include <sourcemod>
#include <sdktools>
 
#pragma semicolon 1
#pragma newdecls required
 
public void OnPluginStart()
{
    HookEvent("player_spawn", Event_PlayerSpawn);
}

public Action Event_PlayerSpawn(Handle event, const char[] name, bool dontBroadcast)
{
    int client = GetClientOfUserId(GetEventInt(event, "userid"));
    
    if(IsPlayerAlive(client) && IsClientInGame(client))
    {
        if(IsClientVIP(client))
        {
            if (GetPlayerWeaponSlot(client, 2) != -1) 
            {
                RemovePlayerItem(client, 2); 
            }
            
            RequestFrame(NextFrameFor_Weapons, GetClientUserId(client));
        }
    }
    
    return Plugin_Continue;
}

void NextFrameFor_Weapons(any data)
{
    int client = GetClientOfUserId(data);
    
    if(IsPlayerAlive(client) && IsClientInGame(client))
    {
        if(GameRules_GetProp("m_bWarmupPeriod") == 0)
        {
            if(IsClientVIP(client))
            {
                int iWep = GivePlayerItem(client, "weapon_deagle");
                SetPlayerAmmo(client, iWep, 1, 0);
            }
        }
    }
}

public bool IsClientVIP(int client)
{
    return CheckCommandAccess(client, "VIP", ADMFLAG_RESERVATION, true);
}

stock void SetPlayerAmmo(int client, int weapon, int clip = -1, int ammo = -1)
{
    if(weapon == INVALID_ENT_REFERENCE)
    {
        return;
    }
    
    if(clip != -1)
    {
        SetEntProp(weapon, Prop_Send, "m_iClip1", clip);
    }

    if(ammo != -1)
    {
        SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", ammo);
        SetEntProp(weapon, Prop_Send, "m_iSecondaryReserveAmmoCount", ammo);
    }
}
ivenuss is offline
Indarello
Senior Member
Join Date: Nov 2015
Location: Russia
Old 01-07-2020 , 14:28   Re: [CSGO] Deagle 1 bullet, can someone help me fix bug?
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?p=2633141
Indarello is offline
Reply


Thread Tools
Display Modes

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 04:55.


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