Перейти к содержимому


Фотография

Меню Выбора Оружия


  • Авторизуйтесь для ответа в теме
Сообщений в теме: 5

#1 Medusa

Medusa

    Пользователь

  • Пользователь
  • PipPipPip
  • 196 сообщений

Отправлено 06 Август 2015 - 18:00

Всем, Привет может кто подскажет каким плагином можно выбирать оружия в L4D?


  • RaymondNor это нравится

#2 sos crazy89

sos crazy89

    Участник

  • Пользователь
  • PipPip
  • 118 сообщений

Отправлено 06 Август 2015 - 18:22

https://forums.allie...ead.php?t=86955



#3 AlexMy

AlexMy

    Постоянный пользователь

  • Пользователь
  • PipPipPipPipPip
  • 1 037 сообщений

Отправлено 07 Август 2015 - 17:41

/* Ссылка удалена */


Сообщение отредактировал onotole: 07 Август 2015 - 18:58
Нет исходника


#4 Profanuch

Profanuch

    Пользователь

  • Пользователь
  • PipPipPip
  • 158 сообщений

Отправлено 24 Август 2024 - 11:36

/***************GUNS***************
] give ammo - not included
] give autoshotgun
] give first_aid_kit - not included
] give health - not included
] give pipe_bomb
] give molotov
] give rifle
] give smg
] give hunting_rifle
] give pain_pills
] give pistol
] give pumpshotgun
************END LIST***************/

#pragma semicolon 1
#include <sourcemod>

public Plugin:myinfo = 
{
    name = "Vip Menu",
    author = "Histroy_Maker",
    description = "Allows Vips To Get Weapons From The Vip Menu",
    version = "1.0",
    url = ""
}

public OnPluginStart()
{
	RegAdminCmd("sm_vip", VipMenu, ADMFLAG_RESERVATION, "Displays the vipbuster menu");
	
	HookEvent("round_end",      Event_RoundEnd);
	HookEvent("map_transition", Event_RoundEnd);
}

public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
{
    for(int i=1; i<=MaxClients; i++) if(IsClientInGame(i)) SetEntProp(i, Prop_Send, "m_upgradeBitVec", 0, 4);
}


public Action:VipMenu(client,args)
{
	if(client) VipBuster(client);
	return Plugin_Handled;
}

public Action:VipBuster(clientId) {
    new Handle:menu = CreateMenu(VipMenuHandler);
    SetMenuTitle(menu, "Vip Меню");
    AddMenuItem(menu, "option1", "Дробовик(8)");
    SetMenuExitButton(menu, true);
    DisplayMenu(menu, clientId, MENU_TIME_FOREVER);
    
    return Plugin_Handled;
}

public VipMenuHandler(Handle:menu, MenuAction:action, client, itemNum)
{
    //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: //shotgun
            {
                //Give the player a shotgun
                FakeClientCommand(client, "give pumpshotgun");
            }
        }
    }

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

Есть такой код. Сейчас, если игроки им пользуются, могут неограниченное количество предметов сделать, вплоть до такой степени, что сервер ляжет. Вопрос такой, можно как-то ограничить количество получаемых предметов? Например, максимум 5 помповых ружьев за одну карту (именно карту, а не кампанию).



#5 Slaven555

Slaven555

    Постоянный пользователь

  • Пользователь
  • PipPipPipPipPip
  • 557 сообщений

Отправлено 24 Август 2024 - 16:39

Есть такой код. Сейчас, если игроки им пользуются, могут неограниченное количество предметов сделать, вплоть до такой степени, что сервер ляжет. Вопрос такой, можно как-то ограничить количество получаемых предметов? Например, максимум 5 помповых ружьев за одну карту (именно карту, а не кампанию).

попробуй. вытащил с другога плагина.

 

/***************GUNS***************
] give ammo - not included
] give autoshotgun
] give first_aid_kit - not included
] give health - not included
] give pipe_bomb
] give molotov
] give rifle
] give smg
] give hunting_rifle
] give pain_pills
] give pistol
] give pumpshotgun
************END LIST***************/

#pragma semicolon 1
#include <sourcemod>
#include <colors>

Handle g_max_give[7];
int max_give[46];
int give_quota0[MAXPLAYERS + 1];

public Plugin myinfo = 
{
    name = "Vip Menu"
    author = "Histroy_Maker"
    description = "Allows Vips To Get Weapons From The Vip Menu"
    version = "1.0"
    url = ""
}

public void OnPluginStart()
{
    RegAdminCmd("sm_vip", VipMenu, ADMFLAG_RESERVATION, "Displays the vipbuster menu");
    
    g_max_give[0] = CreateConVar("sm_quota_pumpshotgun", "5", " Quota Given to each player for obtaining sniper_scout in each round ( -1 = unlimited 0 = disabled )");
    
    HookEvent("round_end", Event_RoundEnd);
    HookEvent("map_transition", Event_RoundEnd);
    HookEvent("round_start", Event_round_start);
}

public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
{
    for (int i = 1; i <= MaxClients; i++)if (IsClientInGame(i))SetEntProp(i, Prop_Send, "m_upgradeBitVec", 0, 4);
}

public void Event_round_start(Event event, const char[] name, bool dontBroadcast)
{
    int maxclients = MaxClients;
    
    max_give[0] = GetConVarInt(g_max_give[0]);
    
    for (int client = 1; client <= maxclients; client++)
    {
        give_quota0[client] = max_give[0];
    }
}

public void OnClientPutInServer(int client)
{
    max_give[0] = GetConVarInt(g_max_give[0]);
    
    give_quota0[client] = max_give[0];
}

public Action VipMenu(int client, int args)
{
    if (client)VipBuster(client);
    return Plugin_Handled;
}

public Action VipBuster(int clientId) {
    Menu menu = CreateMenu(VipMenuHandler);
    SetMenuTitle(menu, "Vip Меню");
    AddMenuItem(menu, "option1", "Дробовик(8)");
    SetMenuExitButton(menu, true);
    DisplayMenu(menu, clientId, MENU_TIME_FOREVER);
    
    return Plugin_Handled;
}

public int VipMenuHandler(Menu menu, MenuAction action, int client, int itemNum)
{
    //Strip the CHEAT flag off of the "give" command
    int flags = GetCommandFlags("give");
    SetCommandFlags("give", flags & ~FCVAR_CHEAT);
    
    if (action == MenuAction_Select) {
        
        switch (itemNum)
        {
            case 0: //shotgun
            {
                if (give_quota0[client] > 0 || give_quota0[client] < 0)
                {
                    //Give the player a shotgun
                    FakeClientCommand(client, "give pumpshotgun");
                    give_quota0[client]--;
                    if (give_quota0[client] > 0)
                    {
                        CPrintToChat(client, "\x04[SM] {blue}Текущий лимит на оружие: {olive}%d/1", give_quota0[client]);
                    }
                    else if (give_quota0[client] == 0)
                    {
                        CPrintToChat(client, "\x04[SM] {blue}Вы достигли лимита на оружие: {olive}1/1");
                    }
                }
                else
                {
                    CPrintToChat(client, "\x04[SM] {olive}Оружие будет доступно в следующем раунде");
                }
            }
        }
    }
    
    //Add the CHEAT flag back to "give" command
    SetCommandFlags("give", flags | FCVAR_CHEAT);
    return 0;
}



#6 Profanuch

Profanuch

    Пользователь

  • Пользователь
  • PipPipPip
  • 158 сообщений

Отправлено 24 Август 2024 - 19:30

 

Есть такой код. Сейчас, если игроки им пользуются, могут неограниченное количество предметов сделать, вплоть до такой степени, что сервер ляжет. Вопрос такой, можно как-то ограничить количество получаемых предметов? Например, максимум 5 помповых ружьев за одну карту (именно карту, а не кампанию).

попробуй. вытащил с другога плагина.

 

/***************GUNS***************
] give ammo - not included
] give autoshotgun
] give first_aid_kit - not included
] give health - not included
] give pipe_bomb
] give molotov
] give rifle
] give smg
] give hunting_rifle
] give pain_pills
] give pistol
] give pumpshotgun
************END LIST***************/

#pragma semicolon 1
#include <sourcemod>
#include <colors>

Handle g_max_give[7];
int max_give[46];
int give_quota0[MAXPLAYERS + 1];

public Plugin myinfo = 
{
    name = "Vip Menu"
    author = "Histroy_Maker"
    description = "Allows Vips To Get Weapons From The Vip Menu"
    version = "1.0"
    url = ""
}

public void OnPluginStart()
{
    RegAdminCmd("sm_vip", VipMenu, ADMFLAG_RESERVATION, "Displays the vipbuster menu");
    
    g_max_give[0] = CreateConVar("sm_quota_pumpshotgun", "5", " Quota Given to each player for obtaining sniper_scout in each round ( -1 = unlimited 0 = disabled )");
    
    HookEvent("round_end", Event_RoundEnd);
    HookEvent("map_transition", Event_RoundEnd);
    HookEvent("round_start", Event_round_start);
}

public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
{
    for (int i = 1; i <= MaxClients; i++)if (IsClientInGame(i))SetEntProp(i, Prop_Send, "m_upgradeBitVec", 0, 4);
}

public void Event_round_start(Event event, const char[] name, bool dontBroadcast)
{
    int maxclients = MaxClients;
    
    max_give[0] = GetConVarInt(g_max_give[0]);
    
    for (int client = 1; client <= maxclients; client++)
    {
        give_quota0[client] = max_give[0];
    }
}

public void OnClientPutInServer(int client)
{
    max_give[0] = GetConVarInt(g_max_give[0]);
    
    give_quota0[client] = max_give[0];
}

public Action VipMenu(int client, int args)
{
    if (client)VipBuster(client);
    return Plugin_Handled;
}

public Action VipBuster(int clientId) {
    Menu menu = CreateMenu(VipMenuHandler);
    SetMenuTitle(menu, "Vip Меню");
    AddMenuItem(menu, "option1", "Дробовик(8)");
    SetMenuExitButton(menu, true);
    DisplayMenu(menu, clientId, MENU_TIME_FOREVER);
    
    return Plugin_Handled;
}

public int VipMenuHandler(Menu menu, MenuAction action, int client, int itemNum)
{
    //Strip the CHEAT flag off of the "give" command
    int flags = GetCommandFlags("give");
    SetCommandFlags("give", flags & ~FCVAR_CHEAT);
    
    if (action == MenuAction_Select) {
        
        switch (itemNum)
        {
            case 0: //shotgun
            {
                if (give_quota0[client] > 0 || give_quota0[client] < 0)
                {
                    //Give the player a shotgun
                    FakeClientCommand(client, "give pumpshotgun");
                    give_quota0[client]--;
                    if (give_quota0[client] > 0)
                    {
                        CPrintToChat(client, "\x04[SM] {blue}Текущий лимит на оружие: {olive}%d/1", give_quota0[client]);
                    }
                    else if (give_quota0[client] == 0)
                    {
                        CPrintToChat(client, "\x04[SM] {blue}Вы достигли лимита на оружие: {olive}1/1");
                    }
                }
                else
                {
                    CPrintToChat(client, "\x04[SM] {olive}Оружие будет доступно в следующем раунде");
                }
            }
        }
    }
    
    //Add the CHEAT flag back to "give" command
    SetCommandFlags("give", flags | FCVAR_CHEAT);
    return 0;
}

 

Спасибо, проверил, работает. Вроде даже без багов, между уровнями корректно работает.

Можно сделать ещё так, чтобы менюшка не закрывалась, когда создаешь предмет и количество показывалось не в чате, а напротив создаваемого предмета?




Количество пользователей, читающих эту тему: 0

0 пользователей, 0 гостей, 0 анонимных