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_hCheck, OnValueChange);
}
}
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(cvar, 0);
}
}
Keep in mind that with what you're requesting you will make everyone's crosshair dissapear, on any team.
Spectator included.