AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved CreateEntityByName (https://forums.alliedmods.net/showthread.php?t=303248)

Spirit_12 11-28-2017 17:47

CreateEntityByName
 
I get this error on my plugin, when I call CreateEntityByName native. How can I check, if the map is running or not?

PHP Code:

[SMException reportedCannot create new entity when no map is running 


rodrigo286 11-28-2017 18:28

Re: CreateEntityByName
 
Simple, dont try create any entity before map load like OnMapStart, OnPluginStart...

Regards.

Neuro Toxin 11-29-2017 14:50

Re: CreateEntityByName
 
You generally create enitities during the round_start event.

Lux 11-29-2017 16:09

Re: CreateEntityByName
 
I use

PHP Code:

HookEvent("round_start_post_nav"eRoundStartPostNav);

public 
eRoundStartPostNav(Handle:hEvent, const String:sName[], bool:bDontBroadcast)
{



Never got issues from using that, if you still get issues try a 1sec timer or check if any one is alive ingame.

rodrigo286 11-29-2017 16:57

Re: CreateEntityByName
 
What exactly do you need to do?

Regards.

Spirit_12 11-29-2017 19:47

Re: CreateEntityByName
 
Quote:

Originally Posted by Lux (Post 2563603)
I use
Never got issues from using that, if you still get issues try a 1sec timer or check if any one is alive ingame.

Entities were being removed/created after the round start event, but that didn't do the trick. I added a 3 second timer and that fixed the issue for me.

hmmmmm 11-30-2017 00:10

Re: CreateEntityByName
 
HookEvent( "round_start", Hook_RoundStartPost, EventHookMode_Post );

That's how I did it and works for me.

bald14 09-23-2021 08:27

Re: CreateEntityByName
 
Quote:

Originally Posted by Lux (Post 2563603)
I use

PHP Code:

HookEvent("round_start_post_nav"eRoundStartPostNav);

public 
eRoundStartPostNav(Handle:hEvent, const String:sName[], bool:bDontBroadcast)
{



Never got issues from using that, if you still get issues try a 1sec timer or check if any one is alive ingame.

specifically how can you clarify for me ?
sorry i'm not good at this and my english is bad too

Marttt 09-23-2021 10:01

Re: CreateEntityByName
 
I think this is an exclusive event to L4D series, if you have this problem in another game, probably would use a different event or the other tips provided above.

kadet.89 09-24-2021 05:59

Re: CreateEntityByName
 
"round_start" event has a problem in CS: S, CS:GO and probably in other Source games. Sometimes it is fired before entities are clean-up, thus all entities created in the post hook may be deleted right away. It is enough to add a timer with 1 frame delay to avoid this problem.


All times are GMT -4. The time now is 00:45.

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