Half-Life и Adrenaline Gamer форум

Всё об игре в Халф-Лайф и АГ
Текущее время: 29 мар 2024, 03:03

Часовой пояс: UTC + 5 часов [ Летнее время ]




Начать новую тему Ответить на тему  [ Сообщений: 10 ] 
Автор Сообщение
 Заголовок сообщения: Make player not used tank after used ?
СообщениеДобавлено: 24 окт 2017, 02:39 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
20 мар 2024, 19:47
Сообщения: 1018
Hi
As in the title?
Is there a way to do that?

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Make player not used tank after used ?
СообщениеДобавлено: 24 окт 2017, 03:35 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
26 мар 2024, 21:42
Сообщения: 6864
Still, even if you think it makes sense, it doesn't. Supply more description for your question please.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Make player not used tank after used ?
СообщениеДобавлено: 24 окт 2017, 06:05 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
20 мар 2024, 19:47
Сообщения: 1018
Sorry I thought it was direct question (I do not trust the translation very much :-)

When a player uses the tank I want to check that he is using it and I want to keep him away from using it in a particular event
because it creates a problem for me

Example :
If the player is using the tank and I want to strip_user_weapons and give him the example of the crowbar ( zombie claw) and change his model ..etc
In this case the player can not hit and becomes a remote control of the tank

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Make player not used tank after used ?
СообщениеДобавлено: 26 окт 2017, 03:20 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
26 мар 2024, 21:42
Сообщения: 6864
If you want to just stop all players on the map controlling tanks call Ham_Use on all func_tank entities on the map with use_type 0. Params idcaller and idactivator can be any, they are ignored for this use type.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Make player not used tank after used ?
СообщениеДобавлено: 02 ноя 2017, 12:06 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
20 мар 2024, 19:47
Сообщения: 1018
That's what I thought of initially?
Код:
public fw_UseStaticonary(entity, caller, activator, use_type){
   
   if(is_user_connected(caller) && countdown <= 1)
   {
      ExecuteHam( Ham_Use, entity, activator, caller, 0, 0.0 );
   }
Is it?

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Make player not used tank after used ?
СообщениеДобавлено: 02 ноя 2017, 22:44 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
26 мар 2024, 21:42
Сообщения: 6864
As I said, you don't need caller and activator params if you plan only to call it with use_type 0. In your code use_type param isn't used, so you can safely pass 0 for caller and activator too.


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Make player not used tank after used ?
СообщениеДобавлено: 03 ноя 2017, 03:02 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
20 мар 2024, 19:47
Сообщения: 1018
Here is a small test:
Код:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

new unused = 0

new const g_func_ents[][] = {
   "func_recharge","func_healthcharger","func_tank","func_tankcontrols","func_tanklaser","func_tankmortar","func_tankrocket"
}

public plugin_init() {
   
   for(new i=0;i<sizeof(g_func_ents);i++)
      RegisterHam(Ham_Use, g_func_ents[i], "fw_UseStaticonary")
      
   register_clcmd("say off", "clcmd_off")
   register_clcmd("say on", "clcmd_on")
}
public clcmd_off()
   unused = 0
public clcmd_on()
   unused = 1

public fw_UseStaticonary(entity, caller, activator, use_type){
   
   if(is_user_connected(caller) && unused == 1)
   {
      server_print("unused = %i", unused)
      ExecuteHam( Ham_Use, entity, 0, 0, 0, 0.0 );
   }
   return HAM_IGNORED
}
But it did not work!

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Make player not used tank after used ?
СообщениеДобавлено: 03 ноя 2017, 21:31 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
26 мар 2024, 21:42
Сообщения: 6864
It a bit opposite of what I though you asking for. I suggested the code for the moment if you need to OFF the player from the tank he is using.
If you wish to block the usage, then you code is almost right, you just need to
Код:
return HAM_IGNORED;
Just check that use_type is not USE_OFF (player trying to leave the tank).


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Make player not used tank after used ?
СообщениеДобавлено: 03 ноя 2017, 22:46 
Не в сети
Аватара пользователя
Зарегистрирован:
22 окт 2014, 19:26
Последнее посещение:
20 мар 2024, 19:47
Сообщения: 1018
I just want to stop him from using it when he controls it.
unused Is just an event.

I'm not sure by this code (Is that what you mean?) but in the end I do not get a result:
 
Цитата:
=============== use_type2 = 2
=============== use_type2 = 2
=============== use_type2 = 2
=============== use_type2 = 2
=============== use_type2 = 2
=============== use_type2 = 2
=============== use_type2 = 2
=============== use_type2 = 2

_________________
https://vk.com/kgbaghl


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: Make player not used tank after used ?
СообщениеДобавлено: 03 ноя 2017, 23:09 
Не в сети
Site Admin
Зарегистрирован:
01 июн 2010, 01:27
Последнее посещение:
26 мар 2024, 21:42
Сообщения: 6864
abdobiskra писал(а):
want to stop him from using it when he controls it.
Lev писал(а):
If you want to just stop all players on the map controlling tanks call Ham_Use on all func_tank entities on the map with use_type 0.
This means that you should iterate all entities to find func_tanks, and call
Код:
ExecuteHam( Ham_Use, entity, 0, 0, 0, 0.0);
on them. Sounds easy.
Sample iteration
Код:
   new oldEntity;
   // Search for egon weapon
   while ((oldEntity = engfunc(EngFunc_FindEntityByString, oldEntity, "classname", "weapon_egon")))
   {
      // Remove egon
      engfunc(EngFunc_RemoveEntity, oldEntity);
   }


Вернуться к началу
 Профиль 
  
Показать сообщения за:  Поле сортировки  
Начать новую тему Ответить на тему  [ Сообщений: 10 ] 

Часовой пояс: UTC + 5 часов [ Летнее время ]


Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 11


Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете добавлять вложения

Найти:
Перейти:  
Создано на основе phpBB® Forum Software © phpBB Group
Русская поддержка phpBB