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(client, SDKHook_PreThink, PetThink);
AcceptEntityInput(pet[client], "Kill");
CreateParticle(petInfo[petType[client]][iDeathParticle], pos);
pet[client] = 0;
}