AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Undropable weapons (https://forums.alliedmods.net/showthread.php?t=93297)

Debesėlis 05-27-2009 06:39

Undropable weapons
 
How do you make these weapons undropable?

PHP Code:

public rifles(id)
{
    if(
rifles_active[id] == 1)
    {
        
fm_strip_user_weapons(id)

        if(
cs_get_user_team(id) == CS_TEAM_T)
        {
            
give_item(id"weapon_knife")
            
give_item(id"weapon_deagle")
            
give_item(id"weapon_m4a1")
            
give_item(id"weapon_awp")
            
cs_set_user_defuse(id0)
        }

        if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
give_item(id"weapon_knife")
            
give_item(id"weapon_deagle")
            
give_item(id"weapon_ak47")
            
give_item(id"weapon_awp")
            
cs_set_user_defuse(id1)
        }
    }



Xellath 05-27-2009 07:02

Re: Undropable weapons
 
PHP Code:

public plugin_init()
{
    
register_clcmd("drop""cmdBlock");
}
 
public 
cmdBlock()
    return 
PLUGIN_HANDLED_MAIN

Something like that, or do you just want to drop specific weapons?

Debesėlis 05-27-2009 07:09

Re: Undropable weapons
 
Quote:

Originally Posted by Xellath (Post 835663)
PHP Code:

public plugin_init()
{
    
register_clcmd("drop""cmdBlock");
}
 
public 
cmdBlock()
    return 
PLUGIN_HANDLED_MAIN

Something like that, or do you just want to drop specific weapons?

I want the weapons given not to be dropped, but if the terrorists have the C4, they'd still be able to drop it.
by the way, the command fm_strip_user_weapons(id) removes all weapons, how do I make it not remove the C4 if a terrorist has it?

zwfgdlc 05-27-2009 07:27

Re: Undropable weapons
 
use ham_strip_weapon.
http://forums.alliedmods.net/showthread.php?t=56377

SnoW 05-27-2009 07:28

Re: Undropable weapons
 
Quote:

Originally Posted by Debesėlis (Post 835666)
I want the weapons given not to be dropped, but if the terrorists have the C4, they'd still be able to drop it.

You can't make some exact weapon undropable. But you can mark the item or som' and when hooking dropping do what you want.
Quote:

Originally Posted by Debesėlis (Post 835666)
by the way, the command fm_strip_user_weapons(id) removes all weapons, how do I make it not remove the C4 if a terrorist has it?

Use strip_user_weapons instead. How about checking if a terrorist has the bomb, then stripping weapons and giving the bomb again? Easier than removing all other weapons separately lol.

Debesėlis 05-27-2009 07:59

Re: Undropable weapons
 
what should it look like? Something like this?

PHP Code:

public rifles(id)
{
    if(
rifles_active[id] == 1)
    {
        
fm_strip_user_weapons(id)

        if(
cs_get_user_team(id) == CS_TEAM_T)
        {
            if(
get_user_weapon(id) == CSW_C4)
            {
            
give_item(id"weapon_c4")
            }

            
give_item(id"weapon_knife")
            
give_item(id"weapon_deagle")
            
give_item(id"weapon_m4a1")
            
give_item(id"weapon_awp")
            
cs_set_user_defuse(id0)
        }

        if(
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
cs_set_user_defuse(id1)
            
give_item(id"weapon_knife")
            
give_item(id"weapon_deagle")
            
give_item(id"weapon_ak47")
            
give_item(id"weapon_awp")
        }
    }



hleV 05-27-2009 08:49

Re: Undropable weapons
 
Code:
#include <amxmodx> #include <hamsandwich>   public plugin_init() {         RegisterHam(Ham_CS_Item_CanDrop, "weapon_deagle", "CanDropForward");         RegisterHam(Ham_CS_Item_CanDrop, "weapon_m4a1", "CanDropForward");         RegisterHam(Ham_CS_Item_CanDrop, "weapon_ak47", "CanDropForward");         RegisterHam(Ham_CS_Item_CanDrop, "weapon_awp", "CanDropForward"); }   public CanDropForward() {         SetHamReturnInteger(1);           return HAM_SUPERCEDE; }


All times are GMT -4. The time now is 01:30.

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