AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CSGO] Deagle 1 bullet, can someone help me fix bug? (https://forums.alliedmods.net/showthread.php?t=320721)

ivenuss 01-05-2020 17:56

[CSGO] Deagle 1 bullet, can someone help me fix bug?
 
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);
    }
}


Indarello 01-07-2020 14:28

Re: [CSGO] Deagle 1 bullet, can someone help me fix bug?
 
https://forums.alliedmods.net/showthread.php?p=2633141


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

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