Raised This Month: $32 Target: $400
 8% 

Ham_CS_Player_OnTouchingWeapon not exist?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-15-2016 , 03:08   Ham_CS_Player_OnTouchingWeapon not exist?
Reply With Quote #1

Sorry for openning a new topic for this, but that function is registered only in 1.8.3 because web compiler did not found it, and also not on my compiler from my pc wich use 1.8.2, here's the code:

Code:
#include <amxmodx> #include <hamsandwich> #include <cstrike> public plugin_init( ) {     RegisterHam( Ham_CS_Player_OnTouchingWeapon, "player", "Test", 1 ); } public Test( Ent, TouchedId ); {     new WeapnID = cs_get_weapon_id( TouchedId );     new WeaponName[20];     get_weaponname( WeaponId, WeaponName, charsmax( WeaponName ) );     if( is_user_alive( ent ) )     {         client_print( ent, print_chat, "You've just touched %s", WeaponName );     } }


Func prototype:

Code:
/**
     * Description:     Whether or not the player is touching a weapon on the ground.
     * Forward params:  function(this, entityid);
     * Return type:     None.
     * Execute params:  ExecuteHam(Ham_CS_Player_OnTouchingWeapon, this, entityid);
     */
    Ham_CS_Player_OnTouchingWeapon
__________________
Project: Among Us

Last edited by Craxor; 09-15-2016 at 03:09.
Craxor is offline
Send a message via ICQ to Craxor
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-15-2016 , 03:56   Re: Ham_CS_Player_OnTouchingWeapon not exist?
Reply With Quote #2

You're answering yourself, it's available only with 1.8.3+. Web compiler is using the official 1.8.2 version.
__________________
Arkshine is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-15-2016 , 14:25   Re: Ham_CS_Player_OnTouchingWeapon not exist?
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
You're answering yourself, it's available only with 1.8.3+. Web compiler is using the official 1.8.2 version.
Aaaa, yea i was thinking maybe i'm wrong, anyway, thanks .
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-15-2016 , 14:47   Re: Ham_CS_Player_OnTouchingWeapon not exist?
Reply With Quote #4

Try with
PHP Code:
#if AMXX_VERSION_NUM < 183
const Ham:Ham_CS_Player_OnTouchingWeapon Ham_Weapon_PrimaryAttack;
#endif 
Then use it as you normally would.

Last edited by klippy; 09-15-2016 at 14:47.
klippy is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-15-2016 , 14:52   Re: Ham_CS_Player_OnTouchingWeapon not exist?
Reply With Quote #5

Quote:
Originally Posted by KliPPy View Post
Try with
PHP Code:
#if AMXX_VERSION_NUM < 183
const Ham:Ham_CS_Player_OnTouchingWeapon Ham_Weapon_PrimaryAttack;
#endif 
Then use it as you normally would.

You just replace OnTouchWeapon with PrimaryAttack if amxx version is less than 183, but weapon primaryattack dont have another dutties?

Code:
	/**
	 * Description:		Called when the main attack of a weapon is triggered.
	 * Forward params:	function(this)
	 * Return type:		None.
	 * Execute params:	ExecuteHam(Ham_Weapon_PrimaryAttack, this);
	 */
	Ham_Weapon_PrimaryAttack
And OnTouchWeapons is called when you touch an weapon from the ground
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-15-2016 , 15:32   Re: Ham_CS_Player_OnTouchingWeapon not exist?
Reply With Quote #6

That's not how it works, just try it. What is PrimaryAttack to a weapon isn't PrimaryAttack to a player. ;)

Last edited by klippy; 09-15-2016 at 15:52.
klippy is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-16-2016 , 05:43   Re: Ham_CS_Player_OnTouchingWeapon not exist?
Reply With Quote #7

Quote:
Originally Posted by KliPPy View Post
That's not how it works, just try it. What is PrimaryAttack to a weapon isn't PrimaryAttack to a player. ;)
Can you give my an example by editing the follow plugin when touch a weapon from the ground print the Test message, the folowing code print a message when you shot with m4a1, but nothing printed when you just touch it:

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

public plugin_init( )
{
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_m4a1""Test" );
}

// ID is the entitty ID of the weapon.
public Testid )
{
    new 
OwnerId pevidpev_owner );

    if( !
pev_validid ) || !pev_validOwnerId ) )
        return 
HAM_HANDLED;


    
client_printOwnerIdprint_chat" *** Test *** " );
    return 
HAM_IGNORED;

__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
Old 09-16-2016, 06:08
NiHiLaNTh
This message has been deleted by NiHiLaNTh. Reason: stupid
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-16-2016 , 06:18   Re: Ham_CS_Player_OnTouchingWeapon not exist?
Reply With Quote #8

Nice code Nihiliath, working perfect( server crash ) and is normal

Code:
 * Execute params:	ExecuteHam(Ham_Weapon_PrimaryAttack, this);
Where the fucking hell do you see it has 2 params ?

Ent - is the player classname, and the id NOT EXIST because it has not this param so server is waiting for Server crash.
__________________
Project: Among Us

Last edited by Craxor; 09-16-2016 at 06:18.
Craxor is offline
Send a message via ICQ to Craxor
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-16-2016 , 07:22   Re: Ham_CS_Player_OnTouchingWeapon not exist?
Reply With Quote #9

Use your original code and put the following code somewhere near the top:
PHP Code:
#if AMXX_VERSION_NUM < 183
const Ham:Ham_CS_Player_OnTouchingWeapon Ham_Weapon_PrimaryAttack;
#endif 
this should allow you to use it in lower versions than 1.8.3. Just try it, don't question how it works amd what I did there. If it works I'll explain it to you.

Last edited by klippy; 09-16-2016 at 07:22.
klippy is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-16-2016 , 07:32   Re: Ham_CS_Player_OnTouchingWeapon not exist?
Reply With Quote #10

Quote:
Originally Posted by KliPPy View Post
Use your original code and put the following code somewhere near the top:
PHP Code:
#if AMXX_VERSION_NUM < 183
const Ham:Ham_CS_Player_OnTouchingWeapon Ham_Weapon_PrimaryAttack;
#endif 
this should allow you to use it in lower versions than 1.8.3. Just try it, don't question how it works amd what I did there. If it works I'll explain it to you.

Don't works, i repaired all the errors and works compile , i install it and server crash imediatly i shot with an weapon and nothing happen when i touch one, here you go :

Spoiler


That's because Ham_Weapon_PrimaryAttack don't have 2 params like OnTouchingWeapons, replacing it's one just with a simple const var will be hell.
__________________
Project: Among Us

Last edited by Craxor; 09-16-2016 at 07:46.
Craxor is offline
Send a message via ICQ to Craxor
Reply



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 23:39.


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