Raised This Month: $ Target: $400
 0% 

Touch armoury_entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wwzw
Member
Join Date: Feb 2009
Old 02-07-2012 , 06:08   Touch armoury_entity
Reply With Quote #1

I want to use the Touch armoury_entity to give players more weapons and grenades.
PHP Code:
RegisterHam(Ham_Touch,      "armoury_entity",   "Ham_Touch_entity_Pre",  0);
 
public 
Ham_Touch_entity_Pre(ient,id)
{
 if (
id || id max_player || (!is_user_alive(id)) || ient <= max_player || (!pev_valid(ient))) return HAM_IGNORED;
 static 
wname[64];
 
pev(ient,pev_model,wname,63)
//I would like to get more information:
//Weapon's ID, the number of bullets, the number of bullets in the clip within.
//The number of grenades (some maps a model there are three grenades).
//Body armor values
 

Please help me! Thanks!

Last edited by wwzw; 02-07-2012 at 07:27.
wwzw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-07-2012 , 14:13   Re: Touch armoury_entity
Reply With Quote #2

armoury has always a max weapon clip, it's not like weaponbox.

You can retrieve weapon type using cs_get_armoury_type : http://www.amxmodx.org/funcwiki.php?go=func&id=1226
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
wwzw
Member
Join Date: Feb 2009
Old 02-07-2012 , 21:04   Re: Touch armoury_entity
Reply With Quote #3

cs_get_armoury_type can get the weapon's ID.
Armoury has always a max weapon clip.


Generally to the two cartridges? M3 in fy_iceworld to 24 bullets.
Map inside the grenade a model to the three hand grenades, some maps is one.

Also: If I use engfunc (EngFunc_RemoveEntity, ient).
The next round, these items will not happen again.

Last edited by wwzw; 02-07-2012 at 22:54.
wwzw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-08-2012 , 01:15   Re: Touch armoury_entity
Reply With Quote #4

I think backpackammo is given when you pickup an armoury_entity but no number is stored into the armoury, whatever the map, when you pickup up an m3, same amount of clip and ammo are given.

Don't remove entities, set pev_effect to EF_NODRAW (that's what's happening when you pickup the weapon).
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
wwzw
Member
Join Date: Feb 2009
Old 02-08-2012 , 02:29   Re: Touch armoury_entity
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
I think backpackammo is given when you pickup an armoury_entity but no number is stored into the armoury, whatever the map, when you pickup up an m3, same amount of clip and ammo are given.

Don't remove entities, set pev_effect to EF_NODRAW (that's what's happening when you pickup the weapon).
Thank you very much!
I tested the code is successful:

PHP Code:
public Ham_Touch_entity_Pre(ent,id)
{
 if (
id || id max_player || (!is_user_alive(id)) || ent <= max_player || (!pev_valid(ent)))
  return 
HAM_IGNORED;
 if (
pev(ent,pev_effects) == EF_NODRAW) return HAM_IGNORED;
 new 
wid cs_get_armoury_type(ent);
 
 
//Give player weapon...
 
 
set_pev(ent,pev_effects,EF_NODRAW);
 return 
HAM_SUPERCEDE;
 


Last edited by wwzw; 02-08-2012 at 02:30.
wwzw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-08-2012 , 02:45   Re: Touch armoury_entity
Reply With Quote #6

Btw, ent <= max_player check is not needed, you have registerer the armoury classname.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
wwzw
Member
Join Date: Feb 2009
Old 02-08-2012 , 03:14   Re: Touch armoury_entity
Reply With Quote #7

Oh!I have learned.Thanks again!
wwzw is offline
wwzw
Member
Join Date: Feb 2009
Old 02-08-2012 , 03:41   Re: Touch armoury_entity
Reply With Quote #8

Continue to consult:
These two methods: Which one is better?
register_touch( "armoury_entity" , "player" , "fw_ArmouryTouch" );
RegisterHam(Ham_Touch, "armoury_entity", "Ham_Touch_entity_Pre", 0);
//register_forward(FM_Touch,"FM_Touch_hook") //In this way seems more trouble

About touch weaponbox (From: GHW_Weap_Pickup.sma)
How to find the weapon's id?(Only by model name?)
How to find the weapon's bpammo?


Last edited by wwzw; 02-08-2012 at 06:39.
wwzw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-08-2012 , 10:38   Re: Touch armoury_entity
Reply With Quote #9

In this specific case i think it's the same, i would use ham.

engine way prevents you from checking entity touched in plugin, but as you only check for players, player range check (> 0 and < maxplayers) is enough.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Ef_Deas
Member
Join Date: Aug 2012
Location: Rio de Janeiro
Old 07-25-2014 , 05:52   Re: Touch armoury_entity
Reply With Quote #10

I'm having trouble with setting nodraw effect

PHP Code:
public HAM_Armoury_Touch_Pre(iArmouryidUser)    // The function is called when user touches Armoury entity
{
    if(
is_user_alive(idUser)                                    // User should be alive
    
&& is_valid_ent(iArmoury)                                   // The entity should be valid,         
    
&& engfunc(EngFunc_EntIsOnFlooriArmoury)                  // lying on the ground
    
&& !(entity_get_int(iArmouryEV_INT_effects) & EF_NODRAW)) // and it shouldn't be picked up already
    
{    
        new 
iWeapon cs_get_armoury_type(iArmoury)             // Get the Weapon CSW_ id
        
give_user_weapon(idUseriWeapon)                       // give the weapon (my func)
        
entity_set_int(iArmouryEV_INT_effectsEF_NODRAW);    // Make it disappear until next round
      
        
say("Trace")                                            // Let's see if we got here
    
}

Using this code I pick up weapon with trace message. The armour entity disappears. Then I can throw the weapon away and pick up the original "invisible" weapon again normally, without trace message.
So how do I make it disappear until next round properly?

Last edited by Ef_Deas; 07-25-2014 at 11:00.
Ef_Deas is offline
Send a message via Skype™ to Ef_Deas
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 00:21.


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