View Single Post
Author Message
MeepWagon
New Member
Join Date: Sep 2019
Old 09-02-2019 , 14:47   Help? Im like, new to coding.
Reply With Quote #1

Okay, so basically im trying to make this. Thing is though, there is all this junk "sm_gi @me 298 1 100 -1 0 0 tf_weapon_minigun "129 ; 5" ". I want it to be more like -
"sm_gi @me tf_weapon_rocketlauncher "129 ; 5".

I think if you read my code youll see what im trying (and failing) to do, and would much appreciate some help

Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"

#include <sourcemod>
#include <sdktools>
#include <tf2>
#include <tf2_stocks>
#include <sdkhooks>
#define REQUIRE_EXTENSIONS
#include <tf2items>

public Plugin myinfo = 
{
	name = "",
	author = PLUGIN_AUTHOR,
	description = "",
	version = PLUGIN_VERSION,
	url = ""
};

public void OnPluginStart()
{
		RegConsoleCmd("Test_Command", Command_Test)
}

public action:Command_Test(client, args)
{
		decl String:arg1[64];
		decl String:arg2[64];
		decl bool:tn_is_ml;
		decl String:target_name[MAX_NAME_LENGTH];
		decl target_list[MAXPLAYERS];
		decl target_count;
		
		GetCmdArg(1, arg1, sizeof(arg1));
			if ((target_count = ProcessTargetString(
			arg1,
			client,
			target_list,
			MAXPLAYERS,
			COMMAND_FILTER_NO_BOTS,
			target_name,
			sizeof(target_name),
			tn_is_ml)) <= 0)
	{
		ReplyToTargetError(client, target_count);
		return Plugin_Handled;
	}
	
	new Handle:newItem = TF2Items_CreateItem(OVERRIDE_ALL);
	
	idx = GetDefaultWeaponIndex(TF2_GetPlayerClass(victim), TFWeaponSlot_Primary)
	
	
	
	stock GetDefaultWeaponIndex(TFClassType:class, id, index)
	{
	static defwep[TFClassType][3][1] = {
		{"TF_Weapon_Scattergun", "TF_Weapon_Pistol", "TF_Weapon_Bat"},	{13},							//Scout
		{"TF_Weapon_SniperRifle", "TF_Weapon_SMG", "TF_Weapon_Club"},	{14},							//Sniper
		{"TF_Weapon_RocketLauncher", "TF_Weapon_Shotgun_Soldier", "TF_Weapon_Shovel"}	{18},			//Soldier
		{"TF_Weapon_GrenadeLauncher", "TF_Weapon_PipeBombLauncher", "TF_Weapon_Bottle"},	{19},		//Demoman
		{"TF_Weapon_Syringegun_Medic", "TF_Weapon_Medigun", "TF_Weapon_Bonesaw"},	{17},				//Medic
		{"TF_Weapon_Minigun", "TF_Weapon_Shotgun_HWG", "TF_Weapon_Fists"},	{21},						//Heavy
		{"TF_Weapon_Flamethrower", "TF_Weapon_Shotgun_Pyro", "TF_Weapon_Fireaxe"},	{21},				//Pyro
		{"TF_Weapon_Revolver", "TF_Weapon_Builder", "TF_Weapon_Knife"},		{24},						//Spy
		{"TF_Weapon_Shotgun_Primary", "TF_Weapon_Pistol", "TF_Weapon_Wrench"},	{9},					//Engineer
	}
	return defwep[class][id][index];
}	
	
	GetCmdArg(2, arg2, sizeof(arg2));
	new thisShouldFail = StringToInt(arg2);
	if (thisShouldFail == 0)
	{
		if (StringToInt(arg2) == defwep[id])
		{
			TF2Items_SetClassname(newItem, StringToInt(arg2));
			TF2Items_SetItemIndex(newItem, defwep[index]);
		}
	}
	
}
MeepWagon is offline