Raised This Month: $ Target: $400
 0% 

No effect after SendConVarValue


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XuluniX
Junior Member
Join Date: Jun 2013
Old 09-13-2015 , 16:52   No effect after SendConVarValue
Reply With Quote #1

I try to pervent ghosting by setting "mp_forcecamera" to "2" if a player without admin dies.
The Convar gets changed on the dead client but it has no visual effect.
I use
Code:
SendConVarValue(player, mp_forcecamera, "2");
to change the convar on the client, if i check the cvar on the clientconsole it is set to 2 bt i can still spectate players.

Did i miss something?
XuluniX is offline
XuluniX
Junior Member
Join Date: Jun 2013
Old 09-15-2015 , 17:00   Re: No effect after SendConVarValue
Reply With Quote #2

Or is there some other way to block non-admins from spectating any players?
XuluniX is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-15-2015 , 22:23   Re: No effect after SendConVarValue
Reply With Quote #3

SendConVarValue() doesn't exist in AMX Mod X. Are you trying to do something with SourceMod? If yes, you'll probably want to post in the SourceMod forums.
__________________
fysiks is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 09-15-2015 , 23:40   Re: No effect after SendConVarValue
Reply With Quote #4

Anyways, you need DHook module and a script like this.

PHP Code:
#include <sourcemod>
#include <dhooks>
#include <cstrike>

#define COMMAND_ACCESS   "sm_chat"          /** REQUIRED ACCESS FOR ESP (ANY COMMAND YOU WANT) */
#define FLAG_ACCESS      ADMFLAG_BAN       /** IF COMMAND NOT FOUND, REQUIRED FLAG (ANY FLAG YOU WANT) */

Handle g_MP_FC =         INVALID_HANDLE;   /** MP_FORCECAMERA */
Handle g_IsValidTarget INVALID_HANDLE;

public 
void OnPluginStart()
{
    if (
g_MP_FC ==    INVALID_HANDLEg_MP_FC =  FindConVar("mp_forcecamera");
    if (
g_MP_FC !=    INVALID_HANDLE)
    {
        
Handle Data LoadGameConfigFile("allow-spec.games");
        if (
Data !=   INVALID_HANDLE)
        {
            
g_IsValidTarget =      DHookCreate(GameConfGetOffset(Data"IsValidObserverTarget"), HookType_Entity, \
                
ReturnType_BoolThisPointer_CBaseEntityIsValidTarget);

            if (
g_IsValidTarget != INVALID_HANDLE)
            {
                
DHookAddParam(g_IsValidTargetHookParamType_CBaseEntity);
            }

            
CloseHandle(Data);
        }
    }
}

public 
void OnClientPostAdminCheck(Client)
{
    if (
g_MP_FC != INVALID_HANDLE && g_IsValidTarget != INVALID_HANDLE && \
        !
IsFakeClient(Client) &&     !IsClientInKickQueue(Client)      && !IsClientSourceTV(Client) && \
        
CheckCommandAccess(Client,   COMMAND_ACCESS,                      FLAG_ACCESS))
    {
        
SendConVarValue(Client,      g_MP_FC,                             "0");
        
DHookEntity(g_IsValidTargettrue,                                Client);
    }
}

public 
MRESReturn IsValidTarget(int OwnerHandle Return, Handle Params)
{
    static 
int Target;

    if (
DHookIsNullParam(Params1)     || \
        
Owner || Owner MaxClients || \
        !
IsClientInGame(Owner)          || IsPlayerAlive(Owner) || GetClientTeam(Owner) <= CS_TEAM_SPECTATOR || \
        
IsClientInKickQueue(Owner)      || IsClientSourceTV(Owner))
    {
        return 
MRES_Ignored;
    }

    
Target DHookGetParam(Params1);
    if (
Target || Target MaxClients || \
        !
IsClientInGame(Target)           || !IsPlayerAlive(Target) || GetClientTeam(Target) <= CS_TEAM_SPECTATOR || \
        
IsClientInKickQueue(Target)       || IsClientSourceTV(Target))
    {
        return 
MRES_Ignored;
    }

    
DHookSetReturn(Return, true);

    return 
MRES_Override;

Also, this thread must be moved to SourceMod forums.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
XuluniX
Junior Member
Join Date: Jun 2013
Old 10-17-2015 , 16:22   Re: No effect after SendConVarValue
Reply With Quote #5

First, sorry for being quiet that long, had some other stuff to do.
Yep, seems like i posted i the wrong forum, sorry for that too.
It is a sourcemod plugin for CS:GO.

I added the allow-spec.games file with the offsets for CSGO but the plugin doesn't do anything.
Did i miss something? I didn't use hooks before
XuluniX 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 12:57.


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