Raised This Month: $ Target: $400
 0% 

[REQ][CSGO] Add timer to block drop item during buy


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dom72
Junior Member
Join Date: Aug 2014
Old 06-16-2015 , 20:12   [REQ][CSGO] Add timer to block drop item during buy
Reply With Quote #1

Hello all,

i have one plugin for drop item but for prevent to spam buy, i wondering add a timer to block the drop during buy for 15 second with message chat "drop item is blocking during buy"

Any coder to help me please?

Code:
#pragma semicolon 1

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

#define PL_VERSION "1.0.0"

#pragma semicolon 1
#pragma newdecls required

ConVar g_cEnable;
ConVar g_cTaser;
ConVar g_cHEGrenade;
ConVar g_cFlash;
ConVar g_cSmoke;
ConVar g_cIncGrenade;
ConVar g_cMolotov;
ConVar g_cDecoy;


public Plugin myinfo =
{
    name = "Drop",
    author = "Bara",
    version = PL_VERSION,
    description = "",
    url = ""
};

public void OnPluginStart()
{
    if (GetEngineVersion() != Engine_CSS && GetEngineVersion() != Engine_CSGO)
    {
        SetFailState("Only CSS and CSGO Support");
        return ;
    }
    
    CreateConVar("cs_drop_version", PL_VERSION, "With this Plugin you can drop your grenades and knives.", FCVAR_NOTIFY | FCVAR_DONTRECORD);
    
    g_cEnable = CreateConVar("drop_enable", "1", "Should be enabled this plugin?");
    g_cTaser = CreateConVar("drop_taser", "1", "Enable \"taser\" drop?");
    g_cHEGrenade = CreateConVar("drop_hegrenade", "1", "Enable \"hegrenade\" drop?");
    g_cFlash = CreateConVar("drop_flashbang", "1", "Enable \"flashbang\" drop?");
    g_cSmoke = CreateConVar("drop_smokegrenade", "1", "Enable \"smokegrenade\" drop?");
    g_cIncGrenade = CreateConVar("drop_incgrenace", "1", "Enable \"incgrenade\" drop?");
    g_cMolotov = CreateConVar("drop_molotov", "1", "Enable \"molotov\" drop?");
    g_cDecoy = CreateConVar("drop_decoy", "1", "Enable \"decoy\" drop?");
    
    
    AutoExecConfig();

    AddCommandListener(Command_Drop, "drop");
}

public Action Command_Drop(int client, const char[] command, int args)
{
    if(!g_cEnable.BoolValue)
        return Plugin_Continue;
    
    if (IsClientInGame(client))
    {
        char sName[32];
        int weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
        if(!IsValidEdict(weapon))
        {
            return Plugin_Stop;
        }

        GetEdictClassname(weapon, sName, sizeof(sName));

        if (StrEqual("weapon_taser", sName, false) && g_cTaser.BoolValue)
        {
            if (GetEntProp(weapon, Prop_Data, "m_iClip1") > 0)
            {
                int iSequence = GetEntProp(weapon, Prop_Data, "m_nSequence");
                if((GetEngineVersion() == Engine_CSS && iSequence != 5) || (GetEngineVersion() == Engine_CSGO && iSequence != 2))
                {
                    SDKHooks_DropWeapon(client, weapon);
                    return Plugin_Handled;
                }
            }
        }
        else if (StrEqual("weapon_hegrenade", sName, false) && g_cHEGrenade.BoolValue ||
                StrEqual("weapon_flashbang", sName, false) && g_cFlash.BoolValue ||
                StrEqual("weapon_smokegrenade", sName, false) && g_cSmoke.BoolValue ||
                StrEqual("weapon_incgrenade", sName, false) && g_cIncGrenade.BoolValue ||
                StrEqual("weapon_molotov", sName, false) && g_cMolotov.BoolValue ||
                StrEqual("weapon_decoy", sName, false) && g_cDecoy.BoolValue)
        {
            int iSequence = GetEntProp(weapon, Prop_Data, "m_nSequence");
            if((GetEngineVersion() == Engine_CSS && iSequence != 5) || (GetEngineVersion() == Engine_CSGO && iSequence != 2))
            {
                SDKHooks_DropWeapon(client, weapon);
                return Plugin_Handled;
            }
        }
        
    }
    return Plugin_Continue;
    
}
Thanks in advance..

Last edited by Dom72; 06-22-2015 at 13:25.
Dom72 is offline
DJ Data
SourceMod Donor
Join Date: Dec 2012
Location: Switzerland
Old 06-19-2015 , 12:47   Re: [REQ][CSGO]Help me to add code in script please
Reply With Quote #2

I would have helped if it didnt use the new Syntax.. still dont get why SM had to do this.. -.-
__________________
SourcePawn Coding Level: Novice
DJ Data is offline
Dom72
Junior Member
Join Date: Aug 2014
Old 06-22-2015 , 09:51   Re: [REQ][CSGO]Help me to add code in script please
Reply With Quote #3

Anyone to help me please? :=)
Dom72 is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 06-22-2015 , 09:58   Re: [REQ][CSGO]Help me to add code in script please
Reply With Quote #4

Quote:
Originally Posted by Dom72 View Post
Anyone to help me please? :=)
Disobeying the AlliedModders Rules does not help you to a more speedy response:

Quote:
Do not "bump" your threads. Bumping is posting simply to make the thread higher in the forum sort order.
...If someone knows how to do what you want, they will return to you when they have the time for it.

Your title, "[REQ][CSGO]Help me to add code in script please", does not really attract people either.

You should use DESCRIPTIVE TITLES, so people know if it is something they may be able to help with not BEFORE they click on your thread.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
Dom72
Junior Member
Join Date: Aug 2014
Old 06-22-2015 , 13:22   Re: [REQ][CSGO]Help me to add code in script please
Reply With Quote #5

I'm so confused, i do no realize that..

Thank you for telling me arne1288, and next time I'd be careful about that..

Again sorry.
Dom72 is offline
Dom72
Junior Member
Join Date: Aug 2014
Old 07-02-2015 , 23:40   Re: [REQ][CSGO] Add timer to block drop item during buy
Reply With Quote #6

The solution is with CreateTimer, but i do no how to use the syntax..


Edit: problem solved...

Last edited by Dom72; 07-07-2015 at 05:18.
Dom72 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 05:15.


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