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

Указание оружия при выполнении Ham_Killed
http://aghl.ru/forum/viewtopic.php?f=20&t=2859
Страница 1 из 2

Автор:  MXPLRS|Kirill [ 15 янв 2018, 15:22 ]
Заголовок сообщения:  Указание оружия при выполнении Ham_Killed

Нужна помощь по изменению оружия в logmessage при выполнении ExecuteHamB(Ham_Killed) на игроке.
При обычном вызове сервер логирует как убийство миром (world):
Код:
"MXPLRS | Kirill<49><STEAM><CT>" killed "4yBa4oK :D<48><STEAM><TERRORIST>" with "world"

Хотелось бы видеть там использованное (либо намеренно указанное) оружие - в моем случае гранату:
Код:
"MXPLRS | Kirill<49><STEAM><CT>" killed "4yBa4oK :D<48><STEAM><TERRORIST>" with "grenade"

Испытал метод stock log_kill отсюда, но первое сообщение от world всё равно появляется (я так понял что оно блочит только вывод на экран).

Автор:  abdobiskra [ 15 янв 2018, 15:47 ]
Заголовок сообщения:  Re: Указание оружия при выполнении Ham_Killed

Код:
   register_message(get_user_msgid("DeathMsg"), "Message_DeathMsg")
}

public Message_DeathMsg() {
   
   
   static const nameWeapon[] = "rocket_crowbar"
   static text[64]
   
   get_msg_arg_string(3, text, 63)
   
   if (equal(text, nameWeapon))
      set_msg_arg_string( 3, "crowbar" )
      
   return PLUGIN_CONTINUE
}
this code frome here (v 2.5):
viewtopic.php?f=19&t=2525

so u can change :
Код:
static const nameWeapon[] = "rocket_crowbar"
Код:
set_msg_arg_string( 3, "crowbar" )
to
Код:
static const nameWeapon[] = "world"
Код:
set_msg_arg_string( 3, "grenade" )

Автор:  MXPLRS|Kirill [ 15 янв 2018, 16:35 ]
Заголовок сообщения:  Re: Указание оружия при выполнении Ham_Killed

Спасибо. Идея понятна, но не работает. Сейчас ищу различия с реализацией под CS.

Автор:  abdobiskra [ 15 янв 2018, 16:58 ]
Заголовок сообщения:  Re: Указание оружия при выполнении Ham_Killed

I think to a large extent it does not differ
Especially if a new entity is used
What exactly do you want to solve?

Автор:  MXPLRS|Kirill [ 15 янв 2018, 17:13 ]
Заголовок сообщения:  Re: Указание оружия при выполнении Ham_Killed

Одно различие есть - порядок переменных. В CS третьим идет headshot:
Код:
/* Creates a death message. */
stock make_deathmsg(killer, victim, headshot, const weapon[])
{
   message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0);
   write_byte(killer);
   write_byte(victim);

   new mod_name[32];
   get_modname(mod_name, 31);
   if (equal(mod_name, "cstrike") || equal(mod_name, "czero") || equal(mod_name, "csv15") || equal(mod_name, "cs13"))
      write_byte(headshot);
   write_string(weapon);
   message_end();

   return 1;
}
Поменял значение на 4, и даже перепроверил:
Код:
public Message_DeathMsg() {
   static const nameWeapon[] = "world";
   static text[64];

   get_msg_arg_string(4, text, 63);
   server_print(text);
   if (equal(text, nameWeapon))
      set_msg_arg_string(4, "grenade");
   server_print(get_msg_arg_string(4);
   return PLUGIN_CONTINUE;
}
Цитата:
>> world <<
"MXPLRS | Kirill<56><STEAM><CT>" killed "Player<58><STEAM><TERRORIST>" with "world"
Странно, но не поменялось...

abdobiskra писал(а):
What exactly do you want to solve?
Я пытаюсь сделать KillBomb для ZP 4.3. При взрыве гранаты выполняется следующий код:
Код:
   while((victim=engfunc(EngFunc_FindEntityInSphere,victim,flOrigin,RADIUS)) != 0){
      if(pev(victim,pev_takedamage) != DAMAGE_NO && pev(victim,pev_solid) != SOLID_NOT){
         if(!is_user_alive(victim) || victim==id || !zp_get_user_zombie(victim) || zp_get_user_nemesis(victim))
            continue;
         ExecuteHamB(Ham_Killed, victim, id, 2)
         zp_set_user_ammo_packs(id,zp_get_user_ammo_packs(id)+2);
      }
   }
Причина, по которой мне необходимо изменять значение - HLStatsX. Учет world как оружия в нем не ведется.

Автор:  abdobiskra [ 15 янв 2018, 18:27 ]
Заголовок сообщения:  Re: Указание оружия при выполнении Ham_Killed

MXPLRS|Kirill писал(а):
Одно различие есть - порядок переменных. В CS третьим идет headshot:
Yes I forgot it contains 4.

Цитата:
Я пытаюсь сделать KillBomb для ZP 4.3. При взрыве гранаты выполняется следующий код:
Код:
   while((victim=engfunc(EngFunc_FindEntityInSphere,victim,flOrigin,RADIUS)) != 0){
      if(pev(victim,pev_takedamage) != DAMAGE_NO && pev(victim,pev_solid) != SOLID_NOT){
         if(!is_user_alive(victim) || victim==id || !zp_get_user_zombie(victim) || zp_get_user_nemesis(victim))
            continue;
         ExecuteHamB(Ham_Killed, victim, id, 2)
         zp_set_user_ammo_packs(id,zp_get_user_ammo_packs(id)+2);
      }
   }
Причина, по которой мне необходимо изменять значение - HLStatsX. Учет world как оружия в нем не ведется.
I think you can find many answers in Rocket_Crowbar_2.5 plug-in ))
ex:
1) set your entity classname if they do not contain it after they are created
why that ? ... bcz there many entitys has this name ..This will determine which entity is intended to replace.
Код:
entity_set_string(Ent,EV_SZ_classname,"rocket_crowbar")
2) Then you can replace them :
Код:
public Message_DeathMsg() {
   
   
   static const nameWeapon[] = "rocket_crowbar"
   static text[64]
   
   get_msg_arg_string(4, text, 63)
   
   if (equal(text, nameWeapon))
      set_msg_arg_string( 4, "crowbar" )
      
   return PLUGIN_CONTINUE
}

3) about frag calculation you can use :
Код:
ExecuteHamB( Ham_TakeDamage, pEntity, Ent , pevInflictor, flAdjustedDamage, DMG_BLAST | 8);
Clearer ==>
Код:
ExecuteHamB( Ham_TakeDamage, victim,  "rocket_crowbar" , killer, Damage, DMG_BLAST);
Will work like an engine.

Автор:  MXPLRS|Kirill [ 15 янв 2018, 19:53 ]
Заголовок сообщения:  Re: Указание оружия при выполнении Ham_Killed

Мне помогла замена Ham_Killed на Ham_TakeDamage.
Конечно в этом случае надо получать HP игрока, который get_user_health почему-то всегда выдает на 1.33(3) меньше чем в игре... видимо из-за ZP :%)
Пункты 1 и 2 даже не потребовались.

Автор:  abdobiskra [ 15 янв 2018, 20:38 ]
Заголовок сообщения:  Re: Указание оружия при выполнении Ham_Killed

In fact, I did not understand what you would like to explain.

Автор:  MXPLRS|Kirill [ 16 янв 2018, 04:57 ]
Заголовок сообщения:  Re: Указание оружия при выполнении Ham_Killed

abdobiskra писал(а):
In fact, I did not understand what you would like to explain.
Replacing Ham_Killed to Ham_TakeDamage helped to solve problem, but in that way I must set damage for every execution.

get_user_health returns incorrect amount of health, less in 1.33 times (got value * 1.33 = real HP).
Classname and replacing is not required, because _explode(env) executed from think have env variable that I used for Ham_TakeDamage, and victim killed with correct weapon (grenade).

Issue still opened due incorrect getting of player's HP, and, maybe, we'll find one more way to block original logmessage and replace it with manually written by log_message.

Автор:  Lev [ 16 янв 2018, 17:44 ]
Заголовок сообщения:  Re: Указание оружия при выполнении Ham_Killed

Можно в Killed включать хук на FM_AlertMessage и заменять строчку для лога, а на выходе отключать хук.

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