Raised This Month: $12 Target: $400
 3% 

ham_give_weapon and ham_strip_weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Fredd
Veteran Member
Join Date: Jul 2007
Old 08-15-2007 , 07:10   Re: ham_give_weapon and ham_strip_weapon
Reply With Quote #21

thx
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!
Fredd is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 08-15-2007 , 13:27   Re: ham_give_weapon and ham_strip_weapon
Reply With Quote #22

AMXX already has a get_weaponname native.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-15-2007 , 14:56   Re: ham_give_weapon and ham_strip_weapon
Reply With Quote #23

Quote:
Originally Posted by XxAvalanchexX View Post
AMXX already has a get_weaponname native.
You'r right!
Alka is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-05-2008 , 15:24   Re: ham_give_weapon and ham_strip_weapon
Reply With Quote #24

A small update to these functions: I made them more 1.80 friendly (when I originally made them, I was using 1.76 + ham), and made ham_strip_weapon standalone (no longer requires fm_find_ent_by_owner).
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 04-05-2008 , 18:05   Re: ham_give_weapon and ham_strip_weapon
Reply With Quote #25

AttachToPlayer isn't return any result so i assume that the kill flag will be always set.

EDIT:

Also forgot to mention about a typo. "&" should be "|" instead. But i see that you noticed it too and already fixed.

Last edited by VEN; 04-05-2008 at 18:55.
VEN is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-05-2008 , 18:20   Re: ham_give_weapon and ham_strip_weapon
Reply With Quote #26

Thanks, fixed.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
MeRcyLeZZ
Veteran Member
Join Date: Dec 2007
Old 04-05-2008 , 20:57   Re: ham_give_weapon and ham_strip_weapon
Reply With Quote #27

Nice, I've gotta try this later...
__________________
MeRcyLeZZ is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 05-28-2008 , 07:47   Re: ham_give_weapon and ham_strip_weapon
Reply With Quote #28

Nice
__________________

anakin_cstrike is offline
dstopgunner
Senior Member
Join Date: Oct 2007
Old 06-05-2008 , 07:49   Re: ham_give_weapon and ham_strip_weapon
Reply With Quote #29

To everybody Out There ! How do I use this code? In the plugin or use it as another include?
Im trying to strip everybody's knife at round start how do i do that?

I tried to write a plugin myself it doesnt work

PHP Code:
 
public plugin_init() {
register_plugin(Knife round start remover1.0DS_ToP_GunNeR
register_event("HLTV""event_new_round""a""1=0""2=0")
}
 
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));
return 
1;
}
 
public 
event_new_round(id) { 
if(
user_has_weapon(idCSW_KNIFE))
{
ham_strip_weapon(id"weapon_knife"); 
}

And weridly when I post php it doesnt leave a gap ..
dstopgunner is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-05-2008 , 07:53   Re: ham_give_weapon and ham_strip_weapon
Reply With Quote #30

HLTV is a global event. You can't pass the player's id like that. You have to loop over all players.
__________________
Arkshine is offline
Reply


Thread Tools
Display Modes

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 05:53.


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