AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   5 items i need to know (https://forums.alliedmods.net/showthread.php?t=93906)

rjckE 06-04-2009 04:38

5 items i need to know
 
Hi guys, i need to read about this things:

- Block buy for players.
- Weapons strip.
- Block attack with knife (or something like godmode to all when attacking with knife)
- Block c4 plant.
and the most important:
- I need some code where, if a user drops c4 and no-one picks up, the c4 comes back to the users.

Where can i read about the first 4 and who can help me with the last one?

Thanks for your replies ;)

hleV 06-04-2009 04:55

Re: 5 items i need to know
 
  1. Code:
    #include <amxmodx> #include <hamsandwich>   new g_iBuyZoneEntSpawn;   public plugin_precache()         g_iBuyZoneEntSpawn = RegisterHam(Ham_Spawn, "func_buyzone", "fwdBuyZoneEntSpawn");   public plugin_init()         DisableHamForward(g_iBuyZoneEntSpawn);   public fwdBuyZoneEntSpawn(iEnt)         return pev_valid(iEnt) ? HAM_SUPERCEDE : HAM_IGNORED;
  2. Code:
    #include <amxmodx> #include <fun> #include <hamsandwich>   #define OFFSET_PRIMARYWEAPON 116   public plugin_init()         RegisterHam(Ham_Spawn, "player", "fwdPlayerSpawn", 1);   public fwdPlayerSpawn(iCl)         if (is_user_alive(iCl))         {                 strip_user_weapons(iCl);                 set_pdata_int(iCl, OFFSET_PRIMARYWEAPON, 0);                 give_item(iCl, "weapon_knife"); // Remove this if you don't want knife         }
  3. Code:
    #include <amxmodx> #include <fakemeta>   public plugin_init()         register_forward(FM_CmdStart, "fwdCmdStart");   public fwdCmdStart(iCl, iHandle) {         if (get_user_weapon(iCl) == CSW_KNIFE)         {                 static iButtons;                 iButtons = get_uc(iHandle, UC_Buttons);                   if (iButtons & IN_ATTACK)                 {                         set_uc(iHandle, UC_Buttons, ~IN_ATTACK);                           return FMRES_SUPERCEDE;                 }                 else if (iButtons & IN_ATTACK2)                 {                         set_uc(iHandle, UC_Buttons, ~IN_ATTACK2);                           return FMRES_SUPERCEDE;                 }         }           return FMRES_IGNORED; }
  4. Code:
    #include <amxmodx> #include <cstrike> #include <hamsandwich>   public plugin_init()         RegisterHam(Ham_Spawn, "player", "fwdPlayerSpawn", 1);   public fwdPlayerSpawn(iCl)         if (is_user_alive(iCl))                 cs_set_user_plant(iCl, 0, 0);

raidmax 06-04-2009 08:05

Re: 5 items i need to know
 
hlev

missing includes in 1st and 2nd plugins

hleV 06-04-2009 08:30

Re: 5 items i need to know
 
Sorry. Add
Code:
#include <fakemeta>
in both 1st & 2nd.

xbatista 06-04-2009 08:34

Re: 5 items i need to know
 
PHP Code:

                if (iButtons IN_ATTACK)
                {
                        
set_uc(iHandleUC_Buttons, ~IN_ATTACK);
 
                        return 
FMRES_SUPERCEDE;
                } 

Buggy thing,blocking attack of knife :/ the problem is with animation, if you could fix it,it will be great :]p

xPaw 06-04-2009 08:38

Re: 5 items i need to know
 
i prefer setting nexttimeattack :p

xbatista 06-04-2009 08:45

Re: 5 items i need to know
 
PHP Code:

#include <amxmodx> 
#include <fakemeta> 
#include <hamsandwich> 

#define PLUGIN "No Knife Attack2" 
#define VERSION "1.0" 
#define AUTHOR "ConnorMcLeod" 

#define    m_flNextSecondaryAttack    47 

public plugin_init() 

    
register_plugin(PLUGINNAMEVERSIONAUTHOR

    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_knife""Knife_SecondaryAttack"


public 
Knife_SecondaryAttackiEnt 

    
set_pdata_float(iEntm_flNextSecondaryAttack20.04
    return 
HAM_SUPERCEDE 


You mean something like this?
This is too buggy

rjckE 06-04-2009 10:56

Re: 5 items i need to know
 
Hey hleV, code 1, 2 and 3 worked perfectly ;)

but code 4 didn't work :(

anyways, thanks a lot man :)

hleV 06-04-2009 14:40

Re: 5 items i need to know
 
You can try using this for blocking players from planting C4.
Code:
#include <amxmodx> #include <hamsandwich>   public plugin_init()         RegisterHam(Ham_Touch, "func_buyzone", "fwdTouchBuyZone");   public fwdTouchBuyZone(iEnt, iCl)         return (pev_valid(iEnt) && 1 <= iCl <= 32) ? HAM_SUPERCEDE : HAM_IGNORED;


All times are GMT -4. The time now is 13:55.

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