Raised This Month: $ Target: $400
 0% 

Force a player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
TrueSurvivor
Member
Join Date: Jun 2010
Old 05-19-2012 , 17:44   Re: Force a player
Reply With Quote #10

ClientCommand doesn't work for this, FakeClientCommand does.

PHP Code:
//Fix if user changes the value back.
new Handle:g_hCheck

public OnPluginStart()
{
    
HookEvent("player_spawn"Spawn)

    
//Link Cvar
    
g_hCheck FindConVar("cl_crosshair_alpha");

    if (
g_hCheck != INVALID_HANDLE)
    {
        
HookConVarChange(g_hCheckOnValueChange);
    }
}

public 
Action:Spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    
//Get Spawned Player's Info.
    
client GetClientOfUserId(GetEventInt(event"userid"))

    
//Make the player send the command.
    
ClientCommand(client"cl_crosshair_alpha 0");
}

public 
OnValueChange(Handle:cvar, const String:oldVal[], const String:newVal[])
{
    
//If Value is higher than 0, switch it to 0.
    
if (StringToInt(newVal) > 0)
    {
        
SetConVarInt(cvar0);
    }

Keep in mind that with what you're requesting you will make everyone's crosshair dissapear, on any team.
Spectator included.

Last edited by TrueSurvivor; 05-20-2012 at 06:28.
TrueSurvivor is offline
 



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 22:26.


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