Page 2 of 2

Re: Breakable Hint

Posted: 02 Sep 2018, 17:38
by th3_king
There is a problem with print_chat in this plugin Hint Break, and It causes problems to players game also in other servers it appears at map changes ... so please fix it.

Re: Breakable Hint

Posted: 03 Sep 2018, 13:19
by Raheem
Try:
    1. #include <zombie_escape>
    2.  
    3. // Defines
    4. #define AIMTASK 500
    5.  
    6. // Cvars
    7. new cvar_message_type
    8.  
    9. public plugin_init()
    10. {
    11.     register_plugin("[ZE] Breakable Hint", "1.2", "Raheem")
    12.    
    13.     // Cvars
    14.     cvar_message_type = register_cvar("ze_break_hint_type", "1")
    15.    
    16.     // Tasks
    17.     set_task(0.5, "Check_AimTask", AIMTASK, _, _, "b")
    18. }
    19.  
    20. public Check_AimTask()
    21. {
    22.     if (get_pcvar_num(cvar_message_type) == 0)
    23.     {
    24.         remove_task(AIMTASK, 0)
    25.         return
    26.     }
    27.    
    28.     for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
    29.     {
    30.         if (!is_user_alive(id))
    31.             continue
    32.        
    33.         new iEntIndex, iBody
    34.         get_user_aiming(id, iEntIndex, iBody)
    35.        
    36.         if(pev_valid(iEntIndex) && !is_user_connected(iEntIndex))
    37.         {
    38.             new szClassName[32], iHealth
    39.            
    40.             iHealth = floatround(get_entvar(iEntIndex, var_health))
    41.            
    42.             get_entvar(iEntIndex, var_classname, szClassName, charsmax(szClassName))
    43.            
    44.             if(equal(szClassName, "func_breakable"))
    45.             {
    46.                 if (get_pcvar_num(cvar_message_type) == 1)
    47.                 {
    48.                     set_hudmessage(random(256), random(256), random(256), 0.1, -0.3, 2, 2.0, 2.0)
    49.                     show_hudmessage(id, "[Hint] You can break this Entity!^n Health: %i", iHealth)
    50.                 }
    51.                 else if (get_pcvar_num(cvar_message_type) == 2)
    52.                 {
    53.                     static szMessage[64]
    54.                     formatex(szMessage, charsmax(szMessage), "[Hint] You can break this Entity!^n Health: %i", iHealth)
    55.                    
    56.                     engclient_print(id, engprint_center, szMessage)
    57.                 }
    58.             }
    59.         }
    60.     }
    61. }

Re: Breakable Hint

Posted: 31 Jul 2019, 08:10
by tmv
Raheem wrote:
1 Year Ago
Try:
    1. #include <zombie_escape>
    2.  
    3. // Defines
    4. #define AIMTASK 500
    5.  
    6. // Cvars
    7. new cvar_message_type
    8.  
    9. public plugin_init()
    10. {
    11.     register_plugin("[ZE] Breakable Hint", "1.2", "Raheem")
    12.    
    13.     // Cvars
    14.     cvar_message_type = register_cvar("ze_break_hint_type", "1")
    15.    
    16.     // Tasks
    17.     set_task(0.5, "Check_AimTask", AIMTASK, _, _, "b")
    18. }
    19.  
    20. public Check_AimTask()
    21. {
    22.     if (get_pcvar_num(cvar_message_type) == 0)
    23.     {
    24.         remove_task(AIMTASK, 0)
    25.         return
    26.     }
    27.    
    28.     for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
    29.     {
    30.         if (!is_user_alive(id))
    31.             continue
    32.        
    33.         new iEntIndex, iBody
    34.         get_user_aiming(id, iEntIndex, iBody)
    35.        
    36.         if(pev_valid(iEntIndex) && !is_user_connected(iEntIndex))
    37.         {
    38.             new szClassName[32], iHealth
    39.            
    40.             iHealth = floatround(get_entvar(iEntIndex, var_health))
    41.            
    42.             get_entvar(iEntIndex, var_classname, szClassName, charsmax(szClassName))
    43.            
    44.             if(equal(szClassName, "func_breakable"))
    45.             {
    46.                 if (get_pcvar_num(cvar_message_type) == 1)
    47.                 {
    48.                     set_hudmessage(random(256), random(256), random(256), 0.1, -0.3, 2, 2.0, 2.0)
    49.                     show_hudmessage(id, "[Hint] You can break this Entity!^n Health: %i", iHealth)
    50.                 }
    51.                 else if (get_pcvar_num(cvar_message_type) == 2)
    52.                 {
    53.                     static szMessage[64]
    54.                     formatex(szMessage, charsmax(szMessage), "[Hint] You can break this Entity!^n Health: %i", iHealth)
    55.                    
    56.                     engclient_print(id, engprint_center, szMessage)
    57.                 }
    58.             }
    59.         }
    60.     }
    61. }
Not Fixed
Can be seen Breakable Hint print_chat in other servers

Re: Breakable Hint

Posted: 31 Jul 2019, 11:20
by Raheem
Got idea, to send empty message as a reset, TRY:
    1. #include <zombie_escape>
    2.  
    3. // Defines
    4. #define AIMTASK 500
    5.  
    6. // Cvars
    7. new cvar_message_type
    8.  
    9. public plugin_init()
    10. {
    11.     register_plugin("[ZE] Breakable Hint", "1.2", "Raheem")
    12.    
    13.     // Cvars
    14.     cvar_message_type = register_cvar("ze_break_hint_type", "1")
    15.    
    16.     // Tasks
    17.     set_task(0.5, "Check_AimTask", AIMTASK, _, _, "b")
    18. }
    19.  
    20. public Check_AimTask()
    21. {
    22.     if (get_pcvar_num(cvar_message_type) == 0)
    23.     {
    24.         remove_task(AIMTASK, 0)
    25.         return
    26.     }
    27.    
    28.     for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
    29.     {
    30.         if (!is_user_alive(id))
    31.             continue
    32.        
    33.         new iEntIndex, iBody
    34.         get_user_aiming(id, iEntIndex, iBody)
    35.        
    36.         if(pev_valid(iEntIndex) && !is_user_connected(iEntIndex))
    37.         {
    38.             new szClassName[32], iHealth
    39.            
    40.             iHealth = floatround(get_entvar(iEntIndex, var_health))
    41.            
    42.             get_entvar(iEntIndex, var_classname, szClassName, charsmax(szClassName))
    43.            
    44.             if(equal(szClassName, "func_breakable"))
    45.             {
    46.                 if (get_pcvar_num(cvar_message_type) == 1)
    47.                 {
    48.                     set_hudmessage(random(256), random(256), random(256), 0.1, -0.3, 2, 2.0, 2.0)
    49.                     show_hudmessage(id, "[Hint] You can break this Entity!^n Health: %i", iHealth)
    50.                 }
    51.                 else if (get_pcvar_num(cvar_message_type) == 2)
    52.                 {
    53.                     static szMessage[64]
    54.                     formatex(szMessage, charsmax(szMessage), "[Hint] You can break this Entity!^n Health: %i", iHealth)
    55.                    
    56.                     engclient_print(id, engprint_center, szMessage)
    57.                    
    58.                     set_task(0.5, "Reset", id)
    59.                 }
    60.             }
    61.         }
    62.     }
    63. }
    64.  
    65. public Reset(id)
    66. {
    67.     engclient_print(id, engprint_center, "")
    68. }

Re: Breakable Hint

Posted: 31 Jul 2019, 13:58
by tmv
Unfortunately it didn't work
The moment when this message appears I connect to another server and the message is still there in the new server. Could it be bug of cs 1.6?

Re: Breakable Hint

Posted: 31 Jul 2019, 14:12
by Raheem
tmv wrote:
3 Months Ago
Unfortunately it didn't work
The moment when this message appears I connect to another server and the message is still there in the new server. Could it be bug of cs 1.6?
The issue in engclient_print(id, engprint_center, szMessage), i'm using it so i be able to go to new line with ^n, it seems like this message is saved in game cache, if player disconnected then out of game and enter again it disappears, but for now try this:

  1. #include <zombie_escape>
  2.  
  3. // Defines
  4. #define AIMTASK 500
  5.  
  6. // Cvars
  7. new cvar_message_type
  8.  
  9. public plugin_init()
  10. {
  11.     register_plugin("[ZE] Breakable Hint", "1.2", "Raheem")
  12.    
  13.     // Cvars
  14.     cvar_message_type = register_cvar("ze_break_hint_type", "1")
  15.    
  16.     // Tasks
  17.     set_task(0.5, "Check_AimTask", AIMTASK, _, _, "b")
  18. }
  19.  
  20. public Check_AimTask()
  21. {
  22.     if (get_pcvar_num(cvar_message_type) == 0)
  23.     {
  24.         remove_task(AIMTASK, 0)
  25.         return
  26.     }
  27.    
  28.     for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
  29.     {
  30.         if (!is_user_alive(id))
  31.             continue
  32.        
  33.         new iEntIndex, iBody
  34.         get_user_aiming(id, iEntIndex, iBody)
  35.        
  36.         if(pev_valid(iEntIndex) && !is_user_connected(iEntIndex))
  37.         {
  38.             new szClassName[32], iHealth
  39.            
  40.             iHealth = floatround(get_entvar(iEntIndex, var_health))
  41.            
  42.             get_entvar(iEntIndex, var_classname, szClassName, charsmax(szClassName))
  43.            
  44.             if(equal(szClassName, "func_breakable"))
  45.             {
  46.                 if (get_pcvar_num(cvar_message_type) == 1)
  47.                 {
  48.                     set_hudmessage(random(256), random(256), random(256), 0.1, -0.3, 2, 2.0, 2.0)
  49.                     show_hudmessage(id, "[Hint] You can break this Entity!^n Health: %i", iHealth)
  50.                 }
  51.                 else if (get_pcvar_num(cvar_message_type) == 2)
  52.                 {
  53.                     static szMessage[64]
  54.                     formatex(szMessage, charsmax(szMessage), "[Hint] You can break this Entity!^n Health: %i", iHealth)
  55.                    
  56.                     engfunc(EngFunc_ClientPrintf, id, engprint_center, szMessage)
  57.                 }
  58.             }
  59.         }
  60.     }
  61. }
  62.  
  63. public client_disconnected(id)
  64. {
  65.     engfunc(EngFunc_ClientPrintf, id, engprint_center, "")
  66. }

I tried here reset in player disconnect, if not worked then you will need to use client_print(id, print_center, "") but in this you can't go to new line, it's only one line.