Skip to content

Commit

Permalink
Merge branch 'hotfix/v1.0.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
kgns committed Sep 4, 2017
2 parents ba37c18 + 43ca13d commit 7381e45
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 70 deletions.
Binary file modified addons/sourcemod/plugins/weapons.smx
Binary file not shown.
52 changes: 3 additions & 49 deletions addons/sourcemod/scripting/weapons.sp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
public Plugin myinfo =
{
name = "Weapons & Knives",
author = "kgns - wasdzone",
author = "kgns | pluginal.com",
description = "All in one custom weapon management",
version = "1.0.10",
url = "http://www.wasdzone.com"
version = "1.0.11",
url = "https://pluginal.com"
};

public void OnPluginStart()
Expand All @@ -61,7 +61,6 @@ public void OnPluginStart()
RegConsoleCmd("sm_knife", CommandKnife);
RegConsoleCmd("sm_nametag", CommandNameTag);
RegConsoleCmd("sm_wslang", CommandWSLang);
//RegConsoleCmd("sm_reportdata", CommandReportData);

PTaH(PTaH_GiveNamedItemPre, Hook, GiveNamedItemPre);
PTaH(PTaH_GiveNamedItem, Hook, GiveNamedItem);
Expand Down Expand Up @@ -329,48 +328,3 @@ public Action ReserveAmmoTimer(Handle timer, DataPack pack)
SetEntData(clientIndex, offset, ammo, 4, true);
}
}

/*
public void ReportEconData(int client, const CEconItemView item)
{
PrintToConsole(client, "GetDefinitionIndex: %d", item.GetItemDefinition().GetDefinitionIndex());
PrintToConsole(client, "GetCustomPaintKitIndex: %d", item.GetCustomPaintKitIndex());
PrintToConsole(client, "GetCustomPaintKitWear: %f", item.GetCustomPaintKitWear());
PrintToConsole(client, "GetCustomPaintKitSeed: %d", item.GetCustomPaintKitSeed());
PrintToConsole(client, "GetStatTrakKill: %d", item.GetStatTrakKill());
PrintToConsole(client, "GetQuality: %d", item.GetQuality());
PrintToConsole(client, "GetAccountID: %d", item.GetAccountID());
PrintToConsole(client, "GetOrigin: %d", item.GetOrigin());
PrintToConsole(client, "GetFlags: %d", item.GetFlags());
PrintToConsole(client, "GetRarity: %d", item.GetRarity());
char tag[128];
item.GetCustomName(tag, sizeof(tag));
PrintToConsole(client, "GetCustomName: %s", tag);
PrintToConsole(client, "IsCustomItemView: %d", item.IsCustomItemView());
}
public void ReportWeaponData(int client, int entity)
{
PrintToConsole(client, "m_iItemIDLow: %d", GetEntProp(entity, Prop_Send, "m_iItemIDLow"));
PrintToConsole(client, "m_nFallbackPaintKit: %d", GetEntProp(entity, Prop_Send, "m_nFallbackPaintKit"));
PrintToConsole(client, "m_flFallbackWear: %f", GetEntPropFloat(entity, Prop_Send, "m_flFallbackWear"));
PrintToConsole(client, "m_nFallbackSeed: %d", GetEntProp(entity, Prop_Send, "m_nFallbackSeed"));
PrintToConsole(client, "m_nFallbackStatTrak: %d", GetEntProp(entity, Prop_Send, "m_nFallbackStatTrak"));
PrintToConsole(client, "m_iEntityQuality: %d", GetEntProp(entity, Prop_Send, "m_iEntityQuality"));
PrintToConsole(client, "m_iAccountID: %d", GetEntProp(entity, Prop_Send, "m_iAccountID"));
PrintToConsole(client, "m_OriginalOwnerXuidLow: %d", GetEntProp(entity, Prop_Send, "m_OriginalOwnerXuidLow"));
PrintToConsole(client, "m_nModelIndex: %d", GetEntProp(entity, Prop_Send, "m_nModelIndex"));
PrintToConsole(client, "m_nViewModelIndex: %d", GetEntProp(entity, Prop_Send, "m_nViewModelIndex"));
PrintToConsole(client, "m_hOwnerEntity: %d", GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity"));
PrintToConsole(client, "m_hPrevOwner: %d", GetEntPropEnt(entity, Prop_Send, "m_hPrevOwner"));
PrintToConsole(client, "m_iPrimaryReserveAmmoCount: %d", GetEntProp(entity, Prop_Send, "m_iPrimaryReserveAmmoCount"));
PrintToConsole(client, "m_iClip1: %d", GetEntProp(entity, Prop_Send, "m_iClip1"));
}
public Action CommandReportData(int client, int args)
{
int activeWeaponClient = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
ReportWeaponData(client, activeWeaponClient);
ReportEconData(client, PTaH_GetEconItemViewFromWeapon(activeWeaponClient));
}
*/
26 changes: 5 additions & 21 deletions addons/sourcemod/scripting/weapons/hooks.sp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ public void UnhookPlayer(int client)
SDKUnhook(client, SDKHook_OnTakeDamageAlive, OnTakeDamageAlive);
}

public Action GiveNamedItemPre(int client, char classname[64], CEconItemView &item)
public Action GiveNamedItemPre(int client, char classname[64], CEconItemView &item, bool &ignoredCEconItemView)
{
if (IsValidClient(client))
{
if (g_iKnife[client] != 0 && IsKnifeClass(classname) && !StrEqual(classname, g_WeaponClasses[g_iKnife[client]]))
if (g_iKnife[client] != 0 && IsKnifeClass(classname))
{
Format(classname, sizeof(classname), g_WeaponClasses[g_iKnife[client]]);
ignoredCEconItemView = true;
strcopy(classname, sizeof(classname), g_WeaponClasses[g_iKnife[client]]);
return Plugin_Changed;
}
}
Expand All @@ -42,30 +43,13 @@ public Action GiveNamedItemPre(int client, char classname[64], CEconItemView &it

public void GiveNamedItem(int client, const char[] classname, const CEconItemView item, int entity)
{
if (entity > -1 && IsValidClient(client))
if (IsValidClient(client) && IsValidEntity(entity))
{
int index;
if (g_smWeaponIndex.GetValue(classname, index))
{
if (IsKnifeClass(classname))
{
/*
int defIndex;
g_smWeaponDefIndex.GetValue(g_WeaponClasses[g_iKnife[client]], defIndex);
char knifeClassName[32];
GetWeaponClass(entity, knifeClassName, sizeof(knifeClassName));
CEconItemView playerItem = PTaH_GetItemInLoadout(client, GetClientTeam(client), 0);
int playerKnifeDefIndex = playerItem.GetItemDefinition().GetDefinitionIndex();
if(!StrEqual(knifeClassName, g_WeaponClasses[g_iKnife[client]]) || defIndex == playerKnifeDefIndex)
{
float origin[3], angles[3];
GetClientAbsOrigin(client, origin);
GetClientAbsAngles(client, angles);
RemovePlayerItem(client, entity);
AcceptEntityInput(entity, "KillHierarchy");
entity = PTaH_SpawnItemFromDefIndex(defIndex, origin, angles);
}
*/
EquipPlayerWeapon(client, entity);
}
SetWeaponProps(client, entity);
Expand Down

0 comments on commit 7381e45

Please sign in to comment.