Raised This Month: $51 Target: $400
 12% 

knife plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
svas
Junior Member
Join Date: Aug 2016
Location: Turkey
Old 02-12-2020 , 17:59   knife plugin
Reply With Quote #1

Hello friends, I am requesting a plugin from you today. this will be a fun add-on to my dm server if possible.
When I write a / knife, I want everyone to drop their weapons and that all players only have a knife. but since I want this for csdm, there shouldn't be anything like round exchange or restart. so frag should not be spoiled. When I write / knife again, I want a csdm plugin from where it normally resumes.
can this be done if possible?

thanks in advance.

Last edited by svas; 02-13-2020 at 17:56.
svas is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-13-2020 , 08:33   Re: knife plugin
Reply With Quote #2

Google translate can be so aweful. Show us your code you have at the moment arranging these "pause" and "unpause" moments
__________________
Napoleon_be is online now
Send a message via Skype™ to Napoleon_be
svas
Junior Member
Join Date: Aug 2016
Location: Turkey
Old 02-13-2020 , 17:59   Re: knife plugin
Reply With Quote #3

I request that all players' guns fall down and the duel is stabbed by a manager only when /knife is written. But as I said, the plugin must not restart in order for the frag to not change. because i will use this on dm server. I will use it for entertainment purposes. and when a manager writes /knife again, the plugin will close and continue where we left off. If it is possible...
svas is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-14-2020 , 08:46   Re: knife plugin
Reply With Quote #4

Okay so i have the base, i was trying to use get_user_weapons() to give them back afterwards, but i need help with that.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>

#define PLUGIN "Knife Duel"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

new bool:bKnifeEnabled;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /knife""StartKnife");
}

public 
StartKnife(id)
{
    if(
get_user_flags(id) & ADMIN_KICK)
    {
        if(!
bKnifeEnabled)
        {
            new 
iPlayers[32], iNum;
            
get_players(iPlayersiNum"a");
            
            
bKnifeEnabled true;
            
            for(new 
iiNumi++)
            {
                
strip_user_weapons(iPlayers[i]);
                
give_item(iPlayers[i], "weapon_knife");
            }
        }
        else
        {
            
bKnifeEnabled false;
        }
                
    }

__________________
Napoleon_be is online now
Send a message via Skype™ to Napoleon_be
svas
Junior Member
Join Date: Aug 2016
Location: Turkey
Old 02-14-2020 , 14:54   Re: knife plugin
Reply With Quote #5

i dont have any code info. a little bit i know but that is only for edit. thats plugin is not working very well or something of that is missing? get_user_weapons()
svas is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-15-2020 , 06:32   Re: knife plugin
Reply With Quote #6

Quote:
Originally Posted by svas View Post
i dont have any code info. a little bit i know but that is only for edit. thats plugin is not working very well or something of that is missing? get_user_weapons()
What isn't working? Are you using CSDM? If you are, i can simply block the "guns" command when knife is enabled and unblock it when knife is disabled.
__________________
Napoleon_be is online now
Send a message via Skype™ to Napoleon_be
svas
Junior Member
Join Date: Aug 2016
Location: Turkey
Old 02-15-2020 , 07:17   Re: knife plugin
Reply With Quote #7

Quote:
Originally Posted by Napoleon_be View Post
What isn't working? Are you using CSDM? If you are, i can simply block the "guns" command when knife is enabled and unblock it when knife is disabled.
Yes, I use csdm. No, my problem is not disabling the weapons command. Actually, it's a problem, too. But my previous problem is that when I write the command to close it, it doesn't return the guns that I have.
svas is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 02-15-2020 , 10:17   Re: knife plugin
Reply With Quote #8

This should do the trick, got the weapon saving method from this source: https://forums.alliedmods.net/showth...=308166&page=3

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>

#define PLUGIN "Knife Duel"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"

new bool:bKnifeEnabled;

enum WepData
{
    
iWeapons[32],
    
iWepNum
}

new 
eWeapons[33][WepData];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("say /knife""StartKnife");
    
register_clcmd("say guns""CheckKnife");
    
register_clcmd("say /guns""CheckKnife");
    
register_clcmd("say menu""CheckKnife");
    
register_clcmd("say /menu""CheckKnife");
}

public 
StartKnife(id)
{
    if(
get_user_flags(id) & ADMIN_KICK)
    {
        new 
iPlayers[32], iNumiPlayerWeps[32];
        
get_players(iPlayersiNum"a");
        
        if(!
bKnifeEnabled)
        {
            
bKnifeEnabled true;
            
            for(new 
iiNumi++)
            {
                
get_user_weapons(iPlayers[i], iPlayerWepseWeapons[iPlayers[i]][iWepNum]);
                
eWeapons[iPlayers[i]][iWeapons] = iPlayerWeps;
                
strip_user_weapons(iPlayers[i]);
                
give_item(iPlayers[i], "weapon_knife");
            }
        }
        else
        {
            new 
szWeapon[32];
            
            
bKnifeEnabled false;
            
            for(new 
iiNumi++)
            {
                for(new 
iWepiWep eWeapons[iPlayers[i]][iWepNum]; iWep++)
                {
                    
get_weaponname(eWeapons[iPlayers[i]][iWeapons][iWep], szWeaponcharsmax(szWeapon));
                    
give_item(iPlayers[i], szWeapon);
                }
                
eWeapons[iPlayers[i]][iWepNum] = 0;
            }
        }
        
    }
}

public 
CheckKnife(id)
{
    if(
bKnifeEnabled)
    {
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;

__________________

Last edited by Napoleon_be; 02-15-2020 at 10:32.
Napoleon_be is online now
Send a message via Skype™ to Napoleon_be
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 09:49.


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