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

Make player not used tank after used ?
http://www.aghl.ru/forum/viewtopic.php?f=12&t=2805
Страница 1 из 1

Автор:  abdobiskra [ 24 окт 2017, 02:39 ]
Заголовок сообщения:  Make player not used tank after used ?

Hi
As in the title?
Is there a way to do that?

Автор:  Lev [ 24 окт 2017, 03:35 ]
Заголовок сообщения:  Re: Make player not used tank after used ?

Still, even if you think it makes sense, it doesn't. Supply more description for your question please.

Автор:  abdobiskra [ 24 окт 2017, 06:05 ]
Заголовок сообщения:  Re: Make player not used tank after used ?

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

Автор:  Lev [ 26 окт 2017, 03:20 ]
Заголовок сообщения:  Re: Make player not used tank after used ?

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.

Автор:  abdobiskra [ 02 ноя 2017, 12:06 ]
Заголовок сообщения:  Re: Make player not used tank after used ?

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?

Автор:  Lev [ 02 ноя 2017, 22:44 ]
Заголовок сообщения:  Re: Make player not used tank after used ?

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.

Автор:  abdobiskra [ 03 ноя 2017, 03:02 ]
Заголовок сообщения:  Re: Make player not used tank after used ?

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!

Автор:  Lev [ 03 ноя 2017, 21:31 ]
Заголовок сообщения:  Re: Make player not used tank after used ?

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).

Автор:  abdobiskra [ 03 ноя 2017, 22:46 ]
Заголовок сообщения:  Re: Make player not used tank after used ?

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

Автор:  Lev [ 03 ноя 2017, 23:09 ]
Заголовок сообщения:  Re: Make player not used tank after used ?

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);
   }

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