Показ кнопок в хинте.

8Ahnenerbe8

Участник
Сообщения
113
Реакции
30
Салют!
Написал плагин,который выводит в хинт кнопки, которые нажимает игрок.
Получилось так:
PHP:
#include <sourcemod>

public OnPluginStart()
{
    RegConsoleCmd("sm_keys", Show_Keys);
}

public Action:Show_Keys(client, args)
{
    new String:keys[64];
    GetKeysMessage(client, keys, sizeof(keys));
    PrintHintText(client, "%s", keys);
}

void GetKeysMessage(client, String:sKeys[], maxlen)
{
    new buttons = GetClientButtons(client);

    Format(sKeys, maxlen, "");

    if(buttons & IN_MOVELEFT)
        Format(sKeys, maxlen, "%sA", sKeys);
    else
        Format(sKeys, maxlen, "%s_", sKeys);

    if(buttons & IN_FORWARD)
        Format(sKeys, maxlen, "%sW", sKeys);
    else
        Format(sKeys, maxlen, "%s_", sKeys);

    if(buttons & IN_BACK)
        Format(sKeys, maxlen, "%sS", sKeys);
    else
        Format(sKeys, maxlen, "%s_", sKeys);

    if(buttons & IN_MOVERIGHT)
        Format(sKeys, maxlen, "%sD", sKeys);
    else
        Format(sKeys, maxlen, "%s_", sKeys);

    if(buttons & IN_DUCK)
      Format(sKeys, maxlen, "%s - C", sKeys);
    else
      Format(sKeys, maxlen, "%s - _", sKeys);

    if(buttons & IN_JUMP)
        Format(sKeys, maxlen, "%sJ", sKeys);
    else
        Format(sKeys, maxlen, "%s_", sKeys);

    Format(sKeys, maxlen, "%s", sKeys);
}
Но так как у меня бхоп сервер, на котором стоит автобхоп, кнопка джамп(J) в хинте не отображается(редко проскакивает).
Может кто-то знает, как пофиксить это?
 
Последнее редактирование:

8Ahnenerbe8

Участник
Сообщения
113
Реакции
30
@AlmazON, через это тоже не работает, аналогично кнопка проскакивает и все
 
Последнее редактирование:

8Ahnenerbe8

Участник
Сообщения
113
Реакции
30
@AlmazON,
Места хватает, я же говорю,она с определнной переодичностью проскакивает.
Но на всякий случай я все равно проверил, не помогло.
Мб я что-то не так сделал?
PHP:
#include <sourcemod>

public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon, &subtype, &cmdnum, &tickcount, &seed, mouse[2])
{
    new String:keys[64];
    GetKeysMessage(client, keys, sizeof(keys));
    PrintHintText(client, "%s", keys);
}

void GetKeysMessage(client, String:sKeys[], maxlen)
{
    new buttons = GetClientButtons(client);

    Format(sKeys, maxlen, "");

/*    if(buttons & IN_MOVELEFT)
        Format(sKeys, maxlen, "%sA", sKeys);
    else
        Format(sKeys, maxlen, "%s_", sKeys);

    if(buttons & IN_FORWARD)
        Format(sKeys, maxlen, "%sW", sKeys);
    else
        Format(sKeys, maxlen, "%s_", sKeys);

    if(buttons & IN_BACK)
        Format(sKeys, maxlen, "%sS", sKeys);
    else
        Format(sKeys, maxlen, "%s_", sKeys);

    if(buttons & IN_MOVERIGHT)
        Format(sKeys, maxlen, "%sD", sKeys);
    else
        Format(sKeys, maxlen, "%s_", sKeys);

    if(buttons & IN_DUCK)
      Format(sKeys, maxlen, "%s - C", sKeys);
    else
      Format(sKeys, maxlen, "%s - _", sKeys);*/

    if(buttons & IN_JUMP)
        Format(sKeys, maxlen, "%sJ", sKeys);
    else
        Format(sKeys, maxlen, "%s_", sKeys);

//  Format(sKeys, maxlen, "%s", sKeys);
}
 
Последнее редактирование:

inklesspen

Не пишу модули под LSD :с
Сообщения
1,775
Реакции
967
Нет, дело в БХОП-Плагине. Он вырубает кнопку, и только тогда, когда игрок на земле, врубает ее.
Кинь исходник от бхоп-плагина, я попробую немного изменить.
 

8Ahnenerbe8

Участник
Сообщения
113
Реакции
30
@inklesspen, вырезал функцию с автобхопом, там в конце это будет.
PHP:
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
    g_UnaffectedButtons[client] = buttons;
 
    if(IsPlayerAlive(client))
    {
        new Style = g_Style[client][g_Type[client]];
     
        // Key restriction
        new bool:bRestrict = CheckRestrict(vel, Style);
     
        if(g_StyleConfig[Style][Special])
        {
            if(StrEqual(g_StyleConfig[Style][Special_Key], "hsw"))
            {
                if(vel[0] > 0 && vel[1] != 0)
                    g_HSWCounter[client] = GetEngineTime();
             
                if(((GetEngineTime() - g_HSWCounter[client] > 0.4) || vel[0] <= 0) && !(GetEntityFlags(client) & FL_ONGROUND))
                {
                    bRestrict = true;
                }
            }
            else if (StrEqual(g_StyleConfig[Style][Special_Key], "surfhsw-aw-sd", true))
            {
                if((vel[0] > 0.0 && vel[1] < 0.0) || (vel[0] < 0.0 && vel[1] > 0.0)) // If pressing w and a or s and d, keep unrestricted
                {
                    g_HSWCounter[client] = GetEngineTime();
                }
                else if(GetEngineTime() - g_HSWCounter[client] > 0.3) // Restrict if player hasn't held the right buttons for too long
                {
                    bRestrict = true;
                }
            }
            else if (StrEqual(g_StyleConfig[Style][Special_Key], "surfhsw-as-wd", true))
            {
                if ((vel[0] < 0.0 && vel[1] < 0.0) || (vel[0] > 0.0 && vel[1] > 0.0))
                {
                    g_HSWCounter[client] = GetEngineTime();
                }
                else if(GetEngineTime() - g_HSWCounter[client] > 0.3)
                {
                    bRestrict = true;
                }
            }
        }
     
        if(GetEntityMoveType(client) == MOVETYPE_NOCLIP)
            bRestrict = false;
        else if(g_StyleConfig[Style][Freestyle] && g_StyleConfig[Style][Freestyle_Unrestrict])
            if(Timer_InsideZone(client, FREESTYLE, 1 << Style) != -1)
                bRestrict = false;
     
        if(bRestrict == true)
        {
            if(!(GetEntityFlags(client) & FL_ATCONTROLS))
                SetEntityFlags(client, GetEntityFlags(client) | FL_ATCONTROLS);
        }
        else
        {
            if(GetEntityFlags(client) & FL_ATCONTROLS)
                SetEntityFlags(client, GetEntityFlags(client) &  ~FL_ATCONTROLS);
        }
     
        // Count strafes
        if(g_StyleConfig[Style][Count_Left_Strafe] && !(g_Buttons[client] & IN_MOVELEFT) && (buttons & IN_MOVELEFT))
            g_Strafes[client]++;
        if(g_StyleConfig[Style][Count_Right_Strafe] && !(g_Buttons[client] & IN_MOVERIGHT) && (buttons & IN_MOVERIGHT))
            g_Strafes[client]++;
        if(g_StyleConfig[Style][Count_Back_Strafe] && !(g_Buttons[client] & IN_BACK) && (buttons & IN_BACK))
            g_Strafes[client]++;
        if(g_StyleConfig[Style][Count_Forward_Strafe] && !(g_Buttons[client] & IN_FORWARD) && (buttons & IN_FORWARD))
            g_Strafes[client]++;
     
        // Calculate sync
        if(g_StyleConfig[Style][CalcSync] == true)
        {
            CheckSync(client, buttons, vel, angles);
        }
     
        // Check gravity
        if(g_StyleConfig[Style][Gravity] != 0.0)
        {
            if(GetEntityGravity(client) == 0.0)
            {
                SetEntityGravity(client, g_StyleConfig[Style][Gravity]);
            }
        }
         
        if(g_bTiming[client] == true)
        {
            // Anti +left
            if(GetConVarBool(g_hAllowLeftYawspeed) == false)
            {
                if(buttons & (IN_LEFT))
                {
                    StopTimer(client);
                 
                    if(Timer_InsideZone(client, MAIN_START, -1) == -1 && Timer_InsideZone(client, BONUS_START, -1) == -1)
                    {
                        PrintColorText(client, "%s%sYour timer was stopped for using %s+left",
                            g_msg_start,
                            g_msg_textcol,
                            g_msg_varcol);
                    }
                }
            }
         
            // Anti +right
            if(GetConVarBool(g_hAllowRightYawspeed) == false)
            {
                if(buttons & (IN_RIGHT))
                {
                    StopTimer(client);
                 
                    if(Timer_InsideZone(client, MAIN_START, -1) == -1 && Timer_InsideZone(client, BONUS_START, -1) == -1)
                    {
                        PrintColorText(client, "%s%sYour timer was stopped for using %s+right",
                            g_msg_start,
                            g_msg_textcol,
                            g_msg_varcol);
                    }
                }
            }
         
            // Pausing
            if(g_bPaused[client] == true)
            {
                if(GetEntityMoveType(client) == MOVETYPE_WALK)
                {
                    SetEntityMoveType(client, MOVETYPE_NONE);
                }
            }
            else
            {
                if(GetEntityMoveType(client) == MOVETYPE_NONE)
                {
                    SetEntityMoveType(client, MOVETYPE_WALK);
                }
            }
         
            g_fCurrentTime[client] += GetTickInterval();
        }
     
        // auto bhop check
        if(g_bAllowAuto)
        {
            if(g_StyleConfig[Style][Auto] || (g_StyleConfig[Style][Freestyle] && g_StyleConfig[Style][Freestyle_Auto] && Timer_InsideZone(client, FREESTYLE, 1 << Style) != -1))
            {
                if(GetClientSettings(client) & AUTO_BHOP)
                {
                    if(buttons & IN_JUMP)
                    {
                        if(!(GetEntityFlags(client) & FL_ONGROUND))
                        {
                            if(!(GetEntityMoveType(client) & MOVETYPE_LADDER))
                            {
                                if(GetEntProp(client, Prop_Data, "m_nWaterLevel") <= 1)
                                {
                                    buttons &= ~IN_JUMP;
                                }
                            }
                        }
                    }
                }
            }
        }
     
        if(g_bJumpInStartZone == false)
        {
            if(Timer_InsideZone(client, MAIN_START, -1) != -1 || Timer_InsideZone(client, BONUS_START, -1) != -1)
            {
                buttons &= ~IN_JUMP;
            }
        }
    }
 
    g_Buttons[client] = buttons;
}
 

inklesspen

Не пишу модули под LSD :с
Сообщения
1,775
Реакции
967
@inklesspen, вырезал функцию с автобхопом, там в конце это будет.
PHP:
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
    g_UnaffectedButtons[client] = buttons;

    if(IsPlayerAlive(client))
    {
        new Style = g_Style[client][g_Type[client]];
    
        // Key restriction
        new bool:bRestrict = CheckRestrict(vel, Style);
    
        if(g_StyleConfig[Style][Special])
        {
            if(StrEqual(g_StyleConfig[Style][Special_Key], "hsw"))
            {
                if(vel[0] > 0 && vel[1] != 0)
                    g_HSWCounter[client] = GetEngineTime();
            
                if(((GetEngineTime() - g_HSWCounter[client] > 0.4) || vel[0] <= 0) && !(GetEntityFlags(client) & FL_ONGROUND))
                {
                    bRestrict = true;
                }
            }
            else if (StrEqual(g_StyleConfig[Style][Special_Key], "surfhsw-aw-sd", true))
            {
                if((vel[0] > 0.0 && vel[1] < 0.0) || (vel[0] < 0.0 && vel[1] > 0.0)) // If pressing w and a or s and d, keep unrestricted
                {
                    g_HSWCounter[client] = GetEngineTime();
                }
                else if(GetEngineTime() - g_HSWCounter[client] > 0.3) // Restrict if player hasn't held the right buttons for too long
                {
                    bRestrict = true;
                }
            }
            else if (StrEqual(g_StyleConfig[Style][Special_Key], "surfhsw-as-wd", true))
            {
                if ((vel[0] < 0.0 && vel[1] < 0.0) || (vel[0] > 0.0 && vel[1] > 0.0))
                {
                    g_HSWCounter[client] = GetEngineTime();
                }
                else if(GetEngineTime() - g_HSWCounter[client] > 0.3)
                {
                    bRestrict = true;
                }
            }
        }
    
        if(GetEntityMoveType(client) == MOVETYPE_NOCLIP)
            bRestrict = false;
        else if(g_StyleConfig[Style][Freestyle] && g_StyleConfig[Style][Freestyle_Unrestrict])
            if(Timer_InsideZone(client, FREESTYLE, 1 << Style) != -1)
                bRestrict = false;
    
        if(bRestrict == true)
        {
            if(!(GetEntityFlags(client) & FL_ATCONTROLS))
                SetEntityFlags(client, GetEntityFlags(client) | FL_ATCONTROLS);
        }
        else
        {
            if(GetEntityFlags(client) & FL_ATCONTROLS)
                SetEntityFlags(client, GetEntityFlags(client) &  ~FL_ATCONTROLS);
        }
    
        // Count strafes
        if(g_StyleConfig[Style][Count_Left_Strafe] && !(g_Buttons[client] & IN_MOVELEFT) && (buttons & IN_MOVELEFT))
            g_Strafes[client]++;
        if(g_StyleConfig[Style][Count_Right_Strafe] && !(g_Buttons[client] & IN_MOVERIGHT) && (buttons & IN_MOVERIGHT))
            g_Strafes[client]++;
        if(g_StyleConfig[Style][Count_Back_Strafe] && !(g_Buttons[client] & IN_BACK) && (buttons & IN_BACK))
            g_Strafes[client]++;
        if(g_StyleConfig[Style][Count_Forward_Strafe] && !(g_Buttons[client] & IN_FORWARD) && (buttons & IN_FORWARD))
            g_Strafes[client]++;
    
        // Calculate sync
        if(g_StyleConfig[Style][CalcSync] == true)
        {
            CheckSync(client, buttons, vel, angles);
        }
    
        // Check gravity
        if(g_StyleConfig[Style][Gravity] != 0.0)
        {
            if(GetEntityGravity(client) == 0.0)
            {
                SetEntityGravity(client, g_StyleConfig[Style][Gravity]);
            }
        }
        
        if(g_bTiming[client] == true)
        {
            // Anti +left
            if(GetConVarBool(g_hAllowLeftYawspeed) == false)
            {
                if(buttons & (IN_LEFT))
                {
                    StopTimer(client);
                
                    if(Timer_InsideZone(client, MAIN_START, -1) == -1 && Timer_InsideZone(client, BONUS_START, -1) == -1)
                    {
                        PrintColorText(client, "%s%sYour timer was stopped for using %s+left",
                            g_msg_start,
                            g_msg_textcol,
                            g_msg_varcol);
                    }
                }
            }
        
            // Anti +right
            if(GetConVarBool(g_hAllowRightYawspeed) == false)
            {
                if(buttons & (IN_RIGHT))
                {
                    StopTimer(client);
                
                    if(Timer_InsideZone(client, MAIN_START, -1) == -1 && Timer_InsideZone(client, BONUS_START, -1) == -1)
                    {
                        PrintColorText(client, "%s%sYour timer was stopped for using %s+right",
                            g_msg_start,
                            g_msg_textcol,
                            g_msg_varcol);
                    }
                }
            }
        
            // Pausing
            if(g_bPaused[client] == true)
            {
                if(GetEntityMoveType(client) == MOVETYPE_WALK)
                {
                    SetEntityMoveType(client, MOVETYPE_NONE);
                }
            }
            else
            {
                if(GetEntityMoveType(client) == MOVETYPE_NONE)
                {
                    SetEntityMoveType(client, MOVETYPE_WALK);
                }
            }
        
            g_fCurrentTime[client] += GetTickInterval();
        }
    
        // auto bhop check
        if(g_bAllowAuto)
        {
            if(g_StyleConfig[Style][Auto] || (g_StyleConfig[Style][Freestyle] && g_StyleConfig[Style][Freestyle_Auto] && Timer_InsideZone(client, FREESTYLE, 1 << Style) != -1))
            {
                if(GetClientSettings(client) & AUTO_BHOP)
                {
                    if(buttons & IN_JUMP)
                    {
                        if(!(GetEntityFlags(client) & FL_ONGROUND))
                        {
                            if(!(GetEntityMoveType(client) & MOVETYPE_LADDER))
                            {
                                if(GetEntProp(client, Prop_Data, "m_nWaterLevel") <= 1)
                                {
                                    buttons &= ~IN_JUMP;
                                }
                            }
                        }
                    }
                }
            }
        }
    
        if(g_bJumpInStartZone == false)
        {
            if(Timer_InsideZone(client, MAIN_START, -1) != -1 || Timer_InsideZone(client, BONUS_START, -1) != -1)
            {
                buttons &= ~IN_JUMP;
            }
        }
    }

    g_Buttons[client] = buttons;
}
А! Точно! Ты можешь показывать кнопки через плагин автобхопа! За одно блокировать ниче не будет в твоих хинтах
 

inklesspen

Не пишу модули под LSD :с
Сообщения
1,775
Реакции
967
Тут можно ловить кнопку для других плагинов. Проблема в другом: Ускорения нету :D
--- Добавлено позже ---
Или вот, получать JUMP кнопку у плагина на Бхоп)
Достаточно в плагин добавить native bool:AbnerBHOP_GetRealJumpButton(int client); И юзать его вместо проверки buttons & IN_JUMP
 

Вложения

  • abner_bhop.smx
    6 КБ · Просмотры: 2
  • abner_bhop.sp
    3.6 КБ · Просмотры: 10
  • abner_bhop_getjumpbutton.smx
    6.3 КБ · Просмотры: 4
  • abner_bhop_getjumpbutton.sp
    3.2 КБ · Просмотры: 18
Последнее редактирование:

skywalker

Участник
Сообщения
1,153
Реакции
263
а можно сделать так,чтоб показывало,когда террорист нажимает кнопку,для детран сервера нужно.
 
Сверху Снизу