AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Bomb gets stuck inside player! (https://forums.alliedmods.net/showthread.php?t=302777)

suhdude 11-10-2017 14:39

Bomb gets stuck inside player!
 
[SOLVED]

I have a plugin that automatically drops the bomb when a player with the bomb spawns in a bombzone. This is for a retake scenario server, but the bomb gets stuck inside the player planting.

I have tried turning the gravity very high so that the bomb falls to the ground very fast, but this was not very good for several reasons.

And then I tried to give the player noclip for a second before dropping the bomb, this worked a few times but is not very good..

I also tried slapping the player.. This is very ugly and did not work every time..

Is there any good solution to this?

suhdude 11-10-2017 17:13

Re: Bomb gets stuck inside player!
 
Code:
public PlantABomb( player ) {     new iEntity = create_entity( "weapon_c4" );           if( !iEntity )         return;           DispatchKeyValue( iEntity, "detonatedelay", "50" );     DispatchSpawn( iEntity );           new Float:origin[ 3 ];     pev( player, pev_origin, origin );           engfunc( EngFunc_SetOrigin, iEntity, origin );           force_use( iEntity, iEntity ); // This plants it }

suhdude 11-10-2017 17:18

Re: Bomb gets stuck inside player!
 
To anyone who tried this script and think its working:
It only does when you are alone on a server for some reason.

I've tried it with a friend, and one of us gets stuck all the time while the other can plant without any issue.

suhdude 11-11-2017 15:06

Re: Bomb gets stuck inside player!
 
Code:
    new Float:origin[ 3 ];     pev( player, pev_origin, origin );           engfunc( EngFunc_SetOrigin, iEntity, origin );

It must have something to do with this section, is it not possible to make it spawn a little bit away from the players origin? So that it does not get stuck?

Thanks

wickedd 11-11-2017 15:17

Re: Bomb gets stuck inside player!
 
Stop multi posting, learn how to use the edit button.

Edit: You can start by doing something like this, you can get more sophisticated later.
PHP Code:

    new Float:origin]; 
    
pevplayerpev_originorigin ); 
     
    
engfuncEngFunc_SetOriginiEntityorigin ); 

:arrow:
PHP Code:

    new Float:origin]; 
    
pevplayerpev_originorigin ); 
     
    
origin] += 30.0
    
// or
    
origin] += 30.0
        
    engfunc
EngFunc_SetOriginiEntityorigin ); 


suhdude 11-11-2017 17:06

Re: Bomb gets stuck inside player!
 
Quote:

Originally Posted by wickedd (Post 2559873)
Stop multi posting, learn how to use the edit button.

Edit: You can start by doing something like this, you can get more sophisticated later.
PHP Code:

    new Float:origin]; 
    
pevplayerpev_originorigin ); 
     
    
engfuncEngFunc_SetOriginiEntityorigin ); 

:arrow:
PHP Code:

    new Float:origin]; 
    
pevplayerpev_originorigin ); 
     
    
origin] += 30.0
    
// or
    
origin] += 30.0
        
    engfunc
EngFunc_SetOriginiEntityorigin ); 


Sorry, I will.

Thank you so much!


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

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