Raised This Month: $51 Target: $400
 12% 

TF2Items_OnGiveNamedItem and OVERRIDE_CLASSNAME/OVERRIDE_ALL doesn't work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-08-2013 , 17:35   TF2Items_OnGiveNamedItem and OVERRIDE_CLASSNAME/OVERRIDE_ALL doesn't work
Reply With Quote #1

Simply put, OVERRIDE_CLASSNAME hasn't worked in the TF2Items_OnGiveNamedItem callback for some time.

For instance, I tried this a while back in Huntsman Hell:

PHP Code:
public Action:TF2Items_OnGiveNamedItem(clientString:classname[], iItemDefinitionIndex, &Handle:hItem)
{
    static 
Handle:item INVALID_HANDLE;
    
    if (!
GetConVarBool(g_Cvar_Enabled))
    {
        return 
Plugin_Continue;
    }
    
    if (
item != INVALID_HANDLE)
    {
        
CloseHandle(item);
        
item INVALID_HANDLE;
    }
    
    
// Give the player a Huntsman instead of a Sniper Rifle
    
if (StrEqual(classname"tf_weapon_sniperrifle") || StrEqual(classname"tf_weapon_sniperrifle_decap"))
    {
        
item TF2Items_CreateItem(OVERRIDE_ALL);
        
TF2Items_SetClassname(item"tf_weapon_compound_bow");
        
TF2Items_SetItemIndex(item56);
        
TF2Items_SetLevel(item10);
        
TF2Items_SetQuality(item6);
        
TF2Items_SetNumAttributes(item2);
        
TF2Items_SetAttribute(item0370.5);
        
TF2Items_SetAttribute(item13281.0);
        
hItem item;
        return 
Plugin_Changed;
    }

    
// Other logic omitted for replacing SMGs and blocking sniper shields
    
return Plugin_Continue
What this should have done is give the player a Huntsman instead of a Sniper Rifle. What it actually does is not give the player a primary weapon at all. At least it doesn't on Linux.

This has been broken for quite some time now... is there any fix for this on the horizon?
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-08-2013 at 17:37.
Powerlord is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 10-08-2013 , 18:46   Re: TF2Items_OnGiveNamedItem and OVERRIDE_CLASSNAME/OVERRIDE_ALL doesn't work
Reply With Quote #2

It does work from TF2Items' perspective - the issue is the weapon getting stripped later on (this happened when Valve added the system to merge CEIVs together in the player class).
__________________
asherkin is offline
yuxuanchiadm
New Member
Join Date: Nov 2013
Old 11-20-2013 , 08:46   Re: TF2Items_OnGiveNamedItem and OVERRIDE_CLASSNAME/OVERRIDE_ALL doesn't work
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
It does work from TF2Items' perspective - the issue is the weapon getting stripped later on (this happened when Valve added the system to merge CEIVs together in the player class).
um..I got the same problem.Can this can be fixed?
yuxuanchiadm is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-20-2013 , 11:22   Re: TF2Items_OnGiveNamedItem and OVERRIDE_CLASSNAME/OVERRIDE_ALL doesn't work
Reply With Quote #4

Quote:
Originally Posted by yuxuanchiadm View Post
um..I got the same problem.Can this can be fixed?
No, but you can manually track when a player should get a replacement item. This is what Prop Hunt Redux does.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
yuxuanchiadm
New Member
Join Date: Nov 2013
Old 11-20-2013 , 20:21   Re: TF2Items_OnGiveNamedItem and OVERRIDE_CLASSNAME/OVERRIDE_ALL doesn't work
Reply With Quote #5

Quote:
Originally Posted by Powerlord View Post
No, but you can manually track when a player should get a replacement item. This is what Prop Hunt Redux does.
Thx for help! My plugin work finally.
yuxuanchiadm is offline
Reply



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 00:52.


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