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

[TF2Items] Give Weapon (v3.14159, 11/29/2013)


Post New Thread Reply   
 
Thread Tools Display Modes
thatdarnkid
BANNED
Join Date: Nov 2010
Old 12-13-2010 , 16:10   Re: [TF2Items] Give Weapon (v1.4.1.2.3, 12/11/2010)
Reply With Quote #101

Uh.....adminmenu_custom.txt is part of SourceMod.

It's in tf/addons/Sourcemod/configs....

Last edited by thatdarnkid; 12-15-2010 at 10:54.
thatdarnkid is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 12-13-2010 , 22:00   Re: [TF2Items] Give Weapon (v1.4.1.2.3, 12/11/2010)
Reply With Quote #102

Quote:
Originally Posted by thatdarnkid View Post
Indeed!

Every first number is your attribute ID, every second number is it's value.

Just checked my servers error log from yesterday, and noticed this:

Code:
L 12/12/2010 - 00:22:19: [SM] Native "LogAction" reported: Client index 6666 is invalid
L 12/12/2010 - 00:22:19: [SM] Displaying call stack trace for plugin "tf2items_giveweapon.smx":
L 12/12/2010 - 00:22:19: [SM]   [0]  Line 190, C:\Users\User\Desktop\TF2 Stuff\Compiler\scripting\tf2items_giveweapon.sp::Command_WeaponEx()
L 12/12/2010 - 00:22:19: [SM] Native "LogAction" reported: Client index 6667 is invalid
L 12/12/2010 - 00:22:19: [SM] Displaying call stack trace for plugin "tf2items_giveweapon.smx":
L 12/12/2010 - 00:22:19: [SM]   [0]  Line 190, C:\Users\User\Desktop\TF2 Stuff\Compiler\scripting\tf2items_giveweapon.sp::Command_WeaponEx()
L 12/12/2010 - 00:22:19: [SM] Native "LogAction" reported: Client index 6668 is invalid
L 12/12/2010 - 00:22:19: [SM] Displaying call stack trace for plugin "tf2items_giveweapon.smx":
L 12/12/2010 - 00:22:19: [SM]   [0]  Line 190, C:\Users\User\Desktop\TF2 Stuff\Compiler\scripting\tf2items_giveweapon.sp::Command_WeaponEx()
Weapons 6666, 6667 and 6668 are my godly Huntsman, SMG and Bushwacka, all of which happen to be on the Custom weapons TXT.

As well, I think the whole "Command_WeaponEx()" thing might have appear because I changed the command on adminmenu_custom.txt to "sm_giveweapon_ex @me #1", #1 being "Which weapon".

I thought @me would make the command target the player, which it kind of does...but everytime I use it, or one of my VIPs uses sm_giveweapon (which I've also changed to sm_giveweapon @me #1 on adminmenu_custom.txt), the console says "Unknown Command: <sm_giveweapon/giveweapon_ex>"

I'm still using my own revised version of this plugin, by the way. Didn't update to the latest version because the notify thing, well I got rid of that myself (as I've explained above), and the new weapon? Don't need it on the server where my admins can get their grubby little paws on it. I'm content to use my version
O.O it's looking at it as if it's a client index. I think you did something wrong somewhere along the line. Client index =/= weapon index.

Good luck debugging that.

Hint: %N is not the droid you're looking for.
__________________
Bread EOTL GunMettle Invasion Jungle Inferno will break everything. Don't even ask.

All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You will be fed to javalia otherwise.
Psyduck likes replays.

Last edited by FlaminSarge; 12-13-2010 at 23:17.
FlaminSarge is offline
thatdarnkid
BANNED
Join Date: Nov 2010
Old 12-13-2010 , 23:19   Re: [TF2Items] Give Weapon (v1.4.1.2.3, 12/11/2010)
Reply With Quote #103

It's probably an issue with my Alias keybind.....though it could possibly not be...

O.O

I'll leave the server alone for a few days, check the error logs and see if it pops back up.

Last edited by thatdarnkid; 12-15-2010 at 10:50.
thatdarnkid is offline
thatdarnkid
BANNED
Join Date: Nov 2010
Old 12-14-2010 , 12:43   Re: [TF2Items] Give Weapon (v1.4.1.2.3, 12/11/2010)
Reply With Quote #104

It might just be me....or there might be an issue with Particle Effects on weapons and the latest update(s).

Everytime I taunt, the game screen freezes and the sound I make when I taunt (for example when I taunt with my Bushwacka as a Sniper, and the Bushwacka has the attribute "134 ; 1.0") repeats itself over and over.

I can't taunt at all with my flaming weapons without the damn game freezing and the sound skipping.

EDIT: Nevermind, seems it was a momentary issue and it's gone away.

Last edited by thatdarnkid; 12-15-2010 at 10:53.
thatdarnkid is offline
DarthNinja
SourceMod Plugin Approver
Join Date: Mar 2009
Location: PreThinkHook()
Old 12-15-2010 , 01:41   Re: [TF2Items] Give Weapon (v1.4.1.2.3, 12/11/2010)
Reply With Quote #105

Sounds like you need a reboot
__________________
DarthNinja is offline
thatdarnkid
BANNED
Join Date: Nov 2010
Old 12-15-2010 , 10:34   Re: [TF2Items] Give Weapon (v1.4.1.2.3, 12/11/2010)
Reply With Quote #106

Quote:
Originally Posted by DarthNinja View Post
Sounds like you need a reboot
Yeah, that issue fixed itself. I had been ALT+TABing between TF2 and this forum, and when I had ALT+TAB'd back to TF2, my mouse wasn't moving my view around. I was stuck looking at the ceiling, yet when I moved my mouse up and down, it actually moved my player forward and backward. ALT+TAB'd a few more times and it fixed itself.

---------------------------------------------------------------

Alrighty. I found the section of code in the plugin that controls how the sm_giveweapon_ex command works. Obviously it'd be the same bunch of code (somewhat) for sm_giveweapon and sm_resetex.

What do I change in this section of code to change the commands input from "sm_giveweapon_ex <Player Name> <Weapon ID>" to "sm_giveweapon_ex <Weapon ID>" and have it 'fire' on the user who used the command?

Code:
public Action:Command_WeaponEx(client, args)
{
    decl String:arg1[32];
    decl String:arg2[32];
    decl String:arg3[32];
    new weaponLookupIndex = 0;
    new mode = 0;
 
    if (args != 2 && args != 3)
    {
        ReplyToCommand(client, "[TF2Items] Usage: sm_giveweapon_ex <player> <itemindex> [givenow]");
        return Plugin_Handled;
    }
    
    /* Get the arguments */
    GetCmdArg(1, arg1, sizeof(arg1));
    GetCmdArg(2, arg2, sizeof(arg2));
    if (args == 3)
    {
        GetCmdArg(3, arg3, sizeof(arg3));
        mode = StringToInt(arg3);
    }
    weaponLookupIndex = StringToInt(arg2);
    mode = StringToInt(arg3);
 
    /**
     * target_name - stores the noun identifying the target(s)
     * target_list - array to store clients
     * target_count - variable to store number of clients
     * tn_is_ml - stores whether the noun must be translated
     */
    new String:target_name[MAX_TARGET_LENGTH];
    new target_list[MAXPLAYERS], target_count;
    new bool:tn_is_ml;
 
    if ((target_count = ProcessTargetString(
            arg1,
            client,
            target_list,
            MAXPLAYERS,
            0,
            target_name,
            sizeof(target_name),
            tn_is_ml)) <= 0)
    {
        /* This function replies to the admin with a failure message */
        ReplyToTargetError(client, target_count);
        return Plugin_Handled;
    }
 
    for (new i = 0; i < target_count; i++)
    {
        new weaponSlot;
        new String:formatBuffer[32];
        Format(formatBuffer, 32, "%d_%s", weaponLookupIndex, "slot");
        new bool:isValidItem = GetTrieValue(g_hItemInfoTrie, formatBuffer, weaponSlot);
        
        if (!isValidItem)
        {
            ReplyToCommand(client, "[TF2Items] Invalid Weapon Index");
            return Plugin_Handled;
        }
        
        ReplyToCommand(target_list[i], "[TF2Items] Respawn or touch a locker to recieve your permanent weapon.");
        g_hItems[target_list[i]][weaponSlot] = weaponLookupIndex;
        if (mode == 1) Command_WeaponBase(target_list[i], weaponLookupIndex, weaponSlot);
        LogAction(client, target_list[i], "\"%L\" gave a permanent weapon to \"%L\"", client, weaponLookupIndex, target_list[i]);
    }
 
    if (tn_is_ml) {
        ReplyToCommand(client, "[TF2Items] ", "Weapon Given", target_name, weaponLookupIndex);
    } else {
        ReplyToCommand(client, "[TF2Items] ", "Weapon Given", target_name, weaponLookupIndex);
    }
 
    return Plugin_Handled;
}

Last edited by thatdarnkid; 12-15-2010 at 10:51.
thatdarnkid is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 12-16-2010 , 01:56   Re: [TF2Items] Give Weapon (v1.4.1.2.3, 12/11/2010)
Reply With Quote #107

I don't have to support your changes, thatdarnkid.

Delete all arg1 references, delete that section that starts at /** *target_name and goes to for new...{
Change all target_list[i] to client.

You're missing out on the visible weapons btw.

Coming soon.

Oh, and changes args != 2 to 1 and args != 3 to 2, and args == 3 to 2.
And GetCmdArg(2...) to GetCmdArg(1...) but not the arg2, sizeof... stuff.
__________________
Bread EOTL GunMettle Invasion Jungle Inferno will break everything. Don't even ask.

All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You will be fed to javalia otherwise.
Psyduck likes replays.
FlaminSarge is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 12-16-2010 , 22:02   Re: [TF2Items] Give Weapon (v1.4.1.2.3, 12/11/2010)
Reply With Quote #108

whaaaaaaaaaatever.
__________________
Bread EOTL GunMettle Invasion Jungle Inferno will break everything. Don't even ask.

All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You will be fed to javalia otherwise.
Psyduck likes replays.
FlaminSarge is offline
thatdarnkid
BANNED
Join Date: Nov 2010
Old 12-16-2010 , 22:26   Re: [TF2Items] Give Weapon (v1.4.1.2.3, 12/11/2010)
Reply With Quote #109

Well I believe the problem starter was that I had Welcome messages enabled.

Everytime someone who is VIP on my server joined, the plugin tried sending the welcome message and couldn't. Hence my giant error logs.

So I just switched the related CVAR for welcome messages to 0.

Time to upload the various fixes I made, see if they work, and head to bed for the night. I've got a long day ahead of me tomorrow, driving all the way up to Florida.

Thank you so much for the help guys, sorry for being abit of a pain in the ass with this stuff
thatdarnkid is offline
thatdarnkid
BANNED
Join Date: Nov 2010
Old 12-16-2010 , 22:42   Re: [TF2Items] Give Weapon (v1.4.1.2.3, 12/11/2010)
Reply With Quote #110

Code:
Delete all arg1 references, delete that section that starts at /** *target_name and goes to for new...{
Change all target_list[i] to client.

Oh, and changes args != 2 to 1 and args != 3 to 2, and args == 3 to 2.
And GetCmdArg(2...) to GetCmdArg(1...) but not the arg2, sizeof... stuff.
Followed this...."guide". Ran into problems. You didn't reference target_list (you only referenced target_list[i]), "if (tn_is_ml)". When I compiled the plugin after only following your changes, I ended up getting a bunch of errors relating to target_list and tn_is_ml. I ended up replacing "target_list" with "client" and "tn_is_ml"...well as you'll see in the code below, I flat-out removed that stuff.

I was trying to change sm_giveweapon, sm_giveweapon_ex and sm_resetex so that they don't require a player name to operate. sm_giveweapon_ex seems to work...kinda....if you're not holding a melee weapon when you go to give yourself a different melee weapon, nothing happens. And console still spits out "Unknown Command".
Code:
public Action:Command_WeaponEx(client, args)
{
    decl String:arg2[32];
    decl String:arg3[32];
    new weaponLookupIndex = 0;
    new mode = 0;
 
    if (args != 1 && args != 2)
    {
        ReplyToCommand(client, "[TF2Items] Usage: sm_giveweapon_ex <player> <itemindex> [givenow]");
        return Plugin_Handled;
    }
    
    /* Get the arguments */
    GetCmdArg(1, arg2, sizeof(arg2));
    if (args == 2)
    {
        GetCmdArg(3, arg3, sizeof(arg3));
        mode = StringToInt(arg3);
    }
    weaponLookupIndex = StringToInt(arg2);
    mode = StringToInt(arg3);
 
    {
        new weaponSlot;
        new String:formatBuffer[32];
        Format(formatBuffer, 32, "%d_%s", weaponLookupIndex, "slot");
        new bool:isValidItem = GetTrieValue(g_hItemInfoTrie, formatBuffer, weaponSlot);
        
        if (!isValidItem)
        {
            ReplyToCommand(client, "[TF2Items] Invalid Weapon Index");
            return Plugin_Handled;
        }
        
        ReplyToCommand(client, "[TF2Items] Respawn or touch a locker to recieve your permanent weapon.");
        g_hItems[client][weaponSlot] = weaponLookupIndex;
        if (mode == 1) Command_WeaponBase(client, weaponLookupIndex, weaponSlot);
        LogAction(client, client, "\"%L\" gave a permanent weapon to \"%L\"", client, weaponLookupIndex, client);
    }
 
    return Plugin_Handled;
}

public Action:Command_ResetEx(client, args)
{
    new String:arg1[32];
 
    if (args != 1)
    {
        ReplyToCommand(client, "[TF2Items] Usage: sm_resetex <target>");
        return Plugin_Handled;
    }
    
    /* Get the arguments */
    GetCmdArg(1, arg1, sizeof(arg1));
 

    {
        for (new slot = 0; slot < 6; slot++)
        {
            if (g_hItems[client][slot] != -1) g_hItems[client][slot] = -1;
        }
        LogAction(client, client, "\"%L\" reset permanent weapons for \"%L\"", client, client);
    }
    return Plugin_Handled;
}
public Action:Command_Weapon(client, args)
{
    new String:arg2[32];
    new weaponLookupIndex = 0;
 
    if (args != 1) {
        ReplyToCommand(client, "[TF2Items] Usage: sm_giveweapon <player> <itemindex>");
        return Plugin_Handled;
    }
    
    /* Get the arguments */
    GetCmdArg(1, arg2, sizeof(arg2));
    weaponLookupIndex = StringToInt(arg2);
 
    {
        new weaponSlot;
        new String:formatBuffer[32];
        Format(formatBuffer, 32, "%d_%s", weaponLookupIndex, "slot");
        new bool:isValidItem = GetTrieValue(g_hItemInfoTrie, formatBuffer, weaponSlot);
        if (!isValidItem)
        {
            ReplyToCommand(client, "[TF2Items] Invalid Weapon Index");
            return Plugin_Handled;
        }
        Command_WeaponBase(client, weaponLookupIndex, weaponSlot);        
        LogAction(client, client, "\"%L\" gave a weapon to \"%L\"", client, weaponLookupIndex, client);
    }
    return Plugin_Handled;
}
Now, it'd be nifty if you could do me a huge favour. Seeing as the steps you posted above were good...kind of...but they still ended up leaving me with a hardly-working plugin, could you go through what's left of my code above, and fix it up so that it works properly and doesn't require a player name input?

I'd love to spend all day and night working on it, but I'm leaving for Florida tomorrow, and won't be back until the 30th. I've gotta be heading to bed now. I might be able to slide on my laptop early tomorrow before I leave though.

Last edited by thatdarnkid; 12-16-2010 at 22:46.
thatdarnkid 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 17:08.


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