Raised This Month: $ Target: $400
 0% 

Having some issues with changing a weapon


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
StrikerMan780
AlliedModders Donor
Join Date: Jul 2009
Location: Canada
Old 09-01-2012 , 19:39   Having some issues with changing a weapon
Reply With Quote #1

I'm working on some code for a plugin that swaps out any rocket launchers the soldier may be carrying, into an Original. For a Quake-style Rocket Arena Game Type... The only problem is, if someone is carrying the Stock Rocket Launcher (not renamed or Strange), it will get stripped entirely from them, being stuck with only a secondary and melee. If you have any other type of RL equipped, such as the direct hit, or a renamed stock RL, it works fine.

Here is my code:
PHP Code:
public Action:TF2Items_OnGiveNamedItem(clientString:classname[], iItemDefinitionIndex, &Handle:hItem)
{
    if(
IsValidClient(client))
    {
        if(
StrEqual(classname"tf_weapon_rocketlauncher"false) && GetConVarBool(cv_quake))
        {
            
PrintToChat(client"[StrikerMod] Quake Mode is on - Switching to Original");
            
            new 
Handle:hWeapon TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION);
            
            
TF2Items_SetClassname(Handle:hWeapon"tf_weapon_rocketlauncher");
            
TF2Items_SetItemIndex(Handle:hWeapon513);
            
TF2Items_SetLevel(Handle:hWeapon99);
            
TF2Items_SetQuality(Handle:hWeapon9);
            
            
TF2Items_SetNumAttributes(Handle:hWeapon4);
            
TF2Items_SetAttribute(Handle:hWeapon0581.25);
            
TF2Items_SetAttribute(Handle:hWeapon11031.5);
            
TF2Items_SetAttribute(Handle:hWeapon21350.8);
            
TF2Items_SetAttribute(Handle:hWeapon32891.0);
            
            
hItem hWeapon;
            
            return 
Plugin_Changed;
        }
    }
    
    return 
Plugin_Continue;

StrikerMan780 is offline
 



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 20:55.


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