AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Removing weaponbox crashes server (https://forums.alliedmods.net/showthread.php?t=153314)

peku33 03-21-2011 14:48

Removing weaponbox crashes server
 
Hi. I created code for simple DM, all works fine. Then I realised, that after 20 mins of 32 players game whole map is covered with dropped weapons.

So i wrote next plugin:

plugin_init:
RegisterHam(Ham_Spawn, "weaponbox", "clear_weapon", 1);

public clear_weapon(id):
fm_remove_entity(id)

After few mins of play server crashes. I use original STEAM (no dproto / cracks etc)

Code:

meta list
Currently loaded plugins:
      description      stat pend  file              vers      src  load  unlod
 [ 1] AMX Mod X        RUN  -    amxmodx_mm_i386.  v1.8.1.3  ini  Start ANY 
 [ 2] MySQL            RUN  -    mysql_amxx_i386.  v1.8.1.3  pl1  ANY  ANY 
 [ 3] Fun              RUN  -    fun_amxx_i386.so  v1.8.1.3  pl1  ANY  ANY 
 [ 4] Engine          RUN  -    engine_amxx_i386  v1.8.1.3  pl1  ANY  ANY 
 [ 5] FakeMeta        RUN  -    fakemeta_amxx_i3  v1.8.1.3  pl1  ANY  ANY 
 [ 6] CStrike          RUN  -    cstrike_amxx_i38  v1.8.1.3  pl1  ANY  ANY 
 [ 7] CSX              RUN  -    csx_amxx_i386.so  v1.8.1.3  pl1  ANY  ANY 
 [ 8] Ham Sandwich    RUN  -    hamsandwich_amxx  v1.8.1.3  pl1  ANY  ANY 
8 plugins, 8 running
version
Protocol version 48
Exe version 1.1.2.6/Stdio (cstrike)
Exe build: 16:56:12 Mar  8 2010 (4883)

Setting it on task (0.1 / 1.0) or checking whether owner is alive does not give any effect. When i remove empty weapon remover, servers works fine.

What should i do?

meTaLiCroSS 03-21-2011 17:02

Re: Removing weaponbox crashes server
 
fm_remove_entity

-->

call_think

ConnorMcLeod 03-21-2011 17:03

Re: Removing weaponbox crashes server
 
Why don't you set csdm.cfg (.ini ?) so it auto removes dropped weapons ?

schmurgel1983 03-21-2011 18:26

Re: Removing weaponbox crashes server
 
because he is not running csdm...

ConnorMcLeod 03-21-2011 18:52

Re: Removing weaponbox crashes server
 
This works fine :

RegisterHam( Ham_Touch, "weaponbox", "WeaponBox_Touch", 1 )

public WeaponBox_Touch(iEnt/*, iOther*/)
{
dllfunc(DLLFunc_Think, iEnt)
}

peku33 03-27-2011 14:50

Re: Removing weaponbox crashes server
 
problem solved by changing fm_remove_entity -> dllfunc callthink. Thanks + close

ConnorMcLeod 03-28-2011 02:12

Re: Removing weaponbox crashes server
 
Quote:

Originally Posted by peku33 (Post 1440293)
problem solved by changing fm_remove_entity -> dllfunc callthink. Thanks + close

But if you remove weaponbox at Spawn, the weapon that would have been put inside this weaponbox right after spawn is not removed, that's why you would have better to hook Touch that is sent right after Spawn.


All times are GMT -4. The time now is 14:34.

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