AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Removing C4 on C4 map CS:S (https://forums.alliedmods.net/showthread.php?t=280389)

Tallio 03-14-2016 22:21

Removing C4 on C4 map CS:S
 
Hello Guys
I m looking for the way to remove the C4 mod on a C4 dedicated map...

I used this :

PHP Code:

public Action DropC4(Handle timerany client)
{
    if( 
IsClientConnected(client) && IsClientInGame(client) ){
        if(
IsPlayerAlive(client))
        {
            
int weaponIndex GetPlayerWeaponSlot(clientCS_SLOT_C4);
            if (
weaponIndex >= 0)
            {
                
CS_DropWeapon(clientweaponIndexfalse);
            }
        }
    }


But each time the C4 is dropped on the map, as soon after someone else on the T team get the C4 instead of my player... systematicaly

8guawong 03-14-2016 22:53

Re: Removing C4 on C4 map CS:S
 
use stripper:source

Kolapsicle 03-14-2016 23:45

Re: Removing C4 on C4 map CS:S
 
I may be misunderstanding your situation, but why not remove the C4 instead of dropping it?

PHP Code:

RemovePlayerItem(clientweaponIndex); 


xines 03-14-2016 23:50

Re: Removing C4 on C4 map CS:S
 
Not sure if it's this you need.

This removes c4 from being picked up by a player.
PHP Code:

#include <sourcemod>
#include <sdkhooks>

public OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_WeaponCanUseOnWeaponCanUse);
}

public 
Action:OnWeaponCanUse(clientweaponent
{
    if(
IsClientInGame(client) && IsPlayerAlive(client))
    {
        
decl String:Wep[32];
        
GetEdictClassname(weaponentWepsizeof(Wep));
        if(
StrContains(Wep"c4")>-1) {
            return 
Plugin_Handled;
        }
    }
    return 
Plugin_Continue;



Tallio 03-15-2016 11:45

Re: Removing C4 on C4 map CS:S
 
Perefct Xines ! Exactly what i wanted :)
Thank you very much

TnTSCS 03-15-2016 16:36

Re: Removing C4 on C4 map CS:S
 
I'm not current on the changes, but something like this would work to remove the C4

PHP Code:

#include <sourcemod>
#include <sdktools>
#include <cstrike>
public CS_RemoveBomb(client)
{
    new 
weapon_index = -1;
    
    for (new 
slot 0slot 6slot++)
    {
        while ((
weapon_index GetPlayerWeaponSlot(clientslot)) != -1)
        {
            if (
IsValidEntity(weapon_index))
            {
                if (
slot == CS_SLOT_C4)
                {
                    
RemovePlayerItem(clientweapon_index);
                    
AcceptEntityInput(weapon_index"kill");
                }
            }
        }
    }




All times are GMT -4. The time now is 09:36.

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