Item Categories - a feature that will give a player a extra option to return to categories on the first and last page after they have choosen a category. This will make it less annoying to players whom wish to browse all the categories without having to retype in the shopmenu command.
for Item Creation:
I have created 2 new natives for war3source.
/*
War3_TFSetItemClasses(itemid, and then use ItemClassString
separted by comma )
example:
War3_TFSetItemClasses(itemid,sniper,medic,scout)
if you want all classes then don't assign anything OR you can
use:
War3_TFSetItemClasses(itemid,all)
As many classes that you want this item to have access to.
enum ItemClassString
{
all = TFClass_Unknown,
scout = TFClass_Scout,
sniper = TFClass_Sniper,
soldier = TFClass_Soldier,
demoman = TFClass_DemoMan,
medic = TFClass_Medic,
heavy = TFClass_Heavy,
pyro = TFClass_Pyro,
spy = TFClass_Spy,
engineer = TFClass_Engineer
}
*/
native War3_TFSetItemClasses(itemid,any:...);
Here is another code if you want to check if a item is for a
certain class.
// If TFClassType is set for TFClass_Unknown, then all classes
have access to this item.
// use War3_TFIsItemClass(itemid,TF2_GetPlayerClass(client));
/*
01: enum TFClassType
02: {
03: TFClass_Unknown = 0,
04: TFClass_Scout,
05: TFClass_Sniper,
06: TFClass_Soldier,
07: TFClass_DemoMan,
08: TFClass_Medic,
09: TFClass_Heavy,
10: TFClass_Pyro,
11: TFClass_Spy,
12: TFClass_Engineer
13: };
*/
native War3_TFIsItemClass(itemid,TFClassType:iPlayerClass);
Here is an example code of how to use it:
Code:
#pragma semicolon 1
#include <sourcemod>
//#include <sdktools_functions>
#include "W3SIncs/War3Source_Interface"
new thisItem;
public Plugin:myinfo= {
name="War3Source Shopitem - (Medic Only) Insta Uber",
author="El Diablo",
description="War3Source",
version="1.0",
url="http://www.war3source.com/"
};
public OnPluginStart()
{
LoadTranslations("w3s.item.uberme.phrases");
}
public OnWar3LoadRaceOrItemOrdered2(num)
{
if(num==10)
{
thisItem=War3_CreateShopItemT("uberme",100,3000);
War3_TFSetItemClasses(thisItem,medic);
}
}
public OnWar3Event(W3EVENT:event, client)
{
if(event == CanBuyItem)
{
new item = W3GetVar(EventArg1);
if(item==thisItem && TF2_GetPlayerClass(client)!=TFClass_Medic)
{
W3SetVar(EventArg2, 0);
War3_ChatMessage(client, "Only Medics can buy this item!");
//War3_SetGold(client,100);
//War3_SetOwnsItem(client,item,false);
//PrintToChat(client,"Store refunded your gold.");
}
else W3SetVar(EventArg2, 1);
}
}
public OnItemPurchase(client,item)
{
if(item==thisItem&&ValidPlayer(client) && TF2_GetPlayerClass(client)==TFClass_Medic)
{
if (GetEntProp(client, Prop_Send, "m_iClass") == 5)
{
//`EquipPlayerWeapon(client, tf_weapon_medigun);
TF_SetUberLevel(client, 100.0);
War3_SetOwnsItem(client,item,false);
}
//War3_SetOwnsItem(client,item,true);
//War3_SetBuffItem(client,fArmorPhysical,item,6.0);
}
}
stock TF_SetUberLevel(client, Float:uberlevel)
{
new index = GetPlayerWeaponSlot(client, 1);
if (index > 0)
SetEntPropFloat(index, Prop_Send, "m_flChargeLevel", uberlevel*0.01);
}
/*
public OnWar3EventDeath(victim){
if(War3_GetOwnsItem(victim,thisItem)){
War3_SetOwnsItem(victim,thisItem,false);
War3_SetBuffItem(victim,fArmorPhysical,thisItem,0.0);
}
}
*/
#include <sourcemod>
//#include <sdktools_functions>
#include "W3SIncs/War3Source_Interface"
new thisItem;
public Plugin:myinfo= {
name="War3Source Shopitem - (Medic Only) Insta Uber",
author="El Diablo",
description="War3Source",
version="1.0",
url="http://www.war3source.com/"
};
public OnPluginStart()
{
LoadTranslations("w3s.item.uberme.phrases");
}
public OnWar3LoadRaceOrItemOrdered2(num)
{
if(num==10)
{
thisItem=War3_CreateShopItemT("uberme",100,3000);
War3_TFSetItemClasses(thisItem,medic);
}
}
public OnWar3Event(W3EVENT:event, client)
{
if(event == CanBuyItem)
{
new item = W3GetVar(EventArg1);
if(item==thisItem && TF2_GetPlayerClass(client)!=TFClass_Medic)
{
W3SetVar(EventArg2, 0);
War3_ChatMessage(client, "Only Medics can buy this item!");
//War3_SetGold(client,100);
//War3_SetOwnsItem(client,item,false);
//PrintToChat(client,"Store refunded your gold.");
}
else W3SetVar(EventArg2, 1);
}
}
public OnItemPurchase(client,item)
{
if(item==thisItem&&ValidPlayer(client) && TF2_GetPlayerClass(client)==TFClass_Medic)
{
if (GetEntProp(client, Prop_Send, "m_iClass") == 5)
{
//`EquipPlayerWeapon(client, tf_weapon_medigun);
TF_SetUberLevel(client, 100.0);
War3_SetOwnsItem(client,item,false);
}
//War3_SetOwnsItem(client,item,true);
//War3_SetBuffItem(client,fArmorPhysical,item,6.0);
}
}
stock TF_SetUberLevel(client, Float:uberlevel)
{
new index = GetPlayerWeaponSlot(client, 1);
if (index > 0)
SetEntPropFloat(index, Prop_Send, "m_flChargeLevel", uberlevel*0.01);
}
/*
public OnWar3EventDeath(victim){
if(War3_GetOwnsItem(victim,thisItem)){
War3_SetOwnsItem(victim,thisItem,false);
War3_SetBuffItem(victim,fArmorPhysical,thisItem,0.0);
}
}
*/
The new natives basically prevent classes you don't allow to have access to the item you create by preventing them from even seeing the item. Instead of just denying and annoying players whom will then ask you repeated questions, we decided to not deny them...but instead just make it only visible to the classes we wish to have access to them.
1 single line of code added to your item will give you this benefit.
I have not yet udpated war3source with this new code yet, but I plan to add this. If you reject me adding this, please add your statements below...




Logged




DarkEnergy