AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Auto Plant C4 after spawn (https://forums.alliedmods.net/showthread.php?t=330518)

Celena Luna 02-07-2021 21:40

Auto Plant C4 after spawn
 
I tried to plant the C4 right when you spawn with the bombsite is the whole map. I found a way that create a fake C4 but it won't work with BOT since bot hook NETMSG_TEXTMSG #Bomb_Planted so it will just run around even when enemy team is all dead rather than defusing the bomb.

This is what I got so far.

PHP Code:

public plugin_precache()
{
    
CreateBombTarget();

}

public 
fw_Player_Spawn_Post(id)
{

    if(
is_user_alive(id) && user_has_weapon(idCSW_C4))
    {
        
engclient_cmd(id"weapon_c4")
        static 
entent fm_get_user_weapon_entity(idCSW_C4)
        
ExecutreHam(Ham_Weapon_PrimaryAttackent)
    }
}

public 
CreateBombTarget()
{
    new 
NewBombTarget engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"func_bomb_target"))
    if(
NewBombTarget 0)
    {
        
dllfunc(DLLFunc_SpawnNewBombTarget)
        
engfunc(EngFunc_SetSizeNewBombTargetFloat:{-100000.0,-100000.0,-100000.0}, Float:{100000.0,100000.0,100000.0})
    }


I have also tried those offset but it seem doesn't work too
PHP Code:

#define m_bStartedArming 320
#define m_bBombPlacedAnimation 321
#define m_flArmedTime 81 

I also tried Auto Plant plugins but it doesn't work.

This only show the starting part and a bar time but it can't actually plant the bomb.


It is the best if it can play full animation but as long as it can be plant, I am happy with that.

+ARUKARI- 02-07-2021 21:51

Re: Auto Plant C4 after spawn
 
This one?
PHP Code:

/**
 * Sets the client's ability to plant the bomb and displays or hides the bomb
 * HUD icon.
 *
 * @note Only with this set can the client plant the bomb within the usual bomb
 *       target areas. If this is not set the user can not plant the bomb, even
 *       when he has one in the inventory. This is only correctly set when the
 *       client touches a bomb and picks it up "manually" (only possible for
 *       Terrorists), so this should be used if the bomb is added to the
 *       inventory through other means.
 *
 * @param index         Client index
 * @param plant         If nonzero the client will be able to plant the bomb,
 *                      otherwise he will be unable to
 * @param showbombicon  If nonzero the green C4 icon will be displayed on the
 *                      client's hud, otherwise it will be hidden
 *
 * @return              1 if the client is able to plant the bomb, 0 otherwise
 * @error               If the client index is not within the range of 1 to
 *                      MaxClients, or the client is not connected, an error
 *                      will be thrown.
 */
native cs_set_user_plant(indexplant 1showbombicon 1); 


Celena Luna 02-07-2021 21:54

Re: Auto Plant C4 after spawn
 
Quote:

Originally Posted by +ARUKARI- (Post 2736096)
This one?
PHP Code:

/**
 * Sets the client's ability to plant the bomb and displays or hides the bomb
 * HUD icon.
 *
 * @note Only with this set can the client plant the bomb within the usual bomb
 *       target areas. If this is not set the user can not plant the bomb, even
 *       when he has one in the inventory. This is only correctly set when the
 *       client touches a bomb and picks it up "manually" (only possible for
 *       Terrorists), so this should be used if the bomb is added to the
 *       inventory through other means.
 *
 * @param index         Client index
 * @param plant         If nonzero the client will be able to plant the bomb,
 *                      otherwise he will be unable to
 * @param showbombicon  If nonzero the green C4 icon will be displayed on the
 *                      client's hud, otherwise it will be hidden
 *
 * @return              1 if the client is able to plant the bomb, 0 otherwise
 * @error               If the client index is not within the range of 1 to
 *                      MaxClients, or the client is not connected, an error
 *                      will be thrown.
 */
native cs_set_user_plant(indexplant 1showbombicon 1); 


This one only show the plant StatusIcon, not actually plant it

Shadows Adi 02-08-2021 10:23

Re: Auto Plant C4 after spawn
 
Maybe this will help you:
Only reAPI

native rg_plant_bomb()

Celena Luna 02-08-2021 12:53

Re: Auto Plant C4 after spawn
 
Quote:

Originally Posted by Shadows Adi (Post 2736144)
Maybe this will help you:
Only reAPI

native rg_plant_bomb()

reAPI did work but I need it to work on the original HLDS too


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

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