View Single Post
Byte
Senior Member
Join Date: Jun 2010
Location: 📦 CCSPlayer
Old 12-21-2017 , 13:32   Re: [CS:GO] PTaH - V1.0.8
Reply With Quote #106

Hey I was wondering if you had any idea on how to fix this issue.
We discussed it a little on steam.
This is important for servers that block some weapons in some rounds etc.

Plugin 1 using PTaH:
PHP Code:
public void OnPluginStart()
{
  
PTaH(PTaH_GiveNamedItemPreHookGiveNamedItemPre);
  
PTaH(PTaH_WeaponCanUseHookWeaponCanUse);
}

public 
void GiveNamedItemPre(int clientchar classname[64], CEconItemView &itembool &ignoredCEconItemView)
{
  
//Do anything here to ak47 here or do nothing
  
return Plugin_Changed;
}

public 
bool WeaponCanUse(int clientint entbool canuse)
{
  
//check if ent is the ak47 here etc
  
return true;

Other plugins
PHP Code:
public void OnClientPutInServer(int client)
{
  
SDKHook(clientSDKHook_WeaponCanUseHook_BlockPickup);
}


//Block AK47
public Action Hook_BlockPickup(int clientint weapon)
{
  
char weaponClass[64];
  
GetEntityClassname(weaponweaponClasssizeof(weaponClass));
  
  if (
StrEqual(weaponClass"weapon_ak47"))
    return 
Plugin_Handled;

  return 
Plugin_Continue;

In this case, the AK47 will always be equipped even if other plugins use SDKHooks with SDKHook_WeaponCanUse to block it. A lot of plugins use this so it would be good if there was a solution for this.

Why does returning Plugin_Changed in GiveNamedItemPre without changing anything cause the weapon to not be able to be picked up? I'm sure this can be fixed so the weapon can still be picked up by default without needing to use the PTaH weaponcanuse. That way you can just use SDKHooks only for WeaponCanUse.

What does removeIfNotCarried do?
https://github.com/komashchenko/PTaH...wards.cpp#L374

Maybe using MRES_OVERRIDE here:
https://github.com/komashchenko/PTaH...wards.cpp#L398

I did some testing, will try some more stuff later.
Let me know if you have any ideas.
__________________
STEAM: /id/invexbyte | Github: Mo Beigi | Discord: Byte#0017
Community: Invex Gaming | My Plugins: Click Me!


Last edited by Byte; 12-21-2017 at 13:36.
Byte is offline