View Single Post
Author Message
Ibanezez
SourceMod Donor
Join Date: Aug 2014
Location: Earth
Old 09-06-2014 , 16:22   [TF2] Help editing KSON plugin?
Reply With Quote #1

I'm trying to edit this plugin so the client gets a message when they type !kson or !ksoff. The only problem is, I can't compile because of an error that the plugin already had before I edited it. How can I fix this?

Code:
new bool:kstoggle[MAXPLAYERS + 1];

public OnPluginStart()
{
	RegConsoleCmd( "sm_kson", Cmd_Enable, "[DTC] Weapon Killstreak Enabled!");
	RegConsoleCmd( "sm_ksoff", Cmd_Disable, "[DTC] Weapon Killstreak Disabled!");
	HookEvent("player_spawn", Event_PlayerSpawn);
}

public Action:Cmd_Enable( client, args )
{
	if (IsValidClient(client))
	{
		SetEntProp( client, Prop_Send, "m_iKillStreak", 100 );
		kstoggle[client] = true;
		return Plugin_Handled;
	}
}

public Action:Cmd_Disable( client, args )
{
	if (IsValidClient(client))
	{
		SetEntProp( client, Prop_Send, "m_iKillStreak", 0);
		kstoggle[client] = false;
		return Plugin_Handled;
	}
}

public Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	
	if (IsValidClient(client))
	{
		if (kstoggle[client])
		{
			SetEntProp( client, Prop_Send, "m_iKillStreak", 100);
		}
		else
		{
			SetEntProp( client, Prop_Send, "m_iKillStreak", 0);
		}
	}
}

stock bool:IsValidClient(client)
{
	if (client <= 0 || client > MaxClients) return false;
	if (!IsClientInGame(client)) return false;
	if (IsClientSourceTV(client) || IsClientReplay(client)) return false;
	return true;
}

public OnClientDisconnect(client)
{
	kstoggle[client] = false;
}
That is the one I've edited, to make it say "[DTC] Killstreak enabled to: 0" when I turn it off, and "[DTC] Killstreak enabled to 100" when I turn it on. Am I doing this correctly? And how can I fix this error?

(62) error 017: undefined symbol "IsClientSourceTV"

and the warnings:

(29) warning 209: function "Cmd_Enable" should return a value
(39) warning 209: function "Cmd_Disable" should return a value

Thanks for taking the time to read this!
__________________
Hello
Ibanezez is offline