Raised This Month: $51 Target: $400
 12% 

[TF2] Help editing KSON plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
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
Jug
Junior Member
Join Date: Jul 2011
Old 09-06-2014 , 23:09   Re: [TF2] Help editing KSON plugin?
Reply With Quote #2

IsClientSourceTV is under the clients.inc so you'll need to include it at the top.
It'd be a better idea to just include sourcemod since it'll have everything you'll need (including clients) or just include clients.

Code:
#include <sourcemod>
#include <clients>
As for the two warnings, you have them return values inside of
Code:
if (IsValidClient(client))
however lack returns outside of it so its assuming you meant for it to return something but is missing a proper return outside of the if statement.
Jug is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 09-07-2014 , 14:20   Re: [TF2] Help editing KSON plugin?
Reply With Quote #3

For the warnings, jug is wrong, the 2 functions for the 2 commands should have a
PHP Code:
return Plugin_Handled 
outside the if statements
__________________
WildCard65 is offline
Ibanezez
SourceMod Donor
Join Date: Aug 2014
Location: Earth
Old 09-10-2014 , 11:35   Re: [TF2] Help editing KSON plugin?
Reply With Quote #4

Do you think you could post the entire script here?
__________________
Hello
Ibanezez 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 00:43.


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