Raised This Month: $32 Target: $400
 8% 

[CSGO] Weapon & Knives (Skins, Name Tags, StatTrak, Wear/Float) [!ws !knife !nametag]


Post New Thread Reply   
 
Thread Tools Display Modes
kgns
Senior Member
Join Date: May 2017
Location: Istanbul, Turkey
Old 09-20-2017 , 01:38   Re: [CSGO] Weapon & Knives (Skins, Name Tags, StatTrak, Wear/Float) [!ws !knife !name
Reply With Quote #231

Quote:
Originally Posted by MorreJaa View Post
put flag suport in ws and knife, you are the best!
lol..
__________________

OyunHost Sunucu Hizmetleri: https://www.oyunhost.net
kgns is offline
bongotrommler
Senior Member
Join Date: Feb 2013
Location: GG-Elite.Net
Old 09-21-2017 , 08:21   Re: [CSGO] Weapon & Knives (Skins, Name Tags, StatTrak, Wear/Float) [!ws !knife !name
Reply With Quote #232

Quote:
Originally Posted by MorreJaa View Post
put flag suport in ws and knife, you are the best!
if u need flag support check configs/admin_overrides.cfg :-)
bongotrommler is offline
tzzion
Member
Join Date: Oct 2016
Old 09-26-2017 , 22:31   Re: [CSGO] Weapon & Knives (Skins, Name Tags, StatTrak, Wear/Float management)
Reply With Quote #233

Quote:
Originally Posted by Sw33T3R View Post
I didn't find the solution to this problem...

Can someone help me?

Last edited by tzzion; 09-26-2017 at 22:32.
tzzion is offline
asdfxD
Veteran Member
Join Date: Apr 2011
Old 09-26-2017 , 23:26   Re: [CSGO] Weapon & Knives (Skins, Name Tags, StatTrak, Wear/Float management)
Reply With Quote #234

Quote:
Originally Posted by tzzion View Post
I didn't find the solution to this problem...

Can someone help me?
i had the same issue. update to the latest ptah https://forums.alliedmods.net/showthread.php?t=289289
asdfxD is offline
MBf
Member
Join Date: Aug 2016
Old 09-28-2017 , 13:57   Re: [CSGO] Weapon & Knives (Skins, Name Tags, StatTrak, Wear/Float) [!ws !knife !name
Reply With Quote #235

Hello,

I cant compile the plugin ...

Code:
/*  CS:GO Weapons&Knives SourceMod Plugin
 *
 *  Copyright (C) 2017 Kağan 'kgns' Üstüngel
 * 
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option) 
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with 
 * this program. If not, see http://www.gnu.org/licenses/.
 */

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#include <PTaH>

#pragma semicolon 1
#pragma newdecls required

#include "weapons/globals.sp"
#include "weapons/hooks.sp"
#include "weapons/helpers.sp"
#include "weapons/database.sp"
#include "weapons/config.sp"
#include "weapons/menus.sp"

public Plugin myinfo = 
{
	name = "Weapons & Knives",
	author = "kgns | pluginal.com",
	description = "All in one custom weapon management",
	version = "1.0.11",
	url = "https://pluginal.com"
};

public void OnPluginStart()
{
	LoadTranslations("weapons.phrases");
	
	g_Cvar_DBConnection = CreateConVar("sm_weapons_db_connection", "storage-local", "Database connection name in databases.cfg to use");
	g_Cvar_TablePrefix = CreateConVar("sm_weapons_table_prefix", "", "Prefix for database table (example: 'xyz_')");
	g_Cvar_ChatPrefix = CreateConVar("sm_weapons_chat_prefix", "[wasdzone]", "Prefix for chat messages");
	g_Cvar_KnifeStatTrakMode = CreateConVar("sm_weapons_knife_stattrak_mode", "0", "0: All knives show the same StatTrak counter (total knife kills) 1: Each type of knife shows its own separate StatTrak counter");
	g_Cvar_EnableFloat = CreateConVar("sm_weapons_enable_float", "1", "Enable/Disable weapon float options");
	g_Cvar_EnableNameTag = CreateConVar("sm_weapons_enable_nametag", "1", "Enable/Disable name tag options");
	g_Cvar_EnableStatTrak = CreateConVar("sm_weapons_enable_stattrak", "1", "Enable/Disable StatTrak options");
	g_Cvar_FloatIncrementSize = CreateConVar("sm_weapons_float_increment_size", "0.05", "Increase/Decrease by value for weapon float");
	
	AutoExecConfig(true, "weapons");
	
	RegConsoleCmd("sm_ws", CommandWeaponSkins);
	RegConsoleCmd("sm_knife", CommandKnife);
	RegConsoleCmd("sm_nametag", CommandNameTag);
	RegConsoleCmd("sm_wslang", CommandWSLang);
	
	PTaH(PTaH_GiveNamedItemPre, Hook, GiveNamedItemPre);
	PTaH(PTaH_GiveNamedItem, Hook, GiveNamedItem);
}

public void OnConfigsExecuted()
{
	GetConVarString(g_Cvar_DBConnection, g_DBConnection, sizeof(g_DBConnection));
	GetConVarString(g_Cvar_TablePrefix, g_TablePrefix, sizeof(g_TablePrefix));
	
	if(g_DBConnectionOld[0] != EOS && strcmp(g_DBConnectionOld, g_DBConnection) != 0 && db != null)
	{
		delete db;
		db = null;
	}
	
	if(db == null)
	{
		Database.Connect(SQLConnectCallback, g_DBConnection);
	}
	
	strcopy(g_DBConnectionOld, sizeof(g_DBConnectionOld), g_DBConnection);
	
	g_Cvar_ChatPrefix.GetString(g_ChatPrefix, sizeof(g_ChatPrefix));
	g_iKnifeStatTrakMode = g_Cvar_KnifeStatTrakMode.IntValue;
	g_iEnableFloat = g_Cvar_EnableFloat.IntValue;
	g_iEnableNameTag = g_Cvar_EnableNameTag.IntValue;
	g_iEnableStatTrak = g_Cvar_EnableStatTrak.IntValue;
	g_fFloatIncrementSize = g_Cvar_FloatIncrementSize.FloatValue;
	g_iFloatIncrementPercentage = RoundFloat(g_fFloatIncrementSize * 100.0);
	ReadConfig();
}

public Action CommandWeaponSkins(int client, int args)
{
	if (IsValidClient(client))
	{
		CreateMainMenu(client).Display(client, MENU_TIME_FOREVER);
	}
	return Plugin_Handled;
}

public Action CommandKnife(int client, int args)
{
	if (IsValidClient(client))
	{
		CreateKnifeMenu(client).Display(client, MENU_TIME_FOREVER);
	}
	return Plugin_Handled;
}

public Action CommandWSLang(int client, int args)
{
	if (IsValidClient(client))
	{
		CreateLanguageMenu(client).Display(client, MENU_TIME_FOREVER);
	}
	return Plugin_Handled;
}

public Action CommandNameTag(int client, int args)
{
	if(g_iEnableNameTag == 0)
	{
		ReplyToCommand(client, "%s %T", g_ChatPrefix, "NameTagDisabled", client);
		return Plugin_Handled;
	}
	if(GetTime() - g_iNameTagTime[client] < 2)
	{
		ReplyToCommand(client, "%s %T", g_ChatPrefix, "DontSpamNameTag", client);
		return Plugin_Handled;
	}
	if(args < 1)
	{
		ReplyToCommand(client, "%s %T", g_ChatPrefix, "NameTagNeedsParams", client);
		return Plugin_Handled;
	}
	char nameTag[128];
	GetCmdArgString(nameTag, sizeof(nameTag));
	
	if (IsValidClient(client))
	{
		int entity = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
		if (entity != -1)
		{
			int index = GetWeaponIndex(entity);
			
			if (index > -1)
			{
				CleanNameTag(nameTag, sizeof(nameTag));
				
				g_NameTag[client][index] = nameTag;
				
				RefreshWeapon(client, index);
				
				char updateFields[300];
				char escaped[257];
				db.Escape(nameTag, escaped, sizeof(escaped));
				char weaponName[32];
				char weaponClass[32];
				GetWeaponClass(entity, weaponClass, sizeof(weaponClass));
				RemoveWeaponPrefix(weaponClass, weaponName, sizeof(weaponName));
				Format(updateFields, sizeof(updateFields), "%s_tag = '%s'", weaponName, escaped);
				UpdatePlayerData(client, updateFields);
				
				g_iNameTagTime[client] = GetTime();
			}
		}
	}
	return Plugin_Handled;
}

public void OnClientPutInServer(int client)
{
	if(IsFakeClient(client))
	{
		if(g_iEnableStatTrak == 1)
			SDKHook(client, SDKHook_OnTakeDamageAlive, OnTakeDamageAlive);
	}
	else if(IsValidClient(client))
	{
		HookPlayer(client);
	}
}

public void OnClientPostAdminCheck(int client)
{
	if(IsValidClient(client))
	{
		char steam32[20];
		char temp[20];
		GetClientAuthId(client, AuthId_Steam3, steam32, sizeof(steam32));
		strcopy(temp, sizeof(temp), steam32[5]);
		int index;
		if((index = StrContains(temp, "]")) > -1)
		{
			temp[index] = '\0';
		}
		g_iSteam32[client] = StringToInt(temp);
		GetPlayerData(client);
		QueryClientConVar(client, "cl_language", ConVarCallBack);
	}
}

public void ConVarCallBack(QueryCookie cookie, int client, ConVarQueryResult result, const char[] cvarName, const char[] cvarValue)
{
	if(!g_smLanguageIndex.GetValue(cvarValue, g_iClientLanguage[client]))
	{
		g_iClientLanguage[client] = 0;
	}
}

public void OnClientDisconnect(int client)
{
	if(IsFakeClient(client))
	{
		if(g_iEnableStatTrak == 1)
			SDKUnhook(client, SDKHook_OnTakeDamageAlive, OnTakeDamageAlive);
	}
	else if(IsValidClient(client))
	{
		UnhookPlayer(client);
		g_iSteam32[client] = 0;
	}
}

public void SetWeaponProps(int client, int entity)
{
	int index = GetWeaponIndex(entity);
	if (index > -1 && g_iSkins[client][index] != 0)
	{
		SetEntProp(entity, Prop_Send, "m_iItemIDLow", -1);
		SetEntProp(entity, Prop_Send, "m_nFallbackPaintKit", g_iSkins[client][index] == -1 ? GetRandomSkin(client, index) : g_iSkins[client][index]);
		SetEntPropFloat(entity, Prop_Send, "m_flFallbackWear", g_iEnableFloat == 0 || g_fFloatValue[client][index] == 0.0 ? 0.000001 : g_fFloatValue[client][index] == 1.0 ? 0.999999 : g_fFloatValue[client][index]);
		SetEntProp(entity, Prop_Send, "m_nFallbackSeed", GetRandomInt(0, 8192));
		if(!IsKnife(entity))
		{
			if(g_iEnableStatTrak == 1)
			{
				SetEntProp(entity, Prop_Send, "m_nFallbackStatTrak", g_iStatTrak[client][index] == 1 ? g_iStatTrakCount[client][index] : -1);
				SetEntProp(entity, Prop_Send, "m_iEntityQuality", g_iStatTrak[client][index] == 1 ? 9 : 0);
			}
		}
		else
		{
			if(g_iEnableStatTrak == 1)
				SetEntProp(entity, Prop_Send, "m_nFallbackStatTrak", g_iStatTrak[client][index] == 0 ? -1 : g_iKnifeStatTrakMode == 0 ? GetTotalKnifeStatTrakCount(client) : g_iStatTrakCount[client][index]);
			SetEntProp(entity, Prop_Send, "m_iEntityQuality", 3);
		}
		if (g_iEnableNameTag == 1 && strlen(g_NameTag[client][index]) > 0)
			SetEntDataString(entity, FindSendPropInfo("CBaseAttributableItem", "m_szCustomName"), g_NameTag[client][index], 128);
		SetEntProp(entity, Prop_Send, "m_iAccountID", g_iSteam32[client]);
		SetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity", client);
		SetEntPropEnt(entity, Prop_Send, "m_hPrevOwner", -1);
	}
}

void RefreshWeapon(int client, int index, bool defaultKnife = false)
{
	int size = GetEntPropArraySize(client, Prop_Send, "m_hMyWeapons");
	
	for (int i = 0; i < size; i++)
	{
		int weapon = GetEntPropEnt(client, Prop_Send, "m_hMyWeapons", i);
		if (IsValidWeapon(weapon))
		{
			bool isKnife = IsKnife(weapon);
			if ((!defaultKnife && GetWeaponIndex(weapon) == index) || (isKnife && (defaultKnife || IsKnifeClass(g_WeaponClasses[index]))))
			{
				int clip = -1;
				int ammo = -1;
				int offset = -1;
				int reserve = -1;
					
				if (!isKnife)
				{
					offset = FindDataMapInfo(client, "m_iAmmo") + (GetEntProp(weapon, Prop_Data, "m_iPrimaryAmmoType") * 4);
					ammo = GetEntData(client, offset);
					clip = GetEntProp(weapon, Prop_Send, "m_iClip1");
					reserve = GetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
				}
				
				RemovePlayerItem(client, weapon);
				AcceptEntityInput(weapon, "KillHierarchy");
				
				if (!isKnife)
				{
					weapon = GivePlayerItem(client, g_WeaponClasses[index]);
					if (clip != -1)
					{
						SetEntProp(weapon, Prop_Send, "m_iClip1", clip);
					}
					if (reserve != -1)
					{
						SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", reserve);
					}
					if (offset != -1 && ammo != -1)
					{
						DataPack pack;
						CreateDataTimer(0.1, ReserveAmmoTimer, pack);
						pack.WriteCell(client);
						pack.WriteCell(offset);
						pack.WriteCell(ammo);
					}
				}
				else
				{
					GivePlayerItem(client, "weapon_knife");
				}
				break;
			}
		}
	}
}

public Action ReserveAmmoTimer(Handle timer, DataPack pack)
{
	ResetPack(pack);
	int clientIndex = pack.ReadCell();
	int offset = pack.ReadCell();
	int ammo = pack.ReadCell();
	
	if(IsClientInGame(clientIndex))
	{
		SetEntData(clientIndex, offset, ammo, 4, true);
	}
}
I removed binds from autoexect "," and "."
Can someoane compile for me?
__________________
PLAY.ACEARENA.RO
WWW.ACEARENA.RO

Last edited by MBf; 09-28-2017 at 13:59.
MBf is offline
kgns
Senior Member
Join Date: May 2017
Location: Istanbul, Turkey
Old 09-28-2017 , 14:00   Re: [CSGO] Weapon & Knives (Skins, Name Tags, StatTrak, Wear/Float) [!ws !knife !name
Reply With Quote #236

thats old version.. use 1.1.1, and why do you want to compile? its already compiled.

if you really want to compile yourself though, you have to download PTaH.inc file from PTaH build
__________________

OyunHost Sunucu Hizmetleri: https://www.oyunhost.net
kgns is offline
MBf
Member
Join Date: Aug 2016
Old 09-29-2017 , 03:00   Re: [CSGO] Weapon & Knives (Skins, Name Tags, StatTrak, Wear/Float) [!ws !knife !name
Reply With Quote #237

Quote:
Originally Posted by kgns View Post
thats old version.. use 1.1.1, and why do you want to compile? its already compiled.

if you really want to compile yourself though, you have to download PTaH.inc file from PTaH build
Hello,

I want to get buyammo1 and buyammo2 because for ws players must have the name of the server (right now even if they do not have the name in the name and press buyammo1 respectively 2 the ws / knife menu appears)
Can you get these 2 commands and recompile, please?
Or at least stick for admin ...
I got ptah.inc but gave me other errors in compilation ...

Thank you
__________________
PLAY.ACEARENA.RO
WWW.ACEARENA.RO
MBf is offline
GordN
Junior Member
Join Date: Oct 2017
Old 10-05-2017 , 21:09   Re: [CSGO] Weapon & Knives (Skins, Name Tags, StatTrak, Wear/Float) [!ws !knife !name
Reply With Quote #238

hey, i have installed the plugin.
When i try to use the plugin whilst ingame, selecting a skin does not appear on my weapon till i either reconnect to the gameserver or put a nametag on it.

Any ideas what could be wrong?
GordN is offline
bongotrommler
Senior Member
Join Date: Feb 2013
Location: GG-Elite.Net
Old 10-06-2017 , 05:42   Re: [CSGO] Weapon & Knives (Skins, Name Tags, StatTrak, Wear/Float) [!ws !knife !name
Reply With Quote #239

PTaH up2date?
bongotrommler is offline
abhit17
Junior Member
Join Date: Aug 2017
Old 10-07-2017 , 03:08   Re: [CSGO] Weapon & Knives (Skins, Name Tags, StatTrak, Wear/Float) [!ws !knife !name
Reply With Quote #240

weapons.smx (Weapons & Knives): Required extension "PTaH" file("PTaH.ext") not running

This is error i am getting what should i do?
abhit17 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 15:41.


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