AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Bad Touch (https://forums.alliedmods.net/showthread.php?t=209127)

_GamerX 02-21-2013 14:34

Bad Touch
 
Please help, I use a variable to block skimmed off arms but when the variable is 0 so sometimes still do not pick up weapons "armoury_entity" I do not understand why please help.

PHP Code:

RegisterHam(Ham_Touch,"weaponbox","player_touchweapon")
RegisterHam(Ham_Touch,"armoury_entity","player_touchweapon"

PHP Code:

public player_touchweapon(ident)
{
    if(
g_BlockWeapons) return HAM_SUPERCEDE
    
return HAM_IGNORED


EDIT: But when a player takes a gun "weaponbox" and had him pick up a gun goes' armoury_entity "but straight weapon" armoury_entity "not ...

hornet 02-22-2013 07:16

Re: Bad Touch
 
Is it supposed to block all players or individually?

hleV 02-22-2013 07:24

Re: Bad Touch
 
Not exactly sure what the problem is in your case (I'm having a hard time reading what you wrote), but for a certain entity classname touching other certain entity classname, you would probably be better off with Engine.
PHP Code:

register_touch("weaponbox""player""player_touchweapon");
register_touch("armoury_entity""player""player_touchweapon"); 

Also, in the touch callback the first parameter is the touched entity, so id, entent, id. Though you're not required to write them in if you don't use them in inside the callback.
PHP Code:

public player_touchweapon()
{
    return 
g_BlockWeapons PLUGIN_HANDLED PLUGIN_CONTINUE;



ConnorMcLeod 02-22-2013 13:29

Re: Bad Touch
 
Quote:

Originally Posted by _GamerX (Post 1899034)
Please help, I use a variable to block skimmed off arms but when the variable is 0 so sometimes still do not pick up weapons "armoury_entity" I do not understand why please help.

PHP Code:

RegisterHam(Ham_Touch,"weaponbox","player_touchweapon")
RegisterHam(Ham_Touch,"armoury_entity","player_touchweapon"

PHP Code:

public player_touchweapon(ident)
{
    if(
g_BlockWeapons) return HAM_SUPERCEDE
    
return HAM_IGNORED


EDIT: But when a player takes a gun "weaponbox" and had him pick up a gun goes' armoury_entity "but straight weapon" armoury_entity "not ...

This code is ok, problem seems to come from somewhere else.
Also, as stated, this is for a global block feature, not for individual.

Backstabnoob 02-22-2013 13:45

Re: Bad Touch
 
Do you use strip_user_weapons?

_GamerX 02-23-2013 10:14

Re: Bad Touch
 
Quote:

Originally Posted by hleV (Post 1899474)
Not exactly sure what the problem is in your case (I'm having a hard time reading what you wrote), but for a certain entity classname touching other certain entity classname, you would probably be better off with Engine.
PHP Code:

register_touch("weaponbox""player""player_touchweapon");
register_touch("armoury_entity""player""player_touchweapon"); 

Also, in the touch callback the first parameter is the touched entity, so id, entent, id. Though you're not required to write them in if you don't use them in inside the callback.
PHP Code:

public player_touchweapon()
{
    return 
g_BlockWeapons PLUGIN_HANDLED PLUGIN_CONTINUE;



It did not help still sometimes can not take a gun "armoury_entity" when g_BlockWeapons 0

Quote:

Originally Posted by Backstabnoob (Post 1899692)
Do you use strip_user_weapons?

Yes

But it is strange that grenates going to take even if it's armoury_entity normal weapons no ...

hleV 02-23-2013 11:24

Re: Bad Touch
 
[Fix] strip_user_weapons [Cs Specific]

_GamerX 02-23-2013 13:26

Re: Bad Touch
 
Very thanks ! It helped


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

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