Sari la conținut

[CS:GO] - [Modul-VIP] "Grenades"


NiGHT

Postări Recomandate

Deoarece nu am gasit nici eu un plugin bun pentru Grenade, m am gandit sa fac eu unul.

 

Compiler folosit:  SourcePawn Compiler 1.10.0.6502

Informatii despre plugin:

- 1. Nu primesti grenade in rundele de pistoale(runda 0 si runda 15)

- 2. Nu se suprapun grenadele (nu primesti grenada respectia daca o ai deja, si asa mai departe)

- 3. De adaugat in groups.ini "Grenades" "1"

 

Sursa:

Spoiler
#pragma semicolon 1
#pragma newdecls required
 
#include <sourcemod>
#include <vip_core>
#include <sdktools>
 
#define     CS_TEAM_CT              3           /*< Counter-Terrorists. */
#define     HEGrenadeOffset         14          // (14 * 4)
#define     FlashbangOffset         15          // (15 * 4)
#define     SmokegrenadeOffset      16          // (16 * 4)
#define     IncGrenadesOffset       17          // (17 * 4) Also Molotovs
#define     DecoyGrenadeOffset      18          // (18 * 4)
 
public Plugin myinfo = 
{
    name = "[VIP] Module - Grenades"
    author = "NiGHT"
    version = "2.1"
};
 
static const char g_sFeature[] = "Grenades";
 
int g_iLimit;
bool g_bEnable[MAXPLAYERS+1] = false;
bool g_bEnabled = false;
ConVar ammo_grenade_limit_total;
 
public void OnPluginStart()
{
    if (VIP_IsVIPLoaded())
    {
        VIP_OnVIPLoaded();
    }
    ammo_grenade_limit_total = FindConVar("ammo_grenade_limit_total");
    
    g_iLimit = ammo_grenade_limit_total.IntValue;
    ammo_grenade_limit_total.AddChangeHook(OnSettingsChanged);
}
 
public void OnMapStart()
{
    g_bEnabled = true;
 
    char map[MAX_NAME_LENGTH];
    GetCurrentMap(map, sizeof(map));
    
    if(strncmp(map, "35hp_"5) == 0 || strncmp(map, "awp_"4) == 0 || strncmp(map, "aim_"4) == 0 || strncmp(map, "fy_"3) == 0) g_bEnabled = false;
}
 
public void OnSettingsChanged(ConVar convar, const char[] OldVal, const char[] NewVal)
{
    if(strcmp(NewVal, OldVal) == 0)
        return;
    
    if(convar == ammo_grenade_limit_total)
    {
        g_iLimit = ammo_grenade_limit_total.IntValue;
    }
}
 
public void OnPluginEnd()
{
    if (CanTestFeatures() && GetFeatureStatus(FeatureType_Native, "VIP_UnregisterFeature") == FeatureStatus_Available)
    {
        VIP_UnregisterFeature(g_sFeature);
    }
}
 
public void VIP_OnVIPLoaded()
{
    VIP_RegisterFeature(g_sFeature, BOOL, _, OnToggleItem);
}
 
public Action OnToggleItem(int iClient, const char[] sFeatureName, VIP_ToggleState OldStatus, VIP_ToggleState &NewStatus)
{
    g_bEnable[iClient] = (NewStatus == ENABLED);
    return Plugin_Continue;
}
 
public void VIP_OnVIPClientLoaded(int iClient)
{
    g_bEnable[iClient] = VIP_IsClientFeatureUse(iClient, g_sFeature);
}
 
public void OnClientDisconnect(int iClient)
{
    g_bEnable[iClient] = false;
}
 
public void VIP_OnPlayerSpawn(int iClient, int iTeam, bool bIsVIP)
{
    if(!g_bEnabled || !bIsVIP || !g_bEnable[iClient])
        return;
    
    int round = GetTeamScore(2) + GetTeamScore(3);
    if(round == 0 || round == 15 || GameRules_GetProp("m_bWarmupPeriod") == 1)
        return;
    
    // ******************** GRENADES ********************
    int iGrenadesToReceive = g_iLimit - GetClientGrenades(iClient);
    
    if(GetEntProp(iClient, Prop_Send, "m_iAmmo", _, HEGrenadeOffset) < 1 && iGrenadesToReceive != 0)
    {
        GivePlayerItem(iClient, "weapon_hegrenade");
        iGrenadesToReceive--;
    }
    if(GetEntProp(iClient, Prop_Send, "m_iAmmo", _, FlashbangOffset) < 1 && iGrenadesToReceive != 0)
    {
        GivePlayerItem(iClient, "weapon_flashbang");
        iGrenadesToReceive--;
    }
    if(GetEntProp(iClient, Prop_Send, "m_iAmmo", _, SmokegrenadeOffset) < 1 && iGrenadesToReceive != 0)
    {
        GivePlayerItem(iClient, "weapon_smokegrenade");
        iGrenadesToReceive--;
    }
    if(GetEntProp(iClient, Prop_Send, "m_iAmmo", _, IncGrenadesOffset) < 1 && iGrenadesToReceive != 0)
    {
        switch (GetClientTeam(iClient))
        {
            case 2:
            {
                GivePlayerItem(iClient, "weapon_molotov");
                iGrenadesToReceive--;
            }
            case 3:
            {
                GivePlayerItem(iClient, "weapon_incgrenade");
                iGrenadesToReceive--;
            }
        }
    }
    
    // ******************** DEFUSER ********************
    if (GetClientTeam(iClient) == CS_TEAM_CT && GetEntProp(iClient, Prop_Send, "m_bHasDefuser") < 1)
    {
        SetEntProp(iClient, Prop_Send, "m_bHasDefuser"1);
    }
    
}
 
stock int GetClientGrenades(int iClient)
{
    int decoy = GetEntProp(iClient, Prop_Send, "m_iAmmo", _, DecoyGrenadeOffset);
    int smoke = GetEntProp(iClient, Prop_Send, "m_iAmmo", _, SmokegrenadeOffset);
    int flashbang = GetEntProp(iClient, Prop_Send, "m_iAmmo", _, FlashbangOffset);
    int incendiary = GetEntProp(iClient, Prop_Send, "m_iAmmo", _, IncGrenadesOffset);
    int hegrenade = GetEntProp(iClient, Prop_Send, "m_iAmmo", _, HEGrenadeOffset);
    return decoy+smoke+flashbang+incendiary+hegrenade;
}

 

  • Like 5
  • Love 1

b_560_95_1.png

 

-> DISCORD <-

-> STEAM <-

-> STEAM GROUP <-

Link spre comentariu
Distribuie pe alte site-uri

  • 6 luni mai târziu...

Alătură-te conversației

Poți posta acum și să te înregistrezi mai târziu. Dacă ai un cont, autentifică-te acum pentru a posta cu contul tău.
Notă: Postarea ta va necesita aprobare moderator înainte de a fi vizibilă.

Vizitator
Răspunde la acest topic...

×   Inserat ca text bogat.   Lipiți ca text simplu

  Doar 75 emoji sunt permise.

×   Linkul tău a fost încorporat automat.   Afișează ca link în schimb

×   Conținutul tău precedent a fost restaurat.   Curăță editor

×   Nu poți lipi imagini direct. Încarcă sau inserează imagini din URL.

×
×
  • Creează nouă...

Informații Importante

Am plasat cookie-uri pe dispozitivul tău pentru a îmbunătății navigarea pe acest site. Poți modifica setările cookie, altfel considerăm că ești de acord să continui. Also by continuing using this website you agree with the Terms of Use and Privacy Policy.