AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Stripping the c4 (https://forums.alliedmods.net/showthread.php?t=113435)

Mxnn 12-26-2009 18:56

Stripping the c4
 
Hi, i want to remove the c4 from the game. I tried to force the client to drop it but didn't works..
I follow this topic and i can't do it.
I can force the client to drop all their weapons but the c4 is not dropped!
I put this:
PHP Code:

    get_user_weapons(idiweaponsinum2)
    
    for(new 
a=0a<inum2a++) {
        
get_weaponname(iweapons[a], wpname31)
        
engclient_cmd(id"drop"wpname)
    } 


hleV 12-26-2009 19:23

Re: Stripping the c4
 
Try this.
PHP Code:

#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <cstrike>
 
public plugin_init()
        
RegisterHam(Ham_Spawn"player""Spawn"1);
 
public 
Spawn(Client)
{
        
cs_set_user_plant(Client00);
        
entity_set_int(ClientEV_INT_body0);



#8 SickneSS 12-26-2009 19:31

Re: Stripping the c4
 
PHP Code:

public plugin_init() { 

     
register_logevent("cmdRoundStart",2,"1=Round_Start")


PHP Code:

public cmdRoundStart() {
    
        for( new 
1get_maxplayers(); i++)
        {
            if(
get_pcvar_num(noc4)
            && 
user_has_weapon(i,CSW_C4))
            {
                
ham_strip_weapon(i,"weapon_c4")
            }
        }


PHP Code:

stock ham_strip_weapon(id,weapon[]) { /* By XxAvalanchexX */
    
    
if(!equal(weapon,"weapon_",7)) return 0;
    
    new 
wId get_weaponid(weapon);
    if(!
wId) return 0;
    
    new 
wEnt;
    while((
wEnt engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
    if(!
wEnt) return 0;
    
    if(
get_user_weapon(id) == wIdExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);
    
    if(!
ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0;
    
ExecuteHamB(Ham_Item_Kill,wEnt);
    
    
set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId));
    
    if(
wId == CSW_C4)
    {
        
cs_set_user_plant(id,0,0);
        
cs_set_user_bpammo(id,CSW_C4,0);
    }
    else if(
wId == CSW_SMOKEGRENADE || wId == CSW_FLASHBANG || wId == CSW_HEGRENADE)
        
cs_set_user_bpammo(id,wId,0);
    
    return 
1;


i used this for warmup mod.

platzpatrone 12-26-2009 19:44

Re: Stripping the c4
 
i use this on my plugin and it worked well

PHP Code:

// How to force a player to drop the bomb?
    
engclient_cmd(id"drop""weapon_c4")
 
// How to remove the dropped bomb?
    
new weapboxbomb fm_find_ent_by_class(-1"weapon_c4")
    if (
bomb && (weapbox pev(bombpev_owner)) > get_maxplayers()) {
        
dllfunc(DLLFunc_Thinkweapbox// will remove weaponbox + weapon_c4 entity pair
        // remove blinking red bomb mark on the radar
        
message_begin(MSG_ALLget_user_msgid("BombPickup"))
        
message_end()
    } 

its from the tutorial

master4life 12-26-2009 19:44

Re: Stripping the c4
 
Test this, without bombzone no Bomb for Ts :P

PHP Code:

#include < amxmodx >
#include < engine >

public plugin_init( ) {
    
register_plugin"Remove Bombzone""0.1""master4life" );
    
    
remove_entity_name"func_bomb_target" );
    
remove_entity_name"info_bomb_target" );



Mxnn 12-26-2009 22:38

Re: Stripping the c4
 
Thanks all! I can resolve it with the master4life stuf!

But i have a question.. Which is the best method to find a entity in a map?

ConnorMcLeod 12-27-2009 15:33

Re: Stripping the c4
 
It depends on which type of ent you search, and on what you already know about the entity you are searching for.

Mxnn 12-27-2009 16:05

Re: Stripping the c4
 
I tried to search in a map the entity "func_bomb_target" or "hostage_entity".. If exists delete it :D
But i search a function to do this but i don't know which function do this :(

ConnorMcLeod 12-27-2009 16:06

Re: Stripping the c4
 
Then use find_ent_by_class

Mxnn 12-27-2009 16:51

Re: Stripping the c4
 
Thanks! +k


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

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