Raised This Month: $ Target: $400
 0% 

Hooking bots hurt


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 10-24-2009 , 21:21   Re: Hooking bots hurt
Reply With Quote #7

Quote:
Originally Posted by Arkshine View Post
Just tried to supercede the forward, and bots are not hurt... It works fine.

.....what the hell... mine didnt work using this code.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
new g_Switchbtdmg_multi;
public 
plugin_init()
{
 
register_plugin("Survivor Mod""1.0""=(GrG)=")
 
 
RegisterHam(Ham_Spawn"player""PlayerSpawn"1)
 
 
RegisterHam(Ham_TakeDamage"player""PlayerHurt"0)
 
 
g_Switch register_cvar("Bones_On""1"//Turns plugin on and off
 
 
bt register_cvar("Bones_team""2"// 2 CT bones 1 T Bones
 
 
dmg_multi register_cvar("dmg_multiplier""2.0")
 
}
public 
PlayerSpawn(id)
{
 new 
team get_pcvar_num(bt)
 
 if(
is_user_alive(id) && get_pcvar_num(g_Switch))
 {
  
cs_set_user_armor(id100CS_ARMOR_VESTHELM)
  switch(
team)
  {
   case 
1:
   {
    
//Humans on T
    
if(cs_get_user_team(id) == CS_TEAM_T)
    {
     
ham_strip_weapon(id"weapon_glock")
     
ham_strip_weapon(id"weapon_knife")
     
ham_give_weapon(id"weapon_knife")
    }
   }
   case 
2:
   {
    
//Humans on CT
    
if(cs_get_user_team(id) == CS_TEAM_CT)
    {
     
ham_strip_weapon(id"weapon_usp")
     
ham_strip_weapon(id"weapon_knife")
     
ham_give_weapon(id"weapon_knife")
    }
   }
  }
  
 }
}
public 
PlayerHurt(idinflictorattackerdamagedamagebits)
{
 if(
is_user_alive(id) && is_user_alive(attacker))
 {
  if(
cs_get_user_team(attacker) == CS_TEAM_CT)
  {
   if(
get_user_weapon(attacker) == CSW_KNIFE)
   {
    
SetHamParamFloat(4damage get_pcvar_float(dmg_multi))
    return 
HAM_SUPERCEDE;
   }
  }
  return 
HAM_IGNORED;
 }
 return 
HAM_IGNORED;
}
 
//*************************[Stocks]*************************
// takes a weapon from a player efficiently
stock ham_strip_weapon(id,weapon[])
{
 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));
 
 
// this block should be used for Counter-Strike:
 
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;
}
// gives a player a weapon efficiently
stock ham_give_weapon(id,weapon[])
{
 if(!
equal(weapon,"weapon_",7)) return 0;
 
 new 
wEnt engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,weapon));
 if(!
pev_valid(wEnt)) return 0;
 
 
set_pev(wEnt,pev_spawnflags,SF_NORESPAWN);
 
dllfunc(DLLFunc_Spawn,wEnt);
 
 if(!
ExecuteHamB(Ham_AddPlayerItem,id,wEnt))
 {
  if(
pev_valid(wEnt)) set_pev(wEnt,pev_flags,pev(wEnt,pev_flags) | FL_KILLME);
  return 
0;
 }
 
 
ExecuteHamB(Ham_Item_AttachToPlayer,wEnt,id)
 return 
1;


Last edited by Doc-Holiday; 10-24-2009 at 21:29.
Doc-Holiday is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:42.


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