Raised This Month: $32 Target: $400
 8% 

[CS:GO] AWP Only - Disable weapons placed on the map & give AWP/KNIFE to the players


Post New Thread Reply   
 
Thread Tools Display Modes
Author
xSLOW
Senior Member
Join Date: Apr 2019
Location: Romania
Plugin ID:
6535
Plugin Version:
1.0
Plugin Category:
Gameplay
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Old 04-22-2019 , 18:58   [CS:GO] AWP Only - Disable weapons placed on the map & give AWP/KNIFE to the players
    Reply With Quote #1

    I NO LONGER SUPPORT THIS PLUGIN, IT HAS BUGS, TRY IT AT YOUR OWN RISK. I WILL UPDATE IT WHEN I HAVE TIME, FOR NOW IT IS A RISK.

    Description:
    * Disable weapons placed on the map, removes all weapons from every player & gives them AWP and KNIFE

    How to install:
    * Download the plugin from github
    * Copy awponly.smx to addons/sourcemod/plugins
    * Change map or restart your server
    * Go to cfg/sourcemod/awponly.cfg and configure the plugin

    Download:
    * Github: https://github.com/xSL0W/csgo_awponly
    * Direct Download: https://github.com/xSL0W/csgo_awponl...ive/master.zip

    Versions:
    * 1.0 - Initial release
    * 1.1 - Added Knife only option for warmup, rewrited conditions with .BoolValue instead of .IntValue, fixed some issues ( Thanks to Effeff, Bara, Cruze )
    __________________
    My community:
    https://elitegamers.ro
    https://www.gametracker.com/search/c...elitegamers.ro

    Contact me, fastest way, through my discord server:
    https://discord.gg/SBHzDGbbgG
    xSLOW#0508

    Last edited by xSLOW; 03-29-2020 at 12:09.
    xSLOW is offline
    TheBOSS
    Member
    Join Date: Nov 2018
    Old 04-23-2019 , 17:45   Re: [CS:GO] AWP Only - Disable weapons placed on the map & give AWP/KNIFE to the play
    Reply With Quote #2

    good idea, thank for share
    TheBOSS is offline
    Effeff
    AlliedModders Donor
    Join Date: Jan 2019
    Location: discord: ff#0533
    Old 05-21-2019 , 00:41   Re: [CS:GO] AWP Only - Disable weapons placed on the map & give AWP/KNIFE to the play
    Reply With Quote #3

    This spawns weapons on Event_PlayerSpawn, which occurs when a player joins a team. It does not check if the player successfully spawns. This does not matter, unless you don't allow players to spawn mid-round. If that is true, then whenever players join the server it spawns weapons after they join a team even though they aren't alive.

    I changed two functions to add a 0.1 second timer so the player can spawn first before it gives them weapons. Without the timer, it will not spawn anything because the player will not be alive. If someone has a better way of doing this I'm interested

    PHP Code:
    public void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
    {
        if(
    EnablePlugin.IntValue == 1)
            
    CreateTimer(0.1SetWeaponsGetClientOfUserId(GetEventInt(event"userid")));
    }

    public 
    Action:SetWeapons(Handle:timerany:client)
    {
        if(
    IsClientValid(client) && IsPlayerAlive(client))
        {
            
    Client_RemoveAllWeapons(client""true);
            
    GivePlayerItem(client"weapon_awp");
            
    GivePlayerItem(client"weapon_knife");
        }

    Effeff is offline
    Cruze
    Veteran Member
    Join Date: May 2017
    Old 05-21-2019 , 03:41   Re: [CS:GO] AWP Only - Disable weapons placed on the map & give AWP/KNIFE to the play
    Reply With Quote #4

    PHP Code:
    public void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast

        if(
    EnablePlugin.IntValue == 1
            
    RequestFrame(SetWeaponsGetClientOfUserId(GetEventInt(event"userid")));


    public 
    void SetWeapons(any client

        if(
    IsClientValid(client) && IsPlayerAlive(client)) 
        { 
            
    Client_RemoveAllWeapons(client""true); 
            
    GivePlayerItem(client"weapon_awp"); 
            
    GivePlayerItem(client"weapon_knife"); 
        } 

    __________________
    Taking paid private requests! Contact me

    Last edited by Cruze; 05-21-2019 at 03:42.
    Cruze is offline
    Effeff
    AlliedModders Donor
    Join Date: Jan 2019
    Location: discord: ff#0533
    Old 05-21-2019 , 04:48   Re: [CS:GO] AWP Only - Disable weapons placed on the map & give AWP/KNIFE to the play
    Reply With Quote #5

    Thank you Cruze that's much better than what I did

    I'm not sure if it matters but xSLOW had it as SetWeapons(int client) instead of any client. I just changed it to any client after looking at an example of how to use handles/timers.

    Last edited by Effeff; 05-21-2019 at 04:53.
    Effeff is offline
    xSLOW
    Senior Member
    Join Date: Apr 2019
    Location: Romania
    Old 05-21-2019 , 17:21   Re: [CS:GO] AWP Only - Disable weapons placed on the map & give AWP/KNIFE to the play
    Reply With Quote #6

    Thanks for helping me to improve this plugin. I will update the plugin tomorrow with the new modifications
    __________________
    My community:
    https://elitegamers.ro
    https://www.gametracker.com/search/c...elitegamers.ro

    Contact me, fastest way, through my discord server:
    https://discord.gg/SBHzDGbbgG
    xSLOW#0508
    xSLOW is offline
    Bara
    AlliedModders Donor
    Join Date: Apr 2012
    Location: Germany
    Old 05-21-2019 , 18:02   Re: [CS:GO] AWP Only - Disable weapons placed on the map & give AWP/KNIFE to the play
    Reply With Quote #7

    Maybe instead of
    Code:
    if (EnablePlugin.IntValue == 1)
    you could use BoolValue
    Code:
    if (EnablePlugin.BoolValue)
    __________________
    Discord (Bara#5006) | My Plugins (GitHub)
    You like my work? Support is not a crime.
    Bara is offline
    Effeff
    AlliedModders Donor
    Join Date: Jan 2019
    Location: discord: ff#0533
    Old 05-22-2019 , 00:18   Re: [CS:GO] AWP Only - Disable weapons placed on the map & give AWP/KNIFE to the play
    Reply With Quote #8

    I just noticed the changes suggested (checking if player is alive before spawning awps) prevents players from instantly scoping when they spawn.

    Until there is another way to fix the problem, I'm using the original version (the players on my server were complaining to me about this change and I agree it actually matters for some of the maps we use)

    Last edited by Effeff; 05-22-2019 at 00:18.
    Effeff is offline
    eyal282
    Veteran Member
    Join Date: Aug 2011
    Old 05-22-2019 , 00:58   Re: [CS:GO] AWP Only - Disable weapons placed on the map & give AWP/KNIFE to the play
    Reply With Quote #9

    Quote:
    Originally Posted by Effeff View Post
    This spawns weapons on Event_PlayerSpawn, which occurs when a player joins a team. It does not check if the player successfully spawns. This does not matter, unless you don't allow players to spawn mid-round. If that is true, then whenever players join the server it spawns weapons after they join a team even though they aren't alive.

    I changed two functions to add a 0.1 second timer so the player can spawn first before it gives them weapons. Without the timer, it will not spawn anything because the player will not be alive. If someone has a better way of doing this I'm interested

    PHP Code:
    public void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
    {
        if(
    EnablePlugin.IntValue == 1)
            
    CreateTimer(0.1SetWeaponsGetClientOfUserId(GetEventInt(event"userid")));
    }

    public 
    Action:SetWeapons(Handle:timerany:client)
    {
        if(
    IsClientValid(client) && IsPlayerAlive(client))
        {
            
    Client_RemoveAllWeapons(client""true);
            
    GivePlayerItem(client"weapon_awp");
            
    GivePlayerItem(client"weapon_knife");
        }


    This isn't CS 1.6, I've never even seen an error on my plugins that don't check if the player is alive, some of them are 5k lines long.
    __________________
    I am available to make plugins for pay.

    Discord: Eyal282#1334
    eyal282 is offline
    Effeff
    AlliedModders Donor
    Join Date: Jan 2019
    Location: discord: ff#0533
    Old 05-22-2019 , 01:10   Re: [CS:GO] AWP Only - Disable weapons placed on the map & give AWP/KNIFE to the play
    Reply With Quote #10

    Quote:
    Originally Posted by eyal282 View Post
    This isn't CS 1.6, I've never even seen an error on my plugins that don't check if the player is alive, some of them are 5k lines long.
    I did not say there is an error, I described a side-effect of the plugin as is and offered a solution to that side-effect. Then the person below me offered a better solution (although both of those have a different side-effect that resulted in me using the original plugin still).

    Anyway, I think another way to do what this plugin would is doing would be with SDKHook_WeaponCanUse, similar to what is shown here, and that might solve the problem I had above actually. I'm going to try that.
    Effeff 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 14:54.


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