This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[TF2] Pets


Post New Thread Reply   
 
Thread Tools Display Modes
arthurdead
Senior Member
Join Date: Jul 2013
Old 01-13-2014 , 22:01   Re: [TF2] Pets
Reply With Quote #31

Quote:
Originally Posted by abrandnewday View Post
Found another duplication glitch. Caused by the post_inventory_application event (which hasn't been coded in).

When you change items in a spawn room and respawn, your Pet duplicates itself leaving an idle copy.

Just add in this code to fix it:

PHP Code:
// Put this inside OnPluginStart
HookEvent("post_inventory_application"Event_InventoryEventHookMode_Post);


// Then this goes wherever
public Action:Event_Inventory(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if(
petType[client] != 0)
    {
        
KillPet(client);
    }

Now I believe I have found and patched all pet duplication causes.
thank you good sir
arthurdead is offline
arthurdead
Senior Member
Join Date: Jul 2013
Old 01-13-2014 , 22:11   Re: [TF2] Pets
Reply With Quote #32

Quote:
Originally Posted by abrandnewday View Post
Finally, one thing you should add to the PetThink(client) function is a check to see if the player is a Spy. When the Spy cloaks, have the pet change its model "alpha" to 0 to make it go invis, otherwise the pet can give away the location of the Spy.
added your fix and spy but didn't tested

Last edited by arthurdead; 01-13-2014 at 22:11.
arthurdead is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-13-2014 , 22:36   Re: [TF2] Pets
Reply With Quote #33

Quote:
Originally Posted by arthurdead View Post
added your fix and spy but didn't tested
My inventory/class change fixes do work. I've tested those myself.

I haven't added any sort of spy cloak checking though.
404UserNotFound is offline
arthurdead
Senior Member
Join Date: Jul 2013
Old 01-14-2014 , 07:32   Re: [TF2] Pets
Reply With Quote #34

Quote:
Originally Posted by abrandnewday View Post
My inventory/class change fixes do work. I've tested those myself.

I haven't added any sort of spy cloak checking though.
i was talking about the spy cloak check i added
arthurdead is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-15-2014 , 20:44   Re: [TF2] Pets
Reply With Quote #35

We got another issue. If you use the "kill pet" command to get rid of your pet, and you respawn, the pet respawns too (at least it does in my version).

I'm looking into fixing that, not exactly sure how I'm gonna go about it though.
404UserNotFound is offline
arthurdead
Senior Member
Join Date: Jul 2013
Old 01-15-2014 , 20:51   Re: [TF2] Pets
Reply With Quote #36

Quote:
Originally Posted by abrandnewday View Post
We got another issue. If you use the "kill pet" command to get rid of your pet, and you respawn, the pet respawns too (at least it does in my version).

I'm looking into fixing that, not exactly sure how I'm gonna go about it though.
this was intentional just add petType[client] = 0 to the killpet command
arthurdead is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-15-2014 , 21:25   Re: [TF2] Pets
Reply With Quote #37

Quote:
Originally Posted by arthurdead View Post
this was intentional just add petType[client] = 0 to the killpet command
Ohhhh. Easy fix!
404UserNotFound is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-16-2014 , 15:39   Re: [TF2] Pets
Reply With Quote #38

So we have two new errors (in my version that I've added the classchange/inventory checks on).

1. When the server is empty and someone joins, they are given a pet. From what I've been told by a few people, it's the 7th pet that I've made in the pets.inc file. No error in the logs for this one.

2. Here's the error. It not only occurrs on the inventory event, but also on player_death, player_changeclass and anything else that calls KillPet()

Code:
L 01/16/2014 - 13:54:00: [SM] Native "GetEntPropVector" reported: Entity 646 (646) is invalid
L 01/16/2014 - 13:54:00: [SM] Displaying call stack trace for plugin "pets.smx":
L 01/16/2014 - 13:54:00: [SM]   [0]  Line 433, C:\Coding\addons\sourcemod\scripting\pets.sp::KillPet()
L 01/16/2014 - 13:54:00: [SM]   [1]  Line 375, C:\Coding\addons\sourcemod\scripting\pets.sp::Event_Inventory()
The lines in particular that the error is pointing to are as follows:

PHP Code:
public Action:Event_Inventory(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if(
petType[client] != 0)
    {
        
KillPet(client); // <-- Line 375
    
}
}

public 
KillPet(client)
{
    if(
pet[client] == 0)
    {
        return;
    }
    
decl Float:pos[3];
    
GetEntPropVector(pet[client], Prop_Data"m_vecOrigin"pos); // <-- Line 433
    
SDKUnhook(clientSDKHook_PreThinkPetThink);
    
AcceptEntityInput(pet[client], "Kill");
    
CreateParticle(petInfo[petType[client]][iDeathParticle], pos);
    
pet[client] = 0;


Last edited by 404UserNotFound; 01-16-2014 at 15:48.
404UserNotFound is offline
arthurdead
Senior Member
Join Date: Jul 2013
Old 01-16-2014 , 15:48   Re: [TF2] Pets
Reply With Quote #39

Quote:
Originally Posted by abrandnewday View Post
So we have two new errors (in my version that I've added the classchange/inventory checks on).

1. When the server is empty and someone joins, they are given a pet. From what I've been told by a few people, it's the 7th pet that I've made in the pets.inc file. No error in the logs for this one.

2. Here's the error:

Code:
L 01/16/2014 - 13:54:00: [SM] Native "GetEntPropVector" reported: Entity 646 (646) is invalid
L 01/16/2014 - 13:54:00: [SM] Displaying call stack trace for plugin "pets.smx":
L 01/16/2014 - 13:54:00: [SM]   [0]  Line 433, C:\Coding\addons\sourcemod\scripting\pets.sp::KillPet()
L 01/16/2014 - 13:54:00: [SM]   [1]  Line 375, C:\Coding\addons\sourcemod\scripting\pets.sp::Event_Inventory()
The lines in particular that the error is pointing to are as follows:

PHP Code:
public KillPet(client)
{
    if(
pet[client] == 0)
    {
        return;
    }
    
decl Float:pos[3];
    
GetEntPropVector(pet[client], Prop_Data"m_vecOrigin"pos); // <-- Line 433
    
SDKUnhook(clientSDKHook_PreThinkPetThink);
    
AcceptEntityInput(pet[client], "Kill");
    
CreateParticle(petInfo[petType[client]][iDeathParticle], pos);
    
pet[client] = 0;


public 
Action:Event_Inventory(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if(
petType[client] != 0)
    {
        
KillPet(client); // <-- Line 375
    
}

try the one on main post
arthurdead is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-16-2014 , 15:49   Re: [TF2] Pets
Reply With Quote #40

Quote:
Originally Posted by arthurdead View Post
try the one on main post
Oh, you updated the main post version?

Side note: Instead of pasting the code in PHP tags, pop the files into a ZIP file and upload the ZIP file using the Manage Attachments option.
404UserNotFound 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 17:47.


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