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

[Snippet][TF2] Directly Spawning Mannpower Powerups and extra info...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 12-29-2014 , 20:09   [Snippet][TF2] Directly Spawning Mannpower Powerups and extra info...
Reply With Quote #1

Hi Guys

I'd like to share with you quite lazy snippet which allows you to spawn normally working powerups without mannpower mode on nor need to use info_target spawners. Directly thru 'CreateEntityByName'

Test Plugin:
PHP Code:
#include <sdktools>
#include <tf2_stocks>
 
public OnPluginStart()
{
    
RegConsoleCmd("sm_powerup_spawn_test"SpawnTest_Powerup);
}

public 
Action:SpawnTest_Powerup(clientargs)
{
    
decl String:argc[32]
    
GetCmdArg(1argcsizeof(argc))

    
decl Float:player_pos[3]
    
GetClientAbsOrigin(clientplayer_pos)

    new 
entity CreateEntityByName("item_powerup_rune")
    new 
Address:desu GetEntityAddress(entity) + Address:1256;

    new 
type StringToInt(argc)
    if(
type == 1)
    {
        
StoreToAddress(desu0x5ANumberType_Int8)
    }
    else if(
type == 2)
    {
        
StoreToAddress(desu0x5DNumberType_Int8)
    }
    else if(
type == 2)
    {
        
StoreToAddress(desu0x5CNumberType_Int8)
    }
    else if(
type == 3
    {
        
StoreToAddress(desu0x5CNumberType_Int8)
    }
    else if(
type == 4)
    {
        
StoreToAddress(desu0x5BNumberType_Int8)
    }
    else if(
type == 5)
    {
        
StoreToAddress(desu0x5ENumberType_Int8)
    }
    else if(
type == 6)
    {
        
StoreToAddress(desu0x5FNumberType_Int8)
    }
    else if(
type == 7)
    {
        
StoreToAddress(desu0x60NumberType_Int8)
    }
    else if(
type == 8)
    {
        
StoreToAddress(desu0x61NumberType_Int8)
    }
    
TeleportEntity(entityplayer_posNULL_VECTORNULL_VECTOR)
    
DispatchSpawn(entity)

IDs for Powerups
PHP Code:
 /*
 Table List:
0x5A: Strenght
0x5D: Resistance
0x5C: Regneration
0x5B: Haste
0x5E: Vampire
0x5F: Warlock
0x60: Precision
0x61: Agilty
 */ 
This is Windows version of plugin
For Linux you will probably need to change 'Address:1256' to linux equivalent of that address
It is either: 1276 or probably one of these:
PHP Code:
  *(_BYTE *)(v9 1260) = a3;
  *(
_DWORD *)(v9 1264) = a4;
  *(
_DWORD *)(v9 1268) = a5;
  *(
_DWORD *)(v9 1272) = a6
Found above informations in following things:
- CTFRune::CreateRune(Vector const&, int, bool, Vector) //Found in there offset for setting type of powerups\\ *You can find it on windows by searching string 'item_powerup_rune'.
- CTFRune::MyTouch(CBasePlayer *) //Found in there ids of powerups\\ *Can be found by searching 'You got the PRECISION power-up!' string*


- Enjoy. I'il probably update/refine/turn into plugin this snippet tommorow cause it's kinda messy at it's current state
__________________
...

Last edited by Oshizu; 12-29-2014 at 20:24.
Oshizu is offline
psychonic

BAFFLED
Join Date: May 2008
Old 12-29-2014 , 20:25   Re: [Snippet][TF2] Directly Spawning Mannpower Powerups and extra info...
Reply With Quote #2

Those IDs look like they're just the condition #'s of the player conds granted by the runes.
psychonic is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 12-29-2014 , 20:26   Re: [Snippet][TF2] Directly Spawning Mannpower Powerups...
Reply With Quote #3

Quote:
Originally Posted by Oshizu View Post
Hi Guys

I'd like to share with you quite lazy snippet which allows you to spawn normally working powerups without mannpower mode on nor need to use info_target spawners. Directly thru 'CreateEntityByName'

Test Plugin:
PHP Code:
#include <sdktools>
#include <tf2_stocks>
 
public OnPluginStart()
{
    
RegConsoleCmd("sm_powerup_spawn_test"SpawnTest_Powerup);
}

public 
Action:SpawnTest_Powerup(clientargs)
{
    
decl String:argc[32]
    
GetCmdArg(1argcsizeof(argc))

    
decl Float:player_pos[3]
    
GetClientAbsOrigin(clientplayer_pos)

    new 
entity CreateEntityByName("item_powerup_rune")
    new 
Address:desu GetEntityAddress(entity) + Address:1256;

    new 
type StringToInt(argc)
    if(
type == 1)
    {
        
StoreToAddress(desu0x5ANumberType_Int8)
    }
    else if(
type == 2)
    {
        
StoreToAddress(desu0x5DNumberType_Int8)
    }
    else if(
type == 2)
    {
        
StoreToAddress(desu0x5CNumberType_Int8)
    }
    else if(
type == 3
    {
        
StoreToAddress(desu0x5CNumberType_Int8)
    }
    else if(
type == 4)
    {
        
StoreToAddress(desu0x5BNumberType_Int8)
    }
    else if(
type == 5)
    {
        
StoreToAddress(desu0x5ENumberType_Int8)
    }
    else if(
type == 6)
    {
        
StoreToAddress(desu0x5FNumberType_Int8)
    }
    else if(
type == 7)
    {
        
StoreToAddress(desu0x60NumberType_Int8)
    }
    else if(
type == 8)
    {
        
StoreToAddress(desu0x61NumberType_Int8)
    }
    
TeleportEntity(entityplayer_posNULL_VECTORNULL_VECTOR)
    
DispatchSpawn(entity)

IDs for Powerups
PHP Code:
 /*
 Table List:
0x5A: Strenght
0x5D: Resistance
0x5C: Regneration
0x5B: Haste
0x5E: Vampire
0x5F: Warlock
0x60: Precision
0x61: Agilty
 */ 
This is Windows version of plugin
For Linux you will probably need to change 'Address:1256' to linux equivalent of that address
It is either: 1276 or probably one of these:
PHP Code:
  *(_BYTE *)(v9 1260) = a3;
  *(
_DWORD *)(v9 1264) = a4;
  *(
_DWORD *)(v9 1268) = a5;
  *(
_DWORD *)(v9 1272) = a6
- Enjoy. I'il probably update/refine/turn into plugin this snippet tommorow cause it's kinda messy at it's current state
Here's a better version:
PHP Code:
#define WINDOWS
//#define LINUX //Uncomment this line and comment the above if your on linux.

#if defined WINDOWS
#define OFFSET Address:1256
#endif
#if defined LINUX
#define OFFSET Address:1256 //Anyone got the linux address?
#endif
new addresses[8] = {0x5A0x5D0x5C0x5B0x5E0x5F0x600x61};

stock CreatePowerup(typefloat:pos[3], float:rotation[3])
{
    new 
entity CreateEntityByName("item_powerup_rune")
    new 
Address:desu GetEntityAddress(entity) + OFFSET;
    
StoreToAddress(desuaddresses[type], NumberType_Int8);
    
TeleportEntity(entityposrotationNULL_VECTOR);
    
DispatchSpawn(entity);
    return 
entity;

__________________

Last edited by WildCard65; 12-29-2014 at 20:27.
WildCard65 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 12-29-2014 , 20:44   Re: [Snippet][TF2] Directly Spawning Mannpower Powerups...
Reply With Quote #4

Quote:
Originally Posted by WildCard65 View Post
Here's a better version:
It's not really better, just rearranging the original logic.

An improvement would be changing it to use gamedata with offsets relative to existing sendprops or datadesc vars (also named in gamedata), rather than hardcoding offsets relative to the entity base in the plugin. They be very likely to change on most updates like that.

Ex. offset of m_iszModel + 24.

Last edited by psychonic; 12-29-2014 at 20:55.
psychonic is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 12-30-2014 , 06:23   Re: [Snippet][TF2] Directly Spawning Mannpower Powerups and extra info...
Reply With Quote #5

This is beta, and early at that... The offsets are going to change for sure.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-03-2015 , 22:07   Re: [Snippet][TF2] Directly Spawning Mannpower Powerups and extra info...
Reply With Quote #6

Throwin' my hat in the ring with something I made. Gives the powerup directly to the player and when you die the powerup drops. Only thing is they seem do a flashy thing after a while of not being picked up and they don't seem to disappear. They do respect team spawn rooms and that you can't bring a powerup into your own spawn. As well, you can only pick one up, but using these commands will grant you every powerup without losing any.

Very shitty code mind you, but still usable. And no, not clearing the individual rune type on the death event does not lead to "having the powerup effect without having the rune". It appears that the HasRune condition is the true controller of whether or not you have the rune's effect.

PHP Code:
public OnPluginStart()
{
    
RegAdminCmd("sm_rune1"Command_Rune1ADMFLAG_GENERIC"it's a command");
    
RegAdminCmd("sm_rune2"Command_Rune2ADMFLAG_GENERIC"it's a command");
    
RegAdminCmd("sm_rune3"Command_Rune3ADMFLAG_GENERIC"it's a command");
    
RegAdminCmd("sm_rune4"Command_Rune4ADMFLAG_GENERIC"it's a command");
    
RegAdminCmd("sm_rune5"Command_Rune5ADMFLAG_GENERIC"it's a command");
    
RegAdminCmd("sm_rune6"Command_Rune6ADMFLAG_GENERIC"it's a command");
    
RegAdminCmd("sm_rune7"Command_Rune7ADMFLAG_GENERIC"it's a command");
    
RegAdminCmd("sm_rune8"Command_Rune8ADMFLAG_GENERIC"it's a command");
    
    
HookEvent("player_death"Event_PlayerChanged);
}


public 
Action:Command_Rune1(clientargs)
{
    
TF2_AddCondition(clientTFCond_HasRuneTFCondDuration_Infinite);
    
TF2_AddCondition(clientTFCond_RuneStrengthTFCondDuration_Infinite);
}

public 
Action:Command_Rune2(clientargs)
{
    
TF2_AddCondition(clientTFCond_HasRuneTFCondDuration_Infinite);
    
TF2_AddCondition(clientTFCond_RuneHasteTFCondDuration_Infinite);
}

public 
Action:Command_Rune3(clientargs)
{
    
TF2_AddCondition(clientTFCond_HasRuneTFCondDuration_Infinite);
    
TF2_AddCondition(clientTFCond_RuneRegenTFCondDuration_Infinite);
}

public 
Action:Command_Rune4(clientargs)
{
    
TF2_AddCondition(clientTFCond_HasRuneTFCondDuration_Infinite);
    
TF2_AddCondition(clientTFCond_RuneResistTFCondDuration_Infinite);
}

public 
Action:Command_Rune5(clientargs)
{
    
TF2_AddCondition(clientTFCond_HasRuneTFCondDuration_Infinite);
    
TF2_AddCondition(clientTFCond_RuneVampireTFCondDuration_Infinite);
}

public 
Action:Command_Rune6(clientargs)
{
    
TF2_AddCondition(clientTFCond_HasRuneTFCondDuration_Infinite);
    
TF2_AddCondition(clientTFCond_RuneWarlockTFCondDuration_Infinite);
}

public 
Action:Command_Rune7(clientargs)
{
    
TF2_AddCondition(clientTFCond_HasRuneTFCondDuration_Infinite);
    
TF2_AddCondition(clientTFCond_RunePrecisionTFCondDuration_Infinite);
}

public 
Action:Command_Rune8(clientargs)
{
    
TF2_AddCondition(clientTFCond_HasRuneTFCondDuration_Infinite);
    
TF2_AddCondition(clientTFCond_RuneAgilityTFCondDuration_Infinite);
}

public 
Action:Event_PlayerChanged(Handle:event, const String:name[], bool:dontbroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
TF2_RemoveCondition(clientTFCond_HasRune);
    return 
Plugin_Continue;


Last edited by 404UserNotFound; 01-03-2015 at 22:09.
404UserNotFound is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-05-2015 , 11:42   Re: [Snippet][TF2] Directly Spawning Mannpower Powerups and extra info...
Reply With Quote #7

I haven't tried it, but if you want to give players a particular rune directly, you can probably use TF2Items to spawn the inventory version of it on them.

Also, I have no idea why the weapon class is listed as saxxy in the schema, it just is.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 01-05-2015 , 18:20   Re: [Snippet][TF2] Directly Spawning Mannpower Powerups and extra info...
Reply With Quote #8

Quote:
Originally Posted by Powerlord View Post
I haven't tried it, but if you want to give players a particular rune directly, you can probably use TF2Items to spawn the inventory version of it on them.

Also, I have no idea why the weapon class is listed as saxxy in the schema, it just is.
I believe the pan is also a saxxy
__________________
WildCard65 is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-06-2015 , 01:28   Re: [Snippet][TF2] Directly Spawning Mannpower Powerups and extra info...
Reply With Quote #9

Quando omni flunkus Saxxy (When all else fails, Saxxy)

Last edited by 404UserNotFound; 01-06-2015 at 01:28.
404UserNotFound is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-06-2015 , 13:06   Re: [Snippet][TF2] Directly Spawning Mannpower Powerups and extra info...
Reply With Quote #10

Quote:
Originally Posted by WildCard65 View Post
I believe the pan is also a saxxy
The pan is also a melee weapon.

The saxxy meta-class maps to these server classes, depending on the player class:
  • tf_weapon_bat
  • tf_weapon_shovel
  • tf_weapon_fireaxe
  • tf_weapon_bottle
  • tf_weapon_fists
  • tf_weapon_wrench
  • tf_weapon_bonesaw
  • tf_weapon_club
  • tf_weapon_knife
__________________
Not currently working on SourceMod plugin development.
Powerlord 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 15:44.


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