Raised This Month: $318 Target: $400
 79%   Almost there!

[CSGO] Buy Riot Shields for comp/community


Post New Thread Reply   
 
Thread Tools Display Modes
Author
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Plugin ID:
6561
Plugin Version:
Plugin Category:
Gameplay
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Allow Players to Buy new Riot Shields
    Old 05-07-2019 , 18:56   [CSGO] Buy Riot Shields for comp/community
    Reply With Quote #1

    This Plugin Allow Players to Buy new Riot Shields for $5000 by typing !buyshield in chat.

    *Updated to version 1.2.





    Change Log:
    v1.2 - Fixed an issue reported by wolvez04.
    v1.1 - Adding only buying in spawn zone & mp_buytime.
    Attached Files
    File Type: sp Get Plugin or Get Source (buyshield_v1.2.sp - 1448 views - 2.2 KB)

    Last edited by backwards; 05-11-2019 at 09:16.
    backwards is offline
    TheDS1337
    Veteran Member
    Join Date: Jun 2012
    Old 05-07-2019 , 19:16   Re: [CSGO] Buy Riot Shields for comp/community
    Reply With Quote #2

    You got it working, nice!

    PS: was it just after today's little update that it worked? because I tried the same before and it didn't.

    Last edited by TheDS1337; 05-07-2019 at 19:17.
    TheDS1337 is offline
    backwards
    AlliedModders Donor
    Join Date: Feb 2014
    Location: USA
    Old 05-07-2019 , 20:26   Re: [CSGO] Buy Riot Shields for comp/community
    Reply With Quote #3

    Quote:
    Originally Posted by TheDS1337 View Post
    You got it working, nice!

    PS: was it just after today's little update that it worked? because I tried the same before and it didn't.
    They enabled it with the update, I never figured out why it wasn't working prior. I speculate the entity wasn't fully embeded into the game yet although the entity type existed.
    backwards is offline
    wolvez04
    Senior Member
    Join Date: Feb 2016
    Location: Andora
    Old 05-09-2019 , 04:51   Re: [CSGO] Buy Riot Shields for comp/community
    Reply With Quote #4

    Seems to be a bug when dropping your shield which can crash the server

    When you drop your shield it still shows in your inventory but glitching out. Tried to pickup but couldn't and within seconds crash
    CLagCompensationManager::StartLagCompensation with NULL CUserCmd!!!
    __________________
    Hiring developers of all sorts for small or big jobs.
    Paying nicely. Just PM for any available jobs.


    Last edited by wolvez04; 05-09-2019 at 04:54.
    wolvez04 is offline
    backwards
    AlliedModders Donor
    Join Date: Feb 2014
    Location: USA
    Old 05-09-2019 , 05:44   Re: [CSGO] Buy Riot Shields for comp/community
    Reply With Quote #5

    Quote:
    Originally Posted by wolvez04 View Post
    Seems to be a bug when dropping your shield which can crash the server

    When you drop your shield it still shows in your inventory but glitching out. Tried to pickup but couldn't and within seconds crash
    CLagCompensationManager::StartLagCompensation with NULL CUserCmd!!!
    Thanks for the report, problem resolved in the latest version 1.2.
    backwards is offline
    arcticx2
    Senior Member
    Join Date: Nov 2011
    Old 05-09-2019 , 07:50   Re: [CSGO] Buy Riot Shields for comp/community
    Reply With Quote #6

    Quote:
    Originally Posted by 1337norway View Post
    Thanks for the report, problem resolved in the latest version 1.2.
    small issue : put "ShieldCost" into the text as well ,

    PHP Code:
    PrintToChat(client"Sorry you don't have $5000 to buy the shield."); 
    i changed & i used new syntax

    PHP Code:
    #include <sourcemod>
    #include <sdktools>

    #pragma newdecls required

    public Plugin myinfo =
    {
        
    name "BuyShield",
        
    author "backwards",
        
    description "Allows players to buy shields by typing !buyshield.",
        
    version SOURCEMOD_VERSION,
        
    url "http://www.steamcommunity.com/id/mypassword"
    }

    int ShieldCost 5000
    bool RequireBuyZone 
    true;
    Handle BuyStartRoundTimer;

    public 
    void OnPluginStart()
    {
        
    RegConsoleCmd("sm_buyshield"BuyShieldCMD);
        
    HookEvent("round_prestart"Event_RoundPreStart);
    }

    public 
    Action BuyShieldCMD(int clientint args
    {
        if(
    RequireBuyZone)
        {
            
    bool InBuyZone view_as<bool>(GetEntProp(clientProp_Send"m_bInBuyZone"));
            if(!
    InBuyZone)
            {
                
    PrintToChat(client"Sorry You're Not In a Buy Zone.");
                return 
    Plugin_Handled;
            }
            if (
    BuyStartRoundTimer == null)
            {
                
    PrintToChat(client"The Buy Time Has Expired For This Round.")
                return 
    Plugin_Handled;
            }
        }
        
        
    int account GetEntProp(clientProp_Send"m_iAccount");
        if(
    account ShieldCost)
        {
            
    PrintToChat(client"Sorry you don't have $%i to buy the shield." ShieldCost);
            return 
    Plugin_Handled;
        }
        
        
    int weaponIdx GetPlayerWeaponSlot(client11);
        
        if(
    weaponIdx != -1)
        {
            if(
    IsValidEdict(weaponIdx) && IsValidEntity(weaponIdx))
            {
                
    char className[128];
                
    GetEntityClassname(weaponIdxclassNamesizeof(className));
                
                if(
    StrEqual("weapon_shield"className))
                {
                    
    PrintToChat(client"You are already carrying a shield.");
                    return 
    Plugin_Handled;
                }
            }
        }
        
        
    SetEntProp(clientProp_Send"m_iAccount"account ShieldCost);
        
    GivePlayerItem(client"weapon_shield");
        
    PrintToChat(client"You've bought a shield.");
        
        return 
    Plugin_Handled;
    }

    public 
    void Event_RoundPreStart(Handle eventchar[] namebool dontBroadcast)
    {
        
    float BuyTime 45.0;
        
    ConVar cvarBuyTime FindConVar("mp_buytime");
        
        if(
    cvarBuyTime != null)
            
    BuyTime float(cvarBuyTime.IntValue);
            
        if (
    BuyStartRoundTimer != null)
        {
            
    KillTimer(BuyStartRoundTimer);
            
    BuyStartRoundTimer null;
        }
        
        
    BuyStartRoundTimer CreateTimer(BuyTimeStopBuying);
    }


    public 
    Action StopBuying(Handle timerany client)
    {
        
    BuyStartRoundTimer null;
        
        return 
    Plugin_Stop;

    arcticx2 is offline
    Enrory
    Senior Member
    Join Date: Nov 2016
    Location: Austria
    Old 05-10-2019 , 09:10   Re: [CSGO] Buy Riot Shields for comp/community
    Reply With Quote #7

    Thanks for this
    __________________
    Enrory is offline
    Eren
    Junior Member
    Join Date: Aug 2014
    Old 05-10-2019 , 10:04   Re: [CSGO] Buy Riot Shields for comp/community
    Reply With Quote #8

    How to add more durability to the shield?
    Eren is offline
    NitroN
    New Member
    Join Date: Apr 2019
    Old 05-10-2019 , 10:45   Re: [CSGO] Buy Riot Shields for comp/community
    Reply With Quote #9

    niceeee broooow! 100% work.. ty!
    NitroN is offline
    Ilusion9
    Veteran Member
    Join Date: Jun 2018
    Location: Romania
    Old 05-10-2019 , 12:03   Re: [CSGO] Buy Riot Shields for comp/community
    Reply With Quote #10

    Quote:
    Originally Posted by Eren View Post
    How to add more durability to the shield?
    100% this entity has a netprop called m_iHealth, you can start with this.
    __________________
    Ilusion9 is online now
    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 10:47.


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