Hello,
I am trying to make a plugin that makes a player invisible (partially invisible) when they have a specific weapon pulled out (knife). This is what i have so far, it compilied fine but does not work.
Anyone that has some input, help would be greatly appreciated.
Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#define PL_VERSION "0.1"
new Handle:g_hAmount;
public Plugin:myinfo = {
name = "Knife Invisible",
author = "MUNDA",
description = "Knife out = invisible",
version = PL_VERSION,
url = "http://www.gamerzgonewild.com/"
};
public OnPluginStart() {
CreateConVar("sm_knife_invisible_version", PL_VERSION, "Knife out = invisible", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
g_hAmount = CreateConVar("sm_knife_invisible_amount", "150", "Amount of visibility", FCVAR_PLUGIN, true, 0.0, true, 255.0);
RegConsoleCmd("lastinv", Command_Weapon);
RegConsoleCmd("invnext", Command_Weapon);
RegConsoleCmd("invprev", Command_Weapon);
RegConsoleCmd("slot1", Command_Weapon);
RegConsoleCmd("slot2", Command_Weapon);
RegConsoleCmd("slot3", Command_Weapon);
RegConsoleCmd("slot4", Command_Weapon);
RegConsoleCmd("slot5", Command_Weapon);
RegConsoleCmd("slot6", Command_Weapon);
RegConsoleCmd("slot7", Command_Weapon);
RegConsoleCmd("slot8", Command_Weapon);
RegConsoleCmd("slot9", Command_Weapon);
RegConsoleCmd("slot10", Command_Weapon);
}
public Action:Command_Weapon(client, args) {
decl String:sWeapon[32];
GetClientWeapon(client, sWeapon, sizeof(sWeapon));
SetEntData(client, FindSendPropInfo("CBasePlayer", "m_clrRender") + 3, StrEqual(sWeapon, "weapon_knife") ? GetConVarInt(g_hAmount) : 255, 1, true);
return Plugin_Continue;
}