Half-Life и Adrenaline Gamer форум
http://aghl.ru/forum/

[HELP] position Hud Msg miniag
http://aghl.ru/forum/viewtopic.php?f=12&t=2476
Страница 1 из 4

Автор:  abdobiskra [ 07 июн 2016, 18:38 ]
Заголовок сообщения:  [HELP] position Hud Msg miniag

Hi !
i have Bug!
i tryed to change location of the message (x,y) for this plugin MiniAG customizer

i do it like this !
Код:
public HookTempentity(const id)
{
   if( get_msg_arg_int(1) != TE_TEXTMESSAGE )
   {
      return PLUGIN_CONTINUE
   }

   static szMessage[512]
   
   if( get_msg_arg_string(18, szMessage, charsmax(szMessage)) || is_user_connected(id) && is_user_alive(id))
   {
      if( equal(szMessage, "www.", 4))
      {
         get_pcvar_string( pCvar, szMessage, charsmax(szMessage) )
         set_msg_arg_string(18, szMessage)
         
         set_hudmessage(200, 200, 200, 0.20, 0.20, 2, 0.1, 2.0, 0.01, 0.1, 3)
         show_hudmessage(id, "%s", szMessage);// <=========== line Bug ! when i used id
      }
   }
   
   return PLUGIN_CONTINUE
}
its succeed
but i have bug when used (id) and when Player joined in the server other players saw this Msg ...
any other way to do it ?

Автор:  Lev [ 07 июн 2016, 21:11 ]
Заголовок сообщения:  Re: [HELP] position Hud Msg miniag

You shouldn't use show_hudmessage inside of register_message handler. Because this handler is a catcher for the tempmessage and show_hudmessage do send other tempmessage. Use settask to delay it a bit.

Автор:  abdobiskra [ 07 июн 2016, 22:40 ]
Заголовок сообщения:  Re: [HELP] position Hud Msg miniag

Цитата:
Use settask
idk where i do it ?

 

Автор:  Lev [ 08 июн 2016, 01:03 ]
Заголовок сообщения:  Re: [HELP] position Hud Msg miniag

Sure.

Автор:  abdobiskra [ 08 июн 2016, 16:14 ]
Заголовок сообщения:  Re: [HELP] position Hud Msg miniag

Did not succeed (
 

Автор:  Lev [ 08 июн 2016, 23:08 ]
Заголовок сообщения:  Re: [HELP] position Hud Msg miniag

What you are actually trying to do?

abdobiskra писал(а):
set_task(5.0,"HudMessagPost", id, szMessage)
It is not a right way to pass a string.
Either
Код:
     set_task(5.0,"HudMessagPost", id, szMessage, strlen(szMessage))

public HudMessagPost(msg[], len)
But this way you either should put id into a string (actually params array) or you will not get it in the task handler.
Or use global string array for this (you can store string individually for each player) and pass id to the handler, then retrieve a string from global array.
So, the best way depends on what you are trying to achieve.

Автор:  abdobiskra [ 09 июн 2016, 00:26 ]
Заголовок сообщения:  Re: [HELP] position Hud Msg miniag

Did not succeed also !

Цитата:
Or use global string array for this (you can store string individually for each player) and pass id to the handler, then retrieve a string from global array.
So, the best way depends on what you are trying to achieve.

It will be difficult to do because im know litlle .. as well as with the translation would be impossible x))
can u put the correct cod and explaind (len) ? i think is better way to learn it !

Автор:  Lev [ 09 июн 2016, 06:53 ]
Заголовок сообщения:  Re: [HELP] position Hud Msg miniag

Lev писал(а):
szMessage, strlen(szMessage)
You should pass an array and its length.
So, the handler will get these on call:
Lev писал(а):
public HudMessagPost(msg[], len)
UPD: I forgot to type [] after msg. Corrected code.

Автор:  abdobiskra [ 09 июн 2016, 09:49 ]
Заголовок сообщения:  Re: [HELP] position Hud Msg miniag

Yes, it is now working ... but we go back to the same problem from the first !
Цитата:
when Player joined in the server other players saw this Msg ...

Автор:  Lev [ 09 июн 2016, 21:03 ]
Заголовок сообщения:  Re: [HELP] position Hud Msg miniag

Lev писал(а):
What you are actually trying to do?
Change position along with the text?

Добавлено спустя 45 минут 34 секунды:
You can get coordinates from the message:
Код:
new x = get_msg_arg_int(3);
new y = get_msg_arg_int(4);
And set
Код:
set_msg_arg_int(3, get_msg_argtype(3), x);
set_msg_arg_int(4, get_msg_argtype(4), y);
x and y are float values multiplied by 8192 and converted to integer. So if x = 1024, then actual value is 1024/8192 = 0,125.

Страница 1 из 4 Часовой пояс: UTC + 5 часов [ Летнее время ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/