Hook "_restart" command in console

Статус
В этой теме нельзя размещать новые ответы.
Сообщения
33
Реакции
14
Hello Scripters,

I am looking for a way to catch the moment when a client write "_restart" command in console. If it's somehow possible to hook this moment, because I need it.

Thanks in advance everyone!
 
Сообщения
673
Реакции
242
Помог
11 раз(а)
Код:
/**
* Used for EndRoundMessage() logged messages
*/
enum ScenarioEventEndRound
{
    ROUND_NONE,
    ROUND_TARGET_BOMB,
    ROUND_VIP_ESCAPED,
    ROUND_VIP_ASSASSINATED,
    ROUND_TERRORISTS_ESCAPED,
    ROUND_CTS_PREVENT_ESCAPE,
    ROUND_ESCAPING_TERRORISTS_NEUTRALIZED,
    ROUND_BOMB_DEFUSED,
    ROUND_CTS_WIN,
    ROUND_TERRORISTS_WIN,
    ROUND_END_DRAW,
    ROUND_ALL_HOSTAGES_RESCUED,
    ROUND_TARGET_SAVED,
    ROUND_HOSTAGE_NOT_RESCUED,
    ROUND_TERRORISTS_NOT_ESCAPED,
    ROUND_VIP_NOT_ESCAPED,
    ROUND_GAME_COMMENCE,
    ROUND_GAME_RESTART,
    ROUND_GAME_OVER
};
Код:
#include <amxmodx>
#include <reapi>

public plugin_init()
{
    RegisterHookChain( RG_RoundEnd, "RoundEnd", 0 );
}

public RoundEnd( WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay )
{
    if ( event == ROUND_GAME_RESTART)
    {
        //code...
    }
}
 
Сообщения
33
Реакции
14
That's not what I meant.. The command "_restart" is restarting the whole game client. If a player is in server and use the "_restart" command the whole game client will be restarted and he will be automatically reconnected to the server. In meantime he can cancel the reconnect using Escape button, which causes problems in a lot of cases (plugins). The moment must be caught, so it can be fixed.
Thanks in advance!
 
Сообщения
336
Реакции
414
Помог
7 раз(а)
menkisa00, Commands that are not related to the server and are executed on the client cannot be caught.
 

iPlague

♿️
Сообщения
230
Реакции
130
Помог
2 раз(а)
What problems do you mean?
Just nullify all arrays in one of this events (disconnect/connect/putinserver)
 
Последнее редактирование:
Сообщения
33
Реакции
14
iPlague, disconnect/connect/putinserver has nothing to do with this case...

Albertio, isn't there any chance that it can be simulated and caught, is it 100% sure that we cannot catch this moment?

In meantime he can cancel the reconnect using Escape button, which causes problems in a lot of cases. The moment must be caught, so it can be fixed. - this is bug, which Valve hasn't fixed and still persists.
 
Сообщения
1
Реакции
0
Actually its "_restart" not "retry", but anyways the problem is when you type "_restart" and the game clients restarts itself client_disconnected/RH_SV_DropClient can't catch the moment he's leaving the game, because he's actually staying in the server waiting for that "Connection to server timed out" kick. The idea here is how to check when player entity is in the server but the client is bugged/crashed.

For example you are in the server but your internet stops, then you are still in the server for 10-15 seconds before the server kicks you. Its actually the same thing.

I know about
C++:
get_entvar( pPlayer, EntVars:var_flags ) & FL_DORMANT
but im not really sure, will be good if someone with better knowledge/experience gives opinion.
 
Последнее редактирование:
Сообщения
33
Реакции
14
There is a big difference between "retry" and "_restart". Albertio already answered my question.
 
Статус
В этой теме нельзя размещать новые ответы.

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу