Raised This Month: $ Target: $400
 0% 

[TF2] Search player with determinied class doesn't work..?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
cidra
Junior Member
Join Date: Jun 2016
Location: Italy
Old 07-04-2016 , 18:03   [TF2] Search player with determinied class doesn't work..?
Reply With Quote #1

Hi. I'm trying to make a plugin that checks if a specified class is a bot or not while on the class menu.
At the begin i looked this plugin and got some ideas from it.

This is the code:
Code:
#include <sourcemod>
#include <tf2_stocks>

public OnPluginStart()
{
	HookEvent ("player_changeclass", Event_ChangeClass);
}

public Event_ChangeClass(Handle:event, const String:name[], bool:dontBroadcast)
{
	new iClient = GetClientOfUserId (GetEventInt (event, "userid")),
		iClass = GetEventInt (event, "class"),
		iTeam = GetClientTeam (iClient);
		
	PrintToChatAll("Test123 %d",iClass);	
	if (IsBotIn(iTeam, iClass))
		{
		PrintToChatAll("BOT SI.");
		}
	else
		{
		PrintToChatAll("BOT NO.");
		}
}
	
bool:IsBotIn(iTeam, iClass)
{
	int i;
	for (i = 0; i <= MAXPLAYERS ; i++)
	if(TF2_GetPlayerClass(i) == iClass && GetClientTeam(i) == iTeam)
		{
		if (IsFakeClient(i))
			{
			return true;
			}
		else if (!IsFakeClient(i))
			{
			return false;
			}
		break;
		}
return false;
}
The problem is that "BOT SI" and "BOT NO" never get printed. What is the problem? I just want to do a specified command if there's a bot using the class chosen on the class menu and another command if there's not. What's wrong?
cidra 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 21:34.


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