PHP Code:
/* * *
* tf2items code written with help from asherkin
* * */
#include <sourcemod>
#include <sdktools>
#include <tf2items>
new Handle:Heavy_Sandvich = INVALID_HANDLE;
public Plugin:myinfo =
{
name = "sandvichtest",
author = "CoolJosh3k",
description = "Swaps the stock shotgun for a sandvich",
version = "1.0.0",
url = ""
}
public OnPluginStart()
{
Heavy_Sandvich = TF2Items_CreateItem(OVERRIDE_ALL | FORCE_GENERATION);
TF2Items_SetClassname(Heavy_Sandvich, "tf_weapon_lunchbox");
TF2Items_SetItemIndex(Heavy_Sandvich, 42);
TF2Items_SetQuality(Heavy_Sandvich, 6);
TF2Items_SetLevel(Heavy_Sandvich, 1);
TF2Items_SetNumAttributes(Heavy_Sandvich, 0);
}
public Action:TF2Items_OnGiveNamedItem(client, String:classname[], iItemDefinitionIndex, &Handle:hItem)
{
if (iItemDefinitionIndex == 11)
{
hItem = Heavy_Sandvich;
return Plugin_Changed;
}
return Plugin_Continue;
}
That sample from my code, doesn't work quite as planned.
If the player has a heavy stock shotgun, I want to force a sandvich instead. It does take the shotgun away, but it does not replace it with the sandvich.
The versions are:
Code:
] meta version
Metamod:Source version 1.9.1
Build ID: 805:44644c375f80
Loaded As: Valve Server Plugin
Compiled on: Dec 23 2012
Plugin interface version: 15:14
SourceHook version: 5:5
http://www.metamodsource.net/
] sm version
SourceMod Version Information:
SourceMod Version: 1.5.0-dev+3838
SourcePawn Engine: SourcePawn 1.1, jit-x86 (build 1.5.0-dev+3838)
SourcePawn API: v1 = 4, v2 = 4
Compiled on: May 3 2013 12:46:42
Build ID: 3838:32bab19b2f64
http://www.sourcemod.net/
] tf2items_version
"tf2items_version" = "1.5.3"
notify singleplayer replicated
- TF2 Items Version