AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to remove C4 bomb from user? (https://forums.alliedmods.net/showthread.php?t=197029)

kketan77 09-28-2012 05:39

How to remove C4 bomb from user?
 
Is this possible to remove c4 bomb from users inventory without being noticed?

(I dont like to see dropped c4 on ground on ground)

User must spawn with c4 bomb at every round.
The c4 bomb should be removed from inventory after the function is called!

[I want to know that thing which removes bomb from users inventory after it is planted on bomb site!]

jimaway 09-28-2012 06:01

Re: How to remove C4 bomb from user?
 
yes its possible
http://forums.alliedmods.net/showthread.php?t=56377
theres an example you could use to strip c4

kketan77 09-28-2012 06:04

Re: How to remove C4 bomb from user?
 
That's nice! :D

Can you give me example? or that function?

Backstabnoob 09-28-2012 06:27

Re: How to remove C4 bomb from user?
 
copy the ham_strip_user_weapon stock from the code and uncomment the counter-strike block with C4.
Then simply use ham_strip_user_weapon( id, "weapon_c4" ).

kketan77 09-30-2012 09:24

Re: How to remove C4 bomb from user?
 
Thnx solve
Code:

ham_strip_weapon(id,"weapon_c4")

I dont want make spam that's why i am posting another topic related with C4 bomb.


PHP Code:

public plugin_init()
{
    if(
find_ent_by_class(-1"func_bomb_target")>0||find_ent_by_class(-1"info_bomb_target")>0)
    {
        
RegisterHam(Ham_Spawn"player""inventory"true)
    }
}

public 
inventory(id)
{
    if( 
is_user_alive(id) && get_user_team(id) == && cs_get_user_bpammo(idCSW_C4) == )
    {
        
fm_give_item(id"weapon_c4")
    }


I tried to give C4 bomb to all terrorist when they spawn expect those who alredy have one C4 bomb.

Why above code is giving C4 bomb to all terrorist?
If terrorist is already have C4 bomb then it should not receive another C4 bomb.

My code is correct or not?
How could i stop default c4 giving function?
Or is there any another way to find if terrorist already have c4 bomb?

Is there any solution? :roll:


EDIT:

Thnx solved!

Game already have there default spawn function! For custom function it need little bit delay! It is done through set_task.

Tested and works perfect for me! :mrgreen:

PHP Code:

public plugin_init()
{
    if(
find_ent_by_class(-1"func_bomb_target")>0||find_ent_by_class(-1"info_bomb_target")>0)
    {
        
RegisterHam(Ham_Spawn"player""inventory"true)
    }
}

public 
inventory(id)
{
    if( 
is_user_alive(id) && get_user_team(id) == 1)
    {
        
set_task(0.1"give_c4")
    }
}

public 
give_c4(id)
{
    if(
is_user_alive(id) && cs_get_user_bpammo(idCSW_C4) == 0)
    {
        
fm_give_item(id"weapon_c4")
        
cs_set_user_plant(id1)
    }



jimaway 09-30-2012 10:40

Re: How to remove C4 bomb from user?
 
the c4 is probably given after player spawns

^SmileY 09-30-2012 18:38

Re: How to remove C4 bomb from user?
 
Hey, only block a user plant C4 :)

PHP Code:

#include <amxmodx>
#include <cstrike>

#define SHOW_BOMB_ICON 0

public plugin_init()
{
    
register_plugin("Disable C4 Arm",AMXX_VERSION_STR,"SmileY");

    
register_event("CurWeapon","CurWeapon","be","1=1");
}

public 
CurWeapon(id)
{
    if(
get_user_weapon(id) == CSW_C4)
    {
        
cs_set_user_plant(id,0,SHOW_BOMB_ICON);

        
client_print(id,print_chat,"[AMXX] C4 Arming is now disabled.");
    }



meTaLiCroSS 09-30-2012 20:17

Re: How to remove C4 bomb from user?
 
With orpheu hook "GiveC4" and supercede it


All times are GMT -4. The time now is 08:19.

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