Hey, I've been tinkering around with other plugins to try to learn the language, and decided to try to write my own plugin that lets a player on a certain team respawn spectators. This is what I've got:
Code:
// ZM Respawn
#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "0.1"
public Plugin:myinfo =
{
name = "ZM Respawn",
author = "Handmade.Mercury",
description = "Allows the Zombie Master to respawn spectators.",
version = PLUGIN_VERSION,
}
public OnPluginStart()
{
RegConsoleCmd("sm_respawn", Command_ZMRespawn);
}
public Action:Command_ZMRespawn(client, args)
{
PrintToServer("Mark 1");
if (GetClientTeam(client) != 3)
{
PrintToServer("Only the Zombie Master can respawn players.");
return Plugin_Handled;
}
PrintToServer("Mark 2");
for (new i=0; i<=MaxClients; i++)
{
PrintToServer("Looping clients...");
if (IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == 1)
{
PrintToServer("Changing client team...");
ChangeClientTeam(i, 2);
}
}
PrintToServer("The Zombie Master has respawned all players.");
return Plugin_Handled;
}
I reloaded the plugin on my server, and then asked the person on team 3 to type "!respawn". I was logged into my server via HLSW, and checked the console, and there was nothing there. In-game, nothing happens. Could someone maybe point out what I'm doing wrong?