Thread: [TF2] Pets
View Single Post
404UserNotFound
BANNED
Join Date: Dec 2011
Old 01-13-2014 , 21:58   Re: [TF2] Pets
Reply With Quote #30

Quote:
Originally Posted by arthurdead View Post
i want finish config files first
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.

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.

Last edited by 404UserNotFound; 01-13-2014 at 22:01.
404UserNotFound is offline