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

[L4D2]MeleeWeaponsMenu for 2.0.3.1


Post New Thread Reply   
 
Thread Tools Display Modes
dani1341
BANNED
Join Date: Feb 2010
Old 07-04-2010 , 12:48   Re: [L4D2]Melee Weapons Menu
Reply With Quote #21

thanks i didnt knew that sorry for that but i want that the plugin stays private
dani1341 is offline
Bishop_erotic
Member
Join Date: Jun 2010
Old 07-04-2010 , 14:02   Re: Please remove :)
Reply With Quote #22

I dont know why u want it You using plugins others but yours plugins no
Bishop_erotic is offline
psychonic

BAFFLED
Join Date: May 2008
Old 07-04-2010 , 14:34   Re: Please remove :)
Reply With Quote #23

The deleted code:
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_VERSION "1.6"

new Handle:cvar_maxweaponstotal INVALID_HANDLE;
new 
Handle:cvar_maxweaponsclient INVALID_HANDLE;
new 
numweaponstotal;
new 
numweaponsclient[MAXPLAYERS 1];

public 
Plugin:myinfo 
{
    
name "[L4D2] Melee Wepons Menu",
    
author "dani1341",
    
description "Allows Clients To Get Melee Weapons From The Melee Weapon Menu",
    
version PLUGIN_VERSION,
    
url ""
}

public 
OnPluginStart()
{
    
//melee weapons menu cvar
    
RegConsoleCmd("melee"MeleeMenu);
    
//plugin version
    
CreateConVar("melee_version"PLUGIN_VERSION"L4D 2 Melee Weapons Menu version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FC VAR_NOTIFY);

    
cvar_maxweaponstotal CreateConVar("melee_max""40""How much times all players can get melee weapons per map"FCVAR_PLUGIN|FCVAR_NOTIFY);
    
cvar_maxweaponsclient CreateConVar("melee_playermax""10""How much times one player can get melee weapons"FCVAR_PLUGIN|FCVAR_NOTIFY);

    
HookEvent("round_end"Event_RoundEnd);
    
//autoexec
    
AutoExecConfig(true"l4d2_melee");
}

public 
OnMapStart()
{
    
numweaponstotal 0;
    for(new 
1<= MAXPLAYERSi++)
        
numweaponsclient[i] = 0;
}

public 
Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    
numweaponstotal 0;
    for(new 
1<= MAXPLAYERSi++)
        
numweaponsclient[i] = 0;
}

public 
OnClientPostAdminCheck(client)
{
    for(new 
1<= MAXPLAYERSi++)
        
numweaponsclient[i] = 0;
}

public 
Action:MeleeMenu(client,args)
{
    if(!
client || !IsClientInGame(client)) 
        return 
Plugin_Handled;

    if(
GetClientTeam(client) != 2)
    {
        
PrintToChat(client"Melee Weapons Menu is only available to survivors.");
        return 
Plugin_Handled;
    }

    if(
numweaponstotal >= GetConVarInt(cvar_maxweaponstotal)) 
    {
        
PrintToChat(client"Limit of %i total melee weapons for this map has been reached."GetConVarInt(cvar_maxweaponstotal));
        return 
Plugin_Handled;
    }

    if(
numweaponsclient[client] >= GetConVarInt(cvar_maxweaponsclient)) 
    {
        
PrintToChat(client"You have reached your limit of %i for this map."GetConVarInt(cvar_maxweaponsclient));
        return 
Plugin_Handled;
    }

    
Melee(client);

    return 
Plugin_Handled;
}

public 
Action:Melee(clientId)
{
    new 
Handle:menu CreateMenu(MeleeMenuHandler);
    
SetMenuTitle(menu"Melee Weapons Menu");
    
AddMenuItem(menu"option1""Baseball Bat");
    
AddMenuItem(menu"option2""Crowbar");
    
AddMenuItem(menu"option3""Cricket Bat");
    
AddMenuItem(menu"option4""Electric Guitar");
    
AddMenuItem(menu"option5""Fire Axe");
    
AddMenuItem(menu"option6""Frying Pan");
    
AddMenuItem(menu"option7""Golf Club");
    
AddMenuItem(menu"option8""Katana");
    
AddMenuItem(menu"option9""Knife");
    
AddMenuItem(menu"option10""Machete");
    
AddMenuItem(menu"option11""Magnum");
    
AddMenuItem(menu"option12""Night Stick");
    
AddMenuItem(menu"option13""Pistol");
    
AddMenuItem(menu"option14""Riot Shield");
    
SetMenuExitButton(menutrue);
    
DisplayMenu(menuclientIdMENU_TIME_FOREVER);

    return 
Plugin_Handled;
}

public 
MeleeMenuHandler(Handle:menuMenuAction:actionclientitemNum)
{
    
//Strip the CHEAT flag off of the "give" command
    
new flags GetCommandFlags("give");
    
SetCommandFlags("give"flags & ~FCVAR_CHEAT);

    if ( 
action == MenuAction_Select ) {

        switch (
itemNum)
        {
            case 
0//Baseball Bat
            
{
                
//Give the player a Baseball Bat
                
FakeClientCommand(client"give baseball_bat");
            }
            case 
1//Crowbar
            
{
                
//Give the player a Crowbar
                
FakeClientCommand(client"give crowbar");
            }
            case 
2//Cricket Bat
            
{
                
//Give the player a Cricket Bat
                
FakeClientCommand(client"give cricket_bat");
            }
            case 
3//Electric Guitar
            
{
                
//Give the player a Electric Guitar
                
FakeClientCommand(client"give electric_guitar");
            }
            case 
4//Fire Axe
            
{
                
//Give the player a Fire Axe
                
FakeClientCommand(client"give fireaxe");
            }
            case 
5//Frying Pan
            
{
                
//Give the player a Frying Pan
                
FakeClientCommand(client"give frying_pan");
            }
            case 
6//Golf Club
            
{
                
//Give the player a Golf Club
                
FakeClientCommand(client"give golfclub");
            }
            case 
7//Katana
            
{
                
//Give the player a Katana
                
FakeClientCommand(client"give katana");
            }
            case 
8//Knife
            
{
                
//Give the player a Knife
                
FakeClientCommand(client"give knife");
            }
            case 
9//Machete
            
{
                
//Give the player a Machete
                
FakeClientCommand(client"give machete");
            }
            case 
10//Magnum
            
{
                
//Give the player a Magnum
                
FakeClientCommand(client"give pistol_magnum");
            }
            case 
11//Night Stick
            
{
                
//Give the player a Night Stick
                
FakeClientCommand(client"give tonfa");
            }
            case 
12//Pistol
            
{
                
//Give the player a Pistol
                
FakeClientCommand(client"give pistol");
            }
            case 
13//Riot Shield
            
{
                
//Give the player a Riot Shield
                
FakeClientCommand(client"give riotshield");
            }
        }
        
numweaponstotal++;
        
numweaponsclient[client]++;
    }

    
//Add the CHEAT flag back to "give" command
    
SetCommandFlags("give"flags|FCVAR_CHEAT);

psychonic is offline
YoniZ[ZSC]
Member
Join Date: Jul 2010
Old 09-21-2010 , 00:57   Re: [L4D2]MeleeWeaponsMenu for 2.0.3.1
Reply With Quote #24

hello can u update this pak file plz
YoniZ[ZSC] is offline
dustinandband
Senior Member
Join Date: May 2015
Old 07-14-2018 , 17:45   Re: Please remove :)
Reply With Quote #25

Quote:
Originally Posted by psychonic View Post
The deleted code:
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_VERSION "1.6"

new Handle:cvar_maxweaponstotal INVALID_HANDLE;
new 
Handle:cvar_maxweaponsclient INVALID_HANDLE;
new 
numweaponstotal;
new 
numweaponsclient[MAXPLAYERS 1];

public 
Plugin:myinfo 
{
    
name "[L4D2] Melee Wepons Menu",
    
author "dani1341",
    
description "Allows Clients To Get Melee Weapons From The Melee Weapon Menu",
    
version PLUGIN_VERSION,
    
url ""
}

public 
OnPluginStart()
{
    
//melee weapons menu cvar
    
RegConsoleCmd("melee"MeleeMenu);
    
//plugin version
    
CreateConVar("melee_version"PLUGIN_VERSION"L4D 2 Melee Weapons Menu version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FC VAR_NOTIFY);

    
cvar_maxweaponstotal CreateConVar("melee_max""40""How much times all players can get melee weapons per map"FCVAR_PLUGIN|FCVAR_NOTIFY);
    
cvar_maxweaponsclient CreateConVar("melee_playermax""10""How much times one player can get melee weapons"FCVAR_PLUGIN|FCVAR_NOTIFY);

    
HookEvent("round_end"Event_RoundEnd);
    
//autoexec
    
AutoExecConfig(true"l4d2_melee");
}

public 
OnMapStart()
{
    
numweaponstotal 0;
    for(new 
1<= MAXPLAYERSi++)
        
numweaponsclient[i] = 0;
}

public 
Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    
numweaponstotal 0;
    for(new 
1<= MAXPLAYERSi++)
        
numweaponsclient[i] = 0;
}

public 
OnClientPostAdminCheck(client)
{
    for(new 
1<= MAXPLAYERSi++)
        
numweaponsclient[i] = 0;
}

public 
Action:MeleeMenu(client,args)
{
    if(!
client || !IsClientInGame(client)) 
        return 
Plugin_Handled;

    if(
GetClientTeam(client) != 2)
    {
        
PrintToChat(client"Melee Weapons Menu is only available to survivors.");
        return 
Plugin_Handled;
    }

    if(
numweaponstotal >= GetConVarInt(cvar_maxweaponstotal)) 
    {
        
PrintToChat(client"Limit of %i total melee weapons for this map has been reached."GetConVarInt(cvar_maxweaponstotal));
        return 
Plugin_Handled;
    }

    if(
numweaponsclient[client] >= GetConVarInt(cvar_maxweaponsclient)) 
    {
        
PrintToChat(client"You have reached your limit of %i for this map."GetConVarInt(cvar_maxweaponsclient));
        return 
Plugin_Handled;
    }

    
Melee(client);

    return 
Plugin_Handled;
}

public 
Action:Melee(clientId)
{
    new 
Handle:menu CreateMenu(MeleeMenuHandler);
    
SetMenuTitle(menu"Melee Weapons Menu");
    
AddMenuItem(menu"option1""Baseball Bat");
    
AddMenuItem(menu"option2""Crowbar");
    
AddMenuItem(menu"option3""Cricket Bat");
    
AddMenuItem(menu"option4""Electric Guitar");
    
AddMenuItem(menu"option5""Fire Axe");
    
AddMenuItem(menu"option6""Frying Pan");
    
AddMenuItem(menu"option7""Golf Club");
    
AddMenuItem(menu"option8""Katana");
    
AddMenuItem(menu"option9""Knife");
    
AddMenuItem(menu"option10""Machete");
    
AddMenuItem(menu"option11""Magnum");
    
AddMenuItem(menu"option12""Night Stick");
    
AddMenuItem(menu"option13""Pistol");
    
AddMenuItem(menu"option14""Riot Shield");
    
SetMenuExitButton(menutrue);
    
DisplayMenu(menuclientIdMENU_TIME_FOREVER);

    return 
Plugin_Handled;
}

public 
MeleeMenuHandler(Handle:menuMenuAction:actionclientitemNum)
{
    
//Strip the CHEAT flag off of the "give" command
    
new flags GetCommandFlags("give");
    
SetCommandFlags("give"flags & ~FCVAR_CHEAT);

    if ( 
action == MenuAction_Select ) {

        switch (
itemNum)
        {
            case 
0//Baseball Bat
            
{
                
//Give the player a Baseball Bat
                
FakeClientCommand(client"give baseball_bat");
            }
            case 
1//Crowbar
            
{
                
//Give the player a Crowbar
                
FakeClientCommand(client"give crowbar");
            }
            case 
2//Cricket Bat
            
{
                
//Give the player a Cricket Bat
                
FakeClientCommand(client"give cricket_bat");
            }
            case 
3//Electric Guitar
            
{
                
//Give the player a Electric Guitar
                
FakeClientCommand(client"give electric_guitar");
            }
            case 
4//Fire Axe
            
{
                
//Give the player a Fire Axe
                
FakeClientCommand(client"give fireaxe");
            }
            case 
5//Frying Pan
            
{
                
//Give the player a Frying Pan
                
FakeClientCommand(client"give frying_pan");
            }
            case 
6//Golf Club
            
{
                
//Give the player a Golf Club
                
FakeClientCommand(client"give golfclub");
            }
            case 
7//Katana
            
{
                
//Give the player a Katana
                
FakeClientCommand(client"give katana");
            }
            case 
8//Knife
            
{
                
//Give the player a Knife
                
FakeClientCommand(client"give knife");
            }
            case 
9//Machete
            
{
                
//Give the player a Machete
                
FakeClientCommand(client"give machete");
            }
            case 
10//Magnum
            
{
                
//Give the player a Magnum
                
FakeClientCommand(client"give pistol_magnum");
            }
            case 
11//Night Stick
            
{
                
//Give the player a Night Stick
                
FakeClientCommand(client"give tonfa");
            }
            case 
12//Pistol
            
{
                
//Give the player a Pistol
                
FakeClientCommand(client"give pistol");
            }
            case 
13//Riot Shield
            
{
                
//Give the player a Riot Shield
                
FakeClientCommand(client"give riotshield");
            }
        }
        
numweaponstotal++;
        
numweaponsclient[client]++;
    }

    
//Add the CHEAT flag back to "give" command
    
SetCommandFlags("give"flags|FCVAR_CHEAT);


What's the purpose of this?

PHP Code:
public OnClientPostAdminCheck(client

    for(new 
1<= MAXPLAYERSi++) 
        
numweaponsclient[i] = 0

When one client connects, it resets the melee count for everyone.
So I'm assuming this function wouldn't be too useful after a client fully connects, since everyone's melee count just got reset:

PHP Code:
    if(numweaponsclient[client] >= GetConVarInt(cvar_maxweaponsclient))  
    { 
        
PrintToChat(client"You have reached your limit of %i for this map."GetConVarInt(cvar_maxweaponsclient)); 
        return 
Plugin_Handled
    } 
dustinandband is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-14-2018 , 20:20   Re: [L4D2]MeleeWeaponsMenu for 2.0.3.1
Reply With Quote #26

@dustinandband

8 years later XD

I apologize for bump post.
mug1wara is offline
dmna000000000012
Junior Member
Join Date: Jul 2023
Old 08-03-2023 , 20:39   Re: [L4D2]MeleeWeaponsMenu for 2.0.3.1
Reply With Quote #27

Can someone please fix this plugin the menu doesn't work that well and some of the melee weapons don't spawn like the knife and others
dmna000000000012 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 01:42.


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