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

[vip menu plugin]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lemmon_cs
Member
Join Date: Jan 2019
Location: Romania
Old 10-20-2020 , 12:06   [vip menu plugin]
Reply With Quote #1

I want a plugin for vip , a gunmenu like this
flag needed CUSTOM1 , can be opened only on 3th round and the menu guns are AWP , AK , M4A4 , once you selected a weapon from menu you can't open the menu until the next round starts , and a chat message "You used VIP menu this round" , and for nonvip users chat message "You are not vip" and "This menu can be oppened only on 3th round" , thanks
lemmon_cs is offline
SSheriFF
AlliedModders Donor
Join Date: May 2020
Location: Israel
Old 10-20-2020 , 14:25   Re: [vip menu plugin]
Reply With Quote #2

Quote:
Originally Posted by lemmon_cs View Post
I want a plugin for vip , a gunmenu like this
flag needed CUSTOM1 , can be opened only on 3th round and the menu guns are AWP , AK , M4A4 , once you selected a weapon from menu you can't open the menu until the next round starts , and a chat message "You used VIP menu this round" , and for nonvip users chat message "You are not vip" and "This menu can be oppened only on 3th round" , thanks
PHP Code:
#pragma semicolon 1

#define DEBUG

#include <sourcemod>
#include <sdktools>

#pragma newdecls required
int g_iRounds 0;
bool g_bAlreadyUsed[MAXPLAYERS 1] =  { false };
public 
Plugin myinfo 
{
    
name "VIP Gun Menu",
    
author "SheriF",
    
description "",
    
version "1.0",
    
url ""
};

public 
void OnPluginStart()
{
    
HookEvent("round_start"OnRoundStart);
    
RegAdminCmd("sm_vipguns"Command_VIPADMFLAG_CUSTOM1);
}
public 
void OnMapEnd()
{
    
g_iRounds 0;
}
public 
Action OnRoundStart(Event eventchar[] namebool dontBroadcast)
{
    
g_iRounds++;
    for(
int i 1<= MaxClients;i++)
    {
        if(
IsClientInGame(i)&&!IsFakeClient(i))
            
g_bAlreadyUsed[i] = false;
    }    
}
public 
Action Command_VIP(int clientint args)
{
    if(
IsClientInGame(client) && !IsFakeClient(client))
    {
        if(
g_iRounds<3)
            
PrintToChat(client"This menu can be oppened only on 3th round");
        else if(!
IsPlayerAlive(client))
            
PrintToChat(client"This menu can be oppened only when you are alive");
        else if(
g_bAlreadyUsed[client])
            
PrintToChat(client"You used VIP menu this round");
        else
        {
            
g_bAlreadyUsed[client] = true;
            
VIPMenu(client);
        }
    }
}
void VIPMenu(int client)
{
    
Menu menu = new Menu(menuHandler_VipMenu);
    
menu.SetTitle("Choose a weapon");
    
menu.AddItem("weapon_awp","Awp");
    
menu.AddItem("weapon_ak47","Ak47");
    
menu.AddItem("weapon_m4a1","M4A4");
    
menu.ExitButton true;
    
menu.Display(clientMENU_TIME_FOREVER);
}
public 
int menuHandler_VipMenu(Menu menuMenuAction actionint clientint itemNUM)
{
    if (
action == MenuAction_Select)
    {
        
char sWeapon[32];
        
menu.GetItem(itemNUMsWeaponsizeof(sWeapon));
        
GivePlayerItem(clientsWeapon);
        if(
StrContains(sWeapon,"m4a1")!=-1)
            
PrintToChat(client"You got a M4A4");
        else
            
PrintToChat(client"You got an A%s"sWeapon[8]);
    }

__________________
Taking small private requests (Free) and big private requests (Paid).
Contact me via Discord: WilDick#1524

My Plugins:
SSheriFF is offline
lemmon_cs
Member
Join Date: Jan 2019
Location: Romania
Old 10-20-2020 , 15:03   Re: [vip menu plugin]
Reply With Quote #3

One problem , if i open the menu and then close it without choosing a weapon i can't open it again and it says i already chose a weapon , i want the open to be open as many times as you want , only when you select and get a weapon you can't open it again and the message popup in chat
lemmon_cs is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 10-21-2020 , 01:57   Re: [vip menu plugin]
Reply With Quote #4

Code:
#pragma semicolon 1

#define DEBUG

#include <sourcemod>
#include <sdktools>

#pragma newdecls required
int g_iRounds = 0;
bool g_bAlreadyUsed[MAXPLAYERS + 1] =  { false };
public Plugin myinfo = 
{
    name = "VIP Gun Menu",
    author = "SheriF",
    description = "",
    version = "1.0",
    url = ""
};

public void OnPluginStart()
{
    HookEvent("round_start", OnRoundStart);
    RegAdminCmd("sm_vipguns", Command_VIP, ADMFLAG_CUSTOM1);
}
public void OnMapEnd()
{
    g_iRounds = 0;
}
public Action OnRoundStart(Event event, char[] name, bool dontBroadcast)
{
    g_iRounds++;
    for(int i = 1; i <= MaxClients;i++)
    {
        if(IsClientInGame(i)&&!IsFakeClient(i))
            g_bAlreadyUsed[i] = false;
    }    
}
public Action Command_VIP(int client, int args)
{
    if(IsClientInGame(client) && !IsFakeClient(client))
    {
        if(g_iRounds<3)
            PrintToChat(client, "This menu can be oppened only on 3th round");
        else if(!IsPlayerAlive(client))
            PrintToChat(client, "This menu can be oppened only when you are alive");
        else if(g_bAlreadyUsed[client])
            PrintToChat(client, "You used VIP menu this round");
        else
            VIPMenu(client);
    }
}
void VIPMenu(int client)
{
    Menu menu = new Menu(menuHandler_VipMenu);
    menu.SetTitle("Choose a weapon");
    menu.AddItem("weapon_awp","Awp");
    menu.AddItem("weapon_ak47","Ak47");
    menu.AddItem("weapon_m4a1","M4A4");
    menu.ExitButton = true;
    menu.Display(client, MENU_TIME_FOREVER);
}
public int menuHandler_VipMenu(Menu menu, MenuAction action, int client, int itemNUM)
{
    if (action == MenuAction_Select)
    {
        char sWeapon[32];
        menu.GetItem(itemNUM, sWeapon, sizeof(sWeapon));
        GivePlayerItem(client, sWeapon);
        if(StrContains(sWeapon,"m4a1")!=-1)
            PrintToChat(client, "You got a M4A4");
        else
            PrintToChat(client, "You got an A%s", sWeapon[8]);
        g_bAlreadyUsed[client] = true;
    }
}
You can just move the g_bAlreadyUsed[client] = true; to the menu callback then.
Drixevel is offline
lemmon_cs
Member
Join Date: Jan 2019
Location: Romania
Old 10-21-2020 , 14:42   Re: [vip menu plugin]
Reply With Quote #5

Now it's ok , but i have one more problem , works only on first half , on second half i can open the vipmenu from pistol round , not from 3 round , you can get weapon on pistol round from second half

Last edited by lemmon_cs; 10-22-2020 at 03:58.
lemmon_cs 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 13:12.


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