AlliedModders

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

sooN 07-03-2009 22:00

Weapon
 
Hello,

I need plugin when the terrorist walk on weapon he can't pick this weapon.

Thanks

vato loco [GE-S] 07-04-2009 02:10

Re: Weapon
 
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>
#include <fakemeta>

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_Touch"fw_WeaponTouch")
}

public 
fw_WeaponTouch(iEntid)
{
    if (
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T)
    {
        new 
ClName[32]
        
pev(iEntpev_classnameClName31)
        
        if (
equal(ClName"weaponbox") || equal(ClName"armoury_entity") || equal(ClName"grenade"))
            return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED



ConnorMcLeod 07-04-2009 02:19

Re: Weapon
 
Better to use engine, and ground nades are weaponbox entities.

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <engine>

#define VERSION "0.0.1"

public plugin_init()
{
    
register_plugin("No Weapon Pick Up"VERSION"ConnorMcLeod")

    
g_pCvarTeamPickUp register_cvar("amx_no_weapon_pickup""1"//0:disabled, 1:Ts, 2:CTs, 3:ALL

    
register_touch("weaponbox""player""WeaponTouch")
    
register_touch("armoury_entity""player""WeaponTouch")
}

public 
WeaponTouch(iEntid)
{
    if( 
_:cs_get_user_team(id) & get_pcvar_num(g_pCvarTeamPickUp) )
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE



Alka 07-04-2009 03:53

Re: Weapon
 
Or Ham

Arkshine 07-04-2009 03:59

Re: Weapon
 
Not really, using engine with register_touch, it avoids extra checks.


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

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