Raised This Month: $ Target: $400
 0% 

Ham_AddPlayerItem problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 11-11-2012 , 19:38   Ham_AddPlayerItem problem
Reply With Quote #1

PHP Code:
RegisterHamHam_AddPlayerItem"player""FwdAddItem" );

public 
FwdAddItemiPlayerIDiWeaponID ) {
    if( 
iWeaponID != 29 ) {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;

I am using this so when a player is given a weapon other then knife, block it.
What is happening is the player is not getting weapons but the knife is not showing as well. It is like he getting stripped
any help?
__________________

Last edited by n0br41ner; 11-11-2012 at 19:39.
n0br41ner is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 11-11-2012 , 19:50   Re: Ham_AddPlayerItem problem
Reply With Quote #2

iWeaponID is an entity.

Try to do this check:

PHP Code:
static classname24 ];
peviWeaponIDpev_classnameclassnamecharsmaxclassname ) );

if( 
equaliclassname"Weapon_Knife" ) ) {
  
// is a knife

__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 11-11-2012 , 20:20   Re: Ham_AddPlayerItem problem
Reply With Quote #3

I am getting argument type mismatch (argument 1)
PHP Code:
public Ham_AddPlayerItemsiPlayerIDiWeaponID ) {
    static 
strClassName64 ];
    
peviWeaponIDpev_classnamestrClassName63 );
    
    if( !
equaliWeaponID"weapon_knife" ) ) {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;

__________________

Last edited by n0br41ner; 11-11-2012 at 20:22.
n0br41ner is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 11-11-2012 , 20:26   Re: Ham_AddPlayerItem problem
Reply With Quote #4

Don't compare an integer value ( iWeaponID ) with a string ( "weapon_knife" ).
Function equal requires two strings as parameters.

Compare ( strClassName ) with ( "weapon_knife" ). The 64 cells size for the string is too large, aren't 32 cells enough?
__________________

Last edited by claudiuhks; 11-11-2012 at 20:50.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 11-11-2012 , 20:27   Re: Ham_AddPlayerItem problem
Reply With Quote #5

OMG what an idiot i am, failed to notice that...
Excuse me for my silliness

EDIT: awesome, worked perfectly
__________________

Last edited by n0br41ner; 11-11-2012 at 20:28.
n0br41ner is offline
Old 11-11-2012, 20:41
n0br41ner
This message has been deleted by n0br41ner. Reason: nvm
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-12-2012 , 00:46   Re: Ham_AddPlayerItem problem
Reply With Quote #6

You can also you cs_get_weapon_id( iWeaponID )
or get_pdata_int(iWeaponID, m_iId, 4)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 11-12-2012 , 10:09   Re: Ham_AddPlayerItem problem
Reply With Quote #7

Thank you again
__________________
n0br41ner is offline
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 01:06.


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