Raised This Month: $ Target: $400
 0% 

Checking


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-05-2010 , 10:57   Checking
Reply With Quote #1

How can I check if a user has a weapon other than a deagle?

I thought about..

PHP Code:
if( get_user_weapon(id) != CSW_DEAGLE )
{
     
//EXECUTE IF USER HAS A WEAPON OTHER THAN A DEAGLE

__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
Old 08-05-2010, 11:08
NiHiLaNTh
This message has been deleted by NiHiLaNTh. Reason: dumb question
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-05-2010 , 11:12   Re: Checking
Reply With Quote #3

Quote:
Originally Posted by NiHiLaNTh View Post
You mean if there any weapons in players inventory, except Deagle ?
Nah, what their holding.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 08-05-2010 , 11:52   Re: Checking
Reply With Quote #4

Check it in curweapon, like you did above,
Or use Ham_Item_Deploy. Not sure which is the best.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-05-2010 , 11:55   Re: Checking
Reply With Quote #5

Quote:
Originally Posted by drekes View Post
Check it in curweapon, like you did above,
Or use Ham_Item_Deploy. Not sure which is the best.
Yes, I used curweapon.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 08-05-2010 , 15:18   Re: Checking
Reply With Quote #6

tested and working:
PHP Code:
#include <amxmodx>

#pragma semicolon 1

public plugin_init()
    
register_event("CurWeapon""Event_CurWeapon""be");
    
public 
Event_CurWeapon(id)
{
    new 
IsActive read_data(1);
    new 
wpn read_data(2);
    
    if(
IsActive && wpn == CSW_DEAGLE)
        
client_print(idprint_chat"Holding deagle");

You can edit the stuff you want from here.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 08-05-2010 , 17:02   Re: Checking
Reply With Quote #7

Your first method would work just fine.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-05-2010 , 19:08   Re: Checking
Reply With Quote #8

How would I use get_user_weapons to retrieve more than one weapon.

I want to use this:

PHP Code:
if( gToss == true && get_user_weapon(id) != CSW_DEAGLE )
{
    
strip_user_weapons(id)
    
give_itemid"weapon_deagle" )
    
cs_set_weapon_ammoid)
    
cs_set_user_bpammoidCSW_DEAGLE)


But I want it to execute those commands if they player has a weapon other than a Deagle AND a Knife, not just a deagle.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 08-05-2010 , 20:16   Re: Checking
Reply With Quote #9

Check for that in drekes example too?
__________________
Hi.
Kreation is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-05-2010 , 21:04   Re: Checking
Reply With Quote #10

#define CSW_DEAGLE 26

So :

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>

#define VERSION "0.0.1"

public plugin_init()
{
    
register_plugin("Check Deagle"VERSION"ConnorMcLeod")

    
register_event("CurWeapon""Event_CurWeapon_NotDeagle""be""1=1""2!26")
}

public 
Event_CurWeapon_NotDeagle(id)
{
    
// id is alive and is holding another weapon than deagle
    
strip_user_weapons(id)
    new 
iDeagle give_item(id"weapon_deagle")
    
cs_set_weapon_ammo(iDeagle0)
    
cs_set_user_bpammo(idCSW_DEAGLE0)

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-05-2010 at 21:06.
ConnorMcLeod 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 00:08.


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