AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Disable weapon pick up (https://forums.alliedmods.net/showthread.php?t=210089)

Podarok 03-06-2013 06:23

Disable weapon pick up
 
How can i disable picking up, having and buying weapons for ONE person? So the only weapon is knife.

wangbochiang 03-06-2013 08:57

Re: Disable weapon pick up
 
https://forums.alliedmods.net/showthread.php?t=86089

try this if it helps

Podarok 03-07-2013 00:59

Re: Disable weapon pick up
 
Didnt help. Anything more please?

Torge 03-07-2013 17:14

Re: Disable weapon pick up
 
Quote:

Originally Posted by Podarok (Post 1908161)
Didnt help. Anything more please?

It does, you can also search through the forum. Sure you'll get a answer.

wangbochiang 03-08-2013 00:18

Re: Disable weapon pick up
 
I think fakemeta have this function,
you should check other Zombie/HnS plugins code.

check the zombie/runner part.

Kard1nal 03-08-2013 01:56

Re: Disable weapon pick up
 
Try this to disable pick-up weapons.
Code:
#include <amxmodx> #include <hamsandwich> public plugin_init() {     RegisterHam(Ham_Touch, "weapon_hegrenade", "player_touchweapon")     RegisterHam(Ham_Touch, "weaponbox", "player_touchweapon")     RegisterHam(Ham_Touch, "armoury_entity", "player_touchweapon") } public player_touchweapon(id, ent) return HAM_SUPERCEDE

Podarok 03-08-2013 04:05

Re: Disable weapon pick up
 
Need to disable it only for one particular person, not for all.

PHP Code:

public player_touchweapon(ident
if(
native_to_check_hero(id))
return 
HAM_SUPERCEDE 

Will this work?

Kard1nal 03-08-2013 08:15

Re: Disable weapon pick up
 
Only if you got this function (native_to_check_hero(id)) in this plugin and it returns true.

Natives makes in another way, you should search about them.

Edit: and if you want to add IF in ham function, you should do like this to prevent errors:
Code:
public player_touchweapon(id, ent) { if(somefunc(someparam)) return HAM_SUPERCEDE return HAM_IGNORED //Return this when you don't want to block picking-up }

Podarok 03-08-2013 08:53

Re: Disable weapon pick up
 
[en] I know how to make natives and i do have them. But didnt know that i have to return HAM_IGNORED, ty ill try it today.
[ru] Спасибо, незнал что нужно хам игнор возвращать... =]

NiHiLaNTh 03-08-2013 12:58

Re: Disable weapon pick up
 
Code above blocks only touch. To block
Quote:

Originally Posted by Podarok
having and buying

you also need
Code:

RegisterHam(Ham_AddPlayerItem, "player", "fw_AddPlayerItem");
....

public fw_AddPlayerItem(id, ent)
{
      if (your_variable[id] && cs_get_weapon_id(ent) != CSW_KNIFE)
              return HAM_SUPERCEDE;
 
      return HAM_IGNORED;
}



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

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