I'm having errors with this code on those functions:
PHP Code:
public OnEntityDestroyed(entity)
{
if(!g_isDBmap) return;
if(!IsValidEntity(entity)) return;
int rIndex = GetRocketIndex(EntIndexToEntRef(entity));
if(rIndex == -1) return;
[...]
Error:
Quote:
L 03/06/2015 - 01:40:06: [SM] Native "EntIndexToEntRef" reported: Invalid entity index -2123601431
L 03/06/2015 - 01:40:06: [SM] Displaying call stack trace for plugin "dodgeball_redux.smx":
L 03/06/2015 - 01:40:06: [SM] [0] Line 1864, C:\Users\Daniel\Documents\GitHub\dodgeball\ad dons\sourcemod\scripting\dodgeball_redux.sp:: OnEntityDestroyed()
|
How could the entity parameter be a invalid entity? I added that IsValidEntity check and It didn't help.
So EntIndexToEntRef(entity) is getting a invalid entity and I don't know what to do.
2nd problem:
PHP Code:
public OnEntityCreated(entity, const String:classname[])
{
if(!g_isDBmap) return;
if(!StrEqual("tf_ammo_pack",classname)) return;
int dissolver = CreateEntityByName("env_entity_dissolver");
if (dissolver == -1) return;
DispatchKeyValue(dissolver, "dissolvetype", "0");
DispatchKeyValue(dissolver, "magnitude", "1");
DispatchKeyValue(dissolver, "target", "!activator");
AcceptEntityInput(dissolver, "Dissolve", entity);
AcceptEntityInput(dissolver, "Kill");
}
Error:
Quote:
L 03/06/2015 - 01:40:18: SourceMod error session started
L 03/06/2015 - 01:40:18: Info (map "arena_well") (file "errors_20150306.log")
L 03/06/2015 - 01:40:18: [SM] Native "CreateEntityByName" reported: Cannot create new entity when no map is running
L 03/06/2015 - 01:40:18: [SM] Displaying call stack trace for plugin "dodgeball_redux.smx":
L 03/06/2015 - 01:40:18: [SM] [0] Line 1844, C:\Users\Daniel\Documents\GitHub\dodgeball\ad dons\sourcemod\scripting\dodgeball_redux.sp:: OnEntityCreated()
L 03/06/2015 - 02:44:58: Error log file session closed.
L 03/06/2015 - 02:58:55: SourceMod error session started
L 03/06/2015 - 02:58:55: Info (map "tfdb_inferno_a5") (file "errors_20150306.log")
L 03/06/2015 - 02:58:55: [SM] Native "CreateEntityByName" reported: Cannot create new entity when no map is running
L 03/06/2015 - 02:58:55: [SM] Displaying call stack trace for plugin "dodgeball_redux.smx":
L 03/06/2015 - 02:58:55: [SM] [0] Line 1844, C:\Users\Daniel\Documents\GitHub\dodgeball\ad dons\sourcemod\scripting\dodgeball_redux.sp:: OnEntityCreated()
|
The weird part about this is that it is called even on non DB maps. How could the OnEntityCreated be called while the map isn't running? and even then if the CreateEntityByName is being called it's mean that the entity created was "tf_ammo_pack" (dropped weapons and building's parts.
If anyone could help me on these one it would be great!
By the way, here is the
code on GitHub, any suggestions (even if they are for something else in the code) are welcomed).
__________________