AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Strip current wpn (https://forums.alliedmods.net/showthread.php?t=86005)

Dr.G 02-19-2009 09:01

Strip current wpn
 
how do i strip the current wpn of a player? Ive tryed this but it didnt do anything:

PHP Code:

new clipammowpn get_user_weapon(idclipammo
  new 
ent_class[32]
  
get_weaponname(wpnent_classsizeof ent_class 1)
 
ham_strip_weapon(ident_class


PHP Code:

// By XxAvalanchexX
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;


Its cuz iam makein a throwing knifes mod for DoD, and in DoD there are 3 diffent knifes with 3 diffent classnames...

Arkshine 02-19-2009 09:11

Re: Strip current wpn
 
Try get_user_weapon() + xmod_get_wpnname() + ham_strip_weapon()

Dr.G 02-19-2009 09:25

Re: Strip current wpn
 
no cigar, if i got it right :) thanks anyway

PHP Code:

new clipammowpn get_user_weapon(idclipammo
  new 
ent_class[32]
  
xmod_get_wpnname wpnent_classsizeof ent_class 1)
 
ham_strip_weapon(ident_class


Arkshine 02-19-2009 09:42

Re: Strip current wpn
 
It doesn't work ?

Dr.G 02-19-2009 09:45

Re: Strip current wpn
 
nope

ConnorMcLeod 02-19-2009 11:44

Re: Strip current wpn
 
Try to print or log the weaponname before you execute ham_strip_weapon and show the result.

Dr.G 02-19-2009 12:16

Re: Strip current wpn
 
why the hell didnt i think of that lol
PHP Code:

 
new clipammowpn get_user_weapon(idclipammo
  new 
ent_class[32]
  
xmod_get_wpnname(wpnent_classsizeof ent_class 1
  
client_print(idprint_console,"ent_class is ^"%s^""ent_class)
 
  
ham_strip_weapon(ident_class

Quote:

ent_class is "knife"
so thats why, the ham stock by ava want it to contain weapon_ for it to go on. so i guess ill have to modify that stock

xPaw 02-19-2009 12:22

Re: Strip current wpn
 
PHP Code:

new szFormat[99];
format(szFormat98"weapon_%s"ent_class);

ham_strip_weapon(idszFormat); 

try this :]

Dr.G 02-19-2009 12:39

Re: Strip current wpn
 
haha yea xPaw thx... but it doesnt work thats odd, guess that ham stock doesnt like DoD

ConnorMcLeod 02-19-2009 12:41

Re: Strip current wpn
 
Use get_weaponname and see what the name is.


All times are GMT -4. The time now is 16:58.

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