Raised This Month: $ Target: $400
 0% 

Hooking client sided clcmd [HELP!]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 07-06-2016 , 15:11   Hooking client sided clcmd [HELP!]
Reply With Quote #1

How to hook client sided clcmd? Some guys told me it is impossible but I don't really believe it..

For example hook the model command :

Code:
 register_clcmd("model", "StopThis")

and at the StopThis function there is only
Code:
 return PLUGIN_HANDLED
to stop the clcmd, but it does not work. I tried few other methods - they also didn't worked. Any clues about this?
KaLoIaN is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-06-2016 , 15:16   Re: Hooking client sided clcmd [HELP!]
Reply With Quote #2

Read this at "Fakemeta" fragment "5".
siriusmd99 is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 07-06-2016 , 16:20   Re: Hooking client sided clcmd [HELP!]
Reply With Quote #3

You can't hook the "model" command. (and pretty much every client-side concommand)

Hook a setinfo (model) change instead.
__________________

Last edited by gabuch2; 07-06-2016 at 16:20.
gabuch2 is offline
Old 07-06-2016, 18:32
EFFx
This message has been deleted by EFFx. Reason: nvm
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 07-07-2016 , 06:55   Re: Hooking client sided clcmd [HELP!]
Reply With Quote #4

Code:
#include <amxmodx> #include <fakemeta> new g_has_custom_model[33] new g_player_model[33][32] public plugin_init() {     register_clcmd("model", "clcmd_model")     register_plugin("Block Change Model", "LwL", "LAWLIET") } public fw_SetClientKeyValue( id, const infobuffer[], const key[] ) {     // Block CS model changes     if ( g_has_custom_model[id] && equal( key, "model" ) )         return FMRES_SUPERCEDE;         return FMRES_IGNORED; } stock fm_cs_set_user_model( player, const modelname[] ) {     // Set new model     engfunc( EngFunc_SetClientKeyValue, player, engfunc( EngFunc_GetInfoKeyBuffer, player ), "model", modelname )         // Remember this player has a custom model     g_has_custom_model[player] = true } stock fm_cs_get_user_model( player, model[], len ) {     // Retrieve current model     engfunc( EngFunc_InfoKeyValue, engfunc( EngFunc_GetInfoKeyBuffer, player ), "model", model, len ) } stock fm_cs_reset_user_model( player ) {     // Player doesn't have a custom model any longer     g_has_custom_model[player] = false         dllfunc( DLLFunc_ClientUserInfoChanged, player, engfunc( EngFunc_GetInfoKeyBuffer, player ) ) }

This doesn't worked.
Tried this one also:

Code:
#include <amxmodx> #include <fakemeta> new g_has_custom_model[33] new g_player_model[33][32] public plugin_init() {     register_clcmd("model", "clcmd_model")     register_plugin("Block Change Model", "LwL", "LAWLIET") } public fw_SetClientKeyValue( id, const infobuffer[], const key[] ) {     // Block CS model changes     if ( g_has_custom_model[id] && equal( key, "model" ) )     {         // Get current model         static currentmodel[32]         fm_cs_get_user_model( id, currentmodel, charsmax( currentmodel ) )                 // Check whether it matches the custom model - if not, set it again         if ( !equal( currentmodel, g_player_model[id] ) )             fm_cs_set_user_model( id, g_player_model[id] )                 return FMRES_SUPERCEDE;     }         return FMRES_IGNORED; } stock fm_cs_set_user_model( player, const modelname[] ) {     // Set new model     engfunc( EngFunc_SetClientKeyValue, player, engfunc( EngFunc_GetInfoKeyBuffer, player ), "model", modelname )         // Remember this player has a custom model     g_has_custom_model[player] = true } stock fm_cs_get_user_model( player, model[], len ) {     // Retrieve current model     engfunc( EngFunc_InfoKeyValue, engfunc( EngFunc_GetInfoKeyBuffer, player ), "model", model, len ) } stock fm_cs_reset_user_model( player ) {     // Player doesn't have a custom model any longer     g_has_custom_model[player] = false         dllfunc( DLLFunc_ClientUserInfoChanged, player, engfunc( EngFunc_GetInfoKeyBuffer, player ) ) }

None of those worked. It was on top in plugins.ini ..
KaLoIaN is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-07-2016 , 06:57   Re: Hooking client sided clcmd [HELP!]
Reply With Quote #5

Try :

PHP Code:
public fw_SetClientKeyValueid, const infobuffer[], const key[] )
{
    if ( 
equalkey"model" ) )
     return 
FMRES_SUPERCEDE;
   
    return 
FMRES_IGNORED;

It will block only player to change his model but it won't block console message.
Anyway try yourself.
siriusmd99 is offline
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 07-07-2016 , 08:51   Re: Hooking client sided clcmd [HELP!]
Reply With Quote #6

Again not working..
KaLoIaN is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 07-07-2016 , 09:09   Re: Hooking client sided clcmd [HELP!]
Reply With Quote #7

Check out my plugin to see how it's done.

https://forums.alliedmods.net/showthread.php?t=284632

Basically the same idea, different cvar/setinfo value.
__________________

Last edited by gabuch2; 07-07-2016 at 09:11.
gabuch2 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-07-2016 , 10:40   Re: Hooking client sided clcmd [HELP!]
Reply With Quote #8

Hook ClientUserInfoChanged, not SetClientKeyValue in order to "block" "model" command.
__________________
HamletEagle is offline
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 07-08-2016 , 14:12   Re: Hooking client sided clcmd [HELP!]
Reply With Quote #9

So how it should look like?
By the way I think I forgot to register the forward in plugin_init if no one noticed lol?

Last edited by KaLoIaN; 07-08-2016 at 14:13.
KaLoIaN is offline
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 07-09-2016 , 13:59   Re: Hooking client sided clcmd [HELP!]
Reply With Quote #10

Allright, no one noticed lol
KaLoIaN is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode