Raised This Month: $ Target: $400
 0% 

detect weapon and run commands


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
razieljohn619
Senior Member
Join Date: May 2011
Location: Philippines
Old 06-19-2011 , 19:33   Re: detect weapon and run commands
Reply With Quote #1

i already know that where should i place it??

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>

#define PLUGIN "M249"
#define VERSION "1.0"
#define AUTHOR "razieljohn619"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_Spawn"player""FwdPlayerSpawnPost"); 
   
        
}


public 
hasWeapon(idweapid){
    new 
weapons[32], wnum
    get_user_weapons
(idweaponswnum)
    for(new 
0wnumi++){
        if(
weapons[i] == weapid) return 1
    
}
    return 
0
    
}    

public 
FwdPlayerSpawnPostiPlayer )
{
    if( 
is_user_aliveiPlayer ) )
    {
        if( 
cs_get_user_shield ))
        {
            
set_task(0.1"//player has")
        }
        else
        {
            
set_task(0.1"//player does not have")
        }
    }
        
}

public 
//player has(id)
{
    
//commands
    
}

public 
//player does not have(id)
{
    
//commands 

should it be like that??
__________________

razieljohn619 is offline
Send a message via Yahoo to razieljohn619
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-20-2011 , 08:13   Re: detect weapon and run commands
Reply With Quote #2

These questions can be answered by just testing yourself.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
razieljohn619
Senior Member
Join Date: May 2011
Location: Philippines
Old 06-22-2011 , 05:46   Re: detect weapon and run commands
Reply With Quote #3

and how about detecting players weapon,. i mean like multiple weapons (like MP5,M249,Awp,AK, etc..) and run commands if player has one of them ..pls..

THANKS
__________________

razieljohn619 is offline
Send a message via Yahoo to razieljohn619
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-22-2011 , 10:32   Re: detect weapon and run commands
Reply With Quote #4

Use user_has_weapon() for all of those weapons.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 23:26.


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