Hi all. I'm new to scripting but I'm trying to create a fairly simple script that swaps the classes of two players. However, I'm getting the above error message and don't know how to fix it. Any help is appreciated.
Code:
#pragma semicolon 1;
#include <sourcemod>
#include <tf2>
#include <tf2_stocks>
#define PLUGIN_VERSION "1.2"
new Handle:cs_enabled = INVALID_HANDLE;
new Handle:swapclass = INVALID_HANDLE;
public Plugin:myinfo =
{
name = "Class Swap",
author = "badlet",
description = "you become their class, they become yours",
version = PLUGIN_VERSION,
};
public OnPluginStart()
{
new person1_id = GetEventInt(event, "userid1");
new person2_id = GetEventInt(event, "userid2");
new person1 = GetClientofUserID(person1_id);
new person2 = GetClientofUserID(person2_id);
RegAdminCmd("sm_cs_enable",Command_enable,ADMFLAG_SLAY,"Enable class swap");
RegAdminCmd("sm_cs_disable",Command_disable,ADMFLAG_SLAY,"Disable class swap");
RegAdminCmd("sm_swapclass",Command_Swapclass,ADMFLAG_SLAY,"Swap classes");
}
public Action:Command_Swapclass(client, args)
{
if(args != 2)
{
ReplyToCommand(client, "[SM] Usage: sm_swapclass \"target1\" \"target2\"");
}
else
{
TF2_SetPlayerClass(person1, TFClassType:TF2_GetPlayerClass(person2, 0, 1);
TF2_SetPlayerClass(person2, TFClassType:TF2_GetPlayerClass(person1, 0, 1);
}
}
public Action:Command_enable(client, args)
{
cs_enabled=true;
ReplyToCommand(client,"Class Swap Enabled");
}
public Action:Command_disable(client, args)
{
cs_enabled=false;
ReplyToCommand(client,"Class Swap Disabled");
}