I just make a plugin that move player to spectate by use !spec <TARGET>
PHP Code:
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR "Stylish"
#define PLUGIN_VERSION "1.0"
#include <cstrike>
#include <sourcemod>
#include <sdktools>
#pragma newdecls required
public Plugin myinfo =
{
name = "Spectate",
author = PLUGIN_AUTHOR,
description = "Move player to spectate",
version = PLUGIN_VERSION,
url = ""
};
#define CMD_PREFIX "[SM] "
public void OnPluginStart()
{
RegAdminCmd("sm_spec", CMD_Spec, ADMFLAG_KICK, "Set player to spectator");
}
public Action:CMD_Spec(int client, int args) //Move the player to spectators
{
if (!IsClientValid(client) || !IsClientInGame(client))
{
return Plugin_Handled;
}
if (args != 1)
{
ReplyToCommand(client, "Usage: sm_spec <target>");
return Plugin_Handled;
}
new String:target_string[65];
GetCmdArg(1, target_string, sizeof(target_string));
new String:target_name[MAX_TARGET_LENGTH],
target_list[MAXPLAYERS],
bool:tn_is_ml,
target_count;
if ((target_count = ProcessTargetString(target_string, client, target_list, MAXPLAYERS, COMMAND_FILTER_CONNECTED, target_name, sizeof(target_name), tn_is_ml)) <= 0)
{
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (new i = 0; i < target_count; i++)
{
ChangeClientTeam(target_list[i], CS_TEAM_SPECTATOR);
}
return Plugin_Handled;
}
bool:IsClientValid(client)
{
return ((client > 0) && (client <= MaxClients));
}
But i still gettig those errors
Code:
sm_spec.sp
E:\******************\Plugins\sm_spec.sp(30) : error 147: new-style declarations are required
E:\******************\Plugins\sm_spec.sp(43) : error 147: new-style declarations are required
E:\******************\Plugins\sm_spec.sp(46) : error 147: new-style declarations are required
E:\******************\Plugins\sm_spec.sp(49) : error 147: new-style declarations are required
E:\******************\Plugins\sm_spec.sp(57) : error 147: new-style declarations are required
E:\******************\Plugins\sm_spec.sp(65) : error 147: new-style declarations are required
Done
Can someone help me fixing them?