View Single Post
Author Message
DarthNinja
SourceMod Plugin Approver
Join Date: Mar 2009
Location: PreThinkHook()
Old 09-11-2011 , 22:00   [TF2] Fake Item Messages
Reply With Quote #1

[TF2] Fake Item Messages
Version 1.5.0



Description:
Allows admins to print fake item found messages to chat.

For example...


Now supports custom text!


Commands:
  • sm_fakeitem <client> <item index> [quality] [method]
    • <Client> = Client or userid of the target player
    • <Item Index> = The desired item's definition index from items_game.txt or in a better format here
    • [Quality] = Normal / Genuine / olive / Vintage / orange / Unusual / Unique / Community / Valve / Selfmade / Customized Haunted.
      Numbers will also work.
    • [Method] = Found / Craft / Trade / Buy / Uncrate / Gift / Earned / Refund / Wrapped. Numbers 0-10 also work.

      Example: "sm_fakeitem @me 99 vintage buy" would print DarthNinja has purchased: Vintage Tyrants Helm

  • sm_fakeitem2 <client> <method> <item text>
    • <Client> = Client or userid of the target player
    • <Method> = Found / Craft / Trade / Buy / Uncrate / Gift / Earned / Refund / Wrapped / Any custom text you want.
    • <Item Text> = Anything you care to think up, must be wrapped in quotes.

      Example: sm_fakeitem2 @me gift "A Banana" would print DarthNinja has received a gift: A Banana
      sm_fakeitem2 @me crate "A Fennec" would print DarthNinja has unboxed: A Fennec

      The item name will use the color of the last item found, or black if none have been found.
Cvars:
  • sm_fakeitem_version
    • Plugin version

Install Instructions:
  1. Place ItemMessages.smx into your addons/sourcemod/plugins/ folder.

Developers:
This plugin fires the item_found event. If you are hooking the event for stats tracking, you will get fake entries.
To prevent this, I've added an extra field to the event, you can use the following to detect fake items vs real items:
PHP Code:

public OnPluginStart()
{
    
HookEvent("item_found"OnItemFound);
}

public 
Action:OnItemFound(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (
GetEventBool(event"isfake"))
    {
        
//Item is fake, maybe you'd want to use return here.
        
return;
    }
    
//Item isn't fake



ToDo:
  • Add support for custom names (PlayerX has found: A Pumpkin) - Done!
  • Menus for each option (this will be a huge pain)

Version History:
  • V1.1.0
    • Initial Release
  • V1.1.1
    • Added Uncrate alias for Unbox
    • Removed unneeded includes
    • Fixed a typo in "Customized"
    • Now loads Common Phrases
  • V1.2.0
    • Added Strange item quality option that I'd forgotten.
    • You can now type help or list in place of a quality or method to get a listing.
    • Changed targeting so it's no longer possible to target bots. (It doesn't work and causes errors with other plugins).
  • V1.3.0
    • Added support for "Haunted"
  • V1.5.0
    • Custom item name/method text support!

Total downloads as prior to last update: 625








Attached Files
File Type: sp Get Plugin or Get Source (ItemMessages.sp - 9621 views - 7.6 KB)
__________________

Last edited by DarthNinja; 01-08-2012 at 10:02.
DarthNinja is offline