AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Change movetype on func_door (https://forums.alliedmods.net/showthread.php?t=107066)

Sn!ff3r 10-22-2009 09:37

Change movetype on func_door
 
Hi.

PHP Code:

public remove_move() 
{    
    new 
ent 0
    
while(( ent find_ent_by_class(-1"func_door") ))
    {
        
entity_set_int(entEV_INT_movetypeMOVETYPE_NONE)
    }


This code is crashing server. So how to change movetype to none ? I also tried to set entity speed to 0, and movedir to {0.0, 0.0, 0.0}, but server still crashing.

So how prevent these entity from move?

xPaw 10-22-2009 10:17

Re: Change movetype on func_door
 
while(( ent = find_ent_by_class(ent, "func_door") ))

Jon 10-22-2009 10:34

Re: Change movetype on func_door
 
PHP Code:

public plugin_init( )
{
    
register_touch"func_door_rotating""player""FwdTouchDoor" );
    
register_touch"func_door""player""FwdTouchDoor" );
}

public 
FwdTouchDooriDoorEntiClient )
{
    return 
PLUGIN_HANDLED;



xPaw 10-22-2009 12:12

Re: Change movetype on func_door
 
Quote:

Originally Posted by Jon (Post 969183)
PHP Code:

public plugin_init( )
{
    
register_touch"func_door_rotating""player""FwdTouchDoor" );
    
register_touch"func_door""player""FwdTouchDoor" );
}

public 
FwdTouchDooriDoorEntiClient )
{
    return 
PLUGIN_HANDLED;



I'd prefer Ham_Use, just because other ents can call the entity (buttons, triggers etc)

Sn!ff3r 10-22-2009 12:12

Re: Change movetype on func_door
 
xPaw - no changes (ex. in first code when i try to delete entity, my attemp was successfull), so while loop looks ok.

ConnorMcLeod 10-22-2009 12:15

Re: Change movetype on func_door
 
If you delete the ent, then you can again use -1 as first index searched.
If you don't delete it, your loop is infinite as you always return the same func_door index, and the server crash (or freeze)

PHP Code:

public remove_move() 
{    
    new 
ent = -1
    
while( ( ent find_ent_by_class(ent"func_door") ) > )
    {
        
entity_set_int(entEV_INT_movetypeMOVETYPE_NONE)
    }




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

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