Approved Breakable Hint

Gameplay Addons
User avatar
th3_king
VIP
VIP
Egypt
Posts: 35
Joined: 2 Years Ago
Location: Egypt
Has thanked: 10 times
Been thanked: 2 times
Age: 17
Contact:

Re: Breakable Hint

#11

Post by th3_king » 11 Months Ago

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.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1951
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#12

Post by Raheem » 11 Months 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. }
You don't know? Learn and you will know.

User avatar
tmv
Member
Member
Russia
Posts: 30
Joined: 3 Weeks Ago
Has thanked: 2 times
Been thanked: 0
Age: 19
Contact:

#13

Post by tmv » 3 Weeks Ago

Raheem wrote:
11 Months 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

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1951
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#14

Post by Raheem » 3 Weeks Ago

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. }
You don't know? Learn and you will know.

User avatar
tmv
Member
Member
Russia
Posts: 30
Joined: 3 Weeks Ago
Has thanked: 2 times
Been thanked: 0
Age: 19
Contact:

#15

Post by tmv » 3 Weeks 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?

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1951
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#16

Post by Raheem » 3 Weeks Ago

tmv wrote:
3 Weeks 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.
You don't know? Learn and you will know.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest