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

How can I block the "model" and "spectate" commands ?
http://aghl.ru/forum/viewtopic.php?f=12&t=2668
Страница 1 из 1

Автор:  rtxa [ 04 май 2017, 18:51 ]
Заголовок сообщения:  How can I block the "model" and "spectate" commands ?

Hi, I'm new in this forum and I haven't introduced myself yet. How can I do what the title says in AMX Mod X? If it's possible of course. I want this because in my plugin, when I set a user in spectate, I don't want him to use that command. The same for "model" command.

Thank you.

Автор:  Lev [ 04 май 2017, 19:36 ]
Заголовок сообщения:  Re: How can I block the "model" and "spectate" commands ?

Hi and welcome.
You can catch and block spectate command if you wish. Check this plugin for the sample.
You can also catch and block model changing, but not the actual command (because this is client side command). Don't remember sample plugins, but you need to catch setinfo event, check the model and block (change back).

Автор:  abdobiskra [ 05 май 2017, 04:01 ]
Заголовок сообщения:  Re: How can I block the "model" and "spectate" commands ?

about block model :

Код:

#include <fakemeta>

   register_forward(FM_SetClientKeyValue, "SetClientKeyValue");

public SetClientKeyValue(player, const szInfoBuffer[], const szKey[], const szValue[])
{
   if(equal(szKey, "model"))
      return FMRES_HANDLED
      
   return FMRES_IGNORED
}

Автор:  rtxa [ 10 май 2018, 00:30 ]
Заголовок сообщения:  Re: How can I block the "model" and "spectate" commands ?

Lev писал(а):
Hi and welcome.
You can catch and block spectate command if you wish. Check this plugin for the sample.
You can also catch and block model changing, but not the actual command (because this is client side command). Don't remember sample plugins, but you need to catch setinfo event, check the model and block (change back).

Thank you Lev, I though that the solution was more complex :D I leave here the code that fix it
Код:
#include <amxmodx>

public plugin_init() {
    register_clcmd("spectate", "CmdSpectate"); // block spectate
}

public CmdSpectate() {
    return PLUGIN_HANDLED;
}

abdobiskra писал(а):
about block model :

Код:

#include <fakemeta>

   register_forward(FM_SetClientKeyValue, "SetClientKeyValue");

public SetClientKeyValue(player, const szInfoBuffer[], const szKey[], const szValue[])
{
   if(equal(szKey, "model"))
      return FMRES_HANDLED
      
   return FMRES_IGNORED
}
That unfortunalety didn't work :( Anyway, I don't need to block it anymore.
I'm sorry for the long delay for the response.

Автор:  abdobiskra [ 10 май 2018, 01:24 ]
Заголовок сообщения:  Re: How can I block the "model" and "spectate" commands ?

rtxa
Sorry I had taken it from one of my some works.. it is not complete .. so posted for clarification

Код:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

public plugin_init() {
   register_forward(FM_SetClientKeyValue, "SetClientKeyValue");
}

public SetClientKeyValue(player, const szInfoBuffer[], const szKey[], const szValue[])
{
   if(equal(szKey, "model"))
      return FMRES_HANDLED
   
   return FMRES_IGNORED
}

Автор:  rtxa [ 12 май 2018, 20:55 ]
Заголовок сообщения:  Re: How can I block the "model" and "spectate" commands ?

No abdobiskra, the problem with your code is that setinfo can't be hooked, so you can't block it, have you test the code?

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