Raised This Month: $ Target: $400
 0% 

Getting weapon classname.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 04-06-2009 , 11:25   Getting weapon classname.
Reply With Quote #1

How to get classname something like this?
PHP Code:
if (class == "weapon_glock18"
P.S. Without "equali or equal" ???

PHP Code:
new class[32]
pev(entpev_classname, class, 31

Last edited by xbatista; 04-07-2009 at 04:38.
xbatista is offline
Send a message via Skype™ to xbatista
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-06-2009 , 11:27   Re: Classname.
Reply With Quote #2

Quote:
Originally Posted by xbatista View Post
How to get classname something like this?
PHP Code:
if (class == "weapon_glock18"
P.S. Without "equali or equal" ???

PHP Code:
new class[32]
pev(entpev_classname, class, 31
Why are you trying to avoid equal\equali? You could compare individual characters of the string.

PHP Code:
if ( szClass[7] == 'g' 
__________________

Last edited by Bugsy; 04-06-2009 at 11:29.
Bugsy is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 04-06-2009 , 11:32   Re: Classname.
Reply With Quote #3

Class name will return "weaponbox". You should check the model.
Code:
new szMdl[32]; pev(iEnt, pev_model, szMdl, 31);   if (equal(szMdl, "models/w_glock18.mdl"))         // Your stuff
__________________
hleV is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 04-06-2009 , 11:37   Re: Classname.
Reply With Quote #4

I need something like this:
PHP Code:
if ( class[LEVELS[PlayerLevel[id]]] == WEAPONCONST[PlayerLevel[id]] ) 
        return 
FMRES_IGNORED
if (class[index] == "weapon_name")
xbatista is offline
Send a message via Skype™ to xbatista
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 04-06-2009 , 11:55   Re: Classname.
Reply With Quote #5

Quote:
Originally Posted by hleV View Post
Class name will return "weaponbox". You should check the model.
If the weapon is being used, it will return the specific weapon's classname(weapon_*).
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 04-06-2009 , 12:03   Re: Classname.
Reply With Quote #6

I don't need equal and w_ (models).
It is possible something like this?
if (class[index] == "weapon_name")
or
if (class == "weapon_name")
xbatista is offline
Send a message via Skype™ to xbatista
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 04-07-2009 , 08:30   Re: Classname.
Reply With Quote #7

http://forums.alliedmods.net/showpos...66&postcount=3.
__________________
hleV is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 04-07-2009 , 08:40   Re: Getting weapon classname.
Reply With Quote #8

Yes I know ,using this.
xbatista is offline
Send a message via Skype™ to xbatista
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 04-07-2009 , 10:34   Re: Classname.
Reply With Quote #9

Quote:
Originally Posted by hleV View Post
As both me and Exolent said, it's only true when the weapon is on the ground.

@xbatista: Are you trying to receive the classname of a weapon that a player is holding, or a weapon that is on the ground?
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 04-07-2009 , 10:42   Re: Getting weapon classname.
Reply With Quote #10

PHP Code:
new const WEAPONMDL[MAXLEVEL][] = {"models/w_glock18.mdl""models/w_usp.mdl""models/w_p228""models/w_fiveseven.mdl""models/w_deagle""models/w_elite.mdl""models/w_tmp.mdl"
"models/w_mac10.mdl""models/w_ump45.mdl""models/w_mp5navy.mdl""models/w_p90.mdl""models/w_scout.mdl""models/w_awp.mdl""models/w_famas.mdl""models/w_galil.mdl""models/w_m3.mdl""models/w_xm1014.mdl"
"models/w_ak47.mdl""models/w_m4a1.mdl""models/w_aug.mdl""models/w_sg552.mdl""models/w_sg550.mdl""models/w_g3sg1.mdl""models/w_m249.mdl" 
}; // Blocks picking up weapon

public fwd_Touch(entid)
{
    if (!
is_user_connected(id) || !is_user_alive(id))
        return 
FMRES_IGNORED;
 
    static 
szEntModel[32];
    
pevent pev_model szEntModel 31 );
 
    if ( !
equaliszEntModel WEAPONMDL[PlayerLevel[id]] ) )
    {
        return 
FMRES_SUPERCEDE;
    } 

    return 
FMRES_IGNORED;

All works fine ;)
xbatista is offline
Send a message via Skype™ to xbatista
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 02:25.


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