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

simple plugin won't load, says "bad header"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
badlet
Junior Member
Join Date: May 2020
Old 05-26-2020 , 21:31   simple plugin won't load, says "bad header"
Reply With Quote #1

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");
}
badlet is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 05-27-2020 , 04:14   Re: simple plugin won't load, says "bad header"
Reply With Quote #2

Since the code you gave here won't compile, it sounds like you're not actually even compiling and just trying to use the source code itself as a plugin.

The compiler turns source code into an actual plugin. You can run the compiler locally by getting it out of a SM release archive (spcomp or spcomp.exe depending on your platform; get the archive for the OS you want to run the compiler on, which may be different than what your server runs on). You can also use the web compiler at https://www.sourcemod.net/compiler.php or asherkin's alternate tool, Spider, at https://spider.limetech.io/.
Fyren is offline
badlet
Junior Member
Join Date: May 2020
Old 05-28-2020 , 08:19   Re: simple plugin won't load, says "bad header"
Reply With Quote #3

Wow thankyou yes I was doing that I'm new to scripting
badlet is offline
Reply


Thread Tools
Display Modes

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 08:31.


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