Raised This Month: $ Target: $400
 0% 

detect weapon and run commands


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
razieljohn619
Senior Member
Join Date: May 2011
Location: Philippines
Old 06-18-2011 , 22:32   detect weapon and run commands
Reply With Quote #1

hey guys i'm having problem with this.. i want to detect the weapons of players if it has this specific weapon (example M249) and if that player has that weapon this commands will run but only on that player that has that specific weapon..and it checks that weapon after each player spawn, because my server gives weapons auto when respawn and also has resapwn, ..thanks

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)
    
    
set_task(5.0"hasWeapon");
        
}


public 
hasWeapon(idweapid){
    new 
weapons[32], wnum
    get_user_weapons
(idweaponswnum)
    for(new 
0wnumi++){
        if(
weapons[i] == weapid) return 1
    
}
    return 
0
    
}
    if(
user_has_weapon(idCSW_M249)){
            
entity_set_int(weaponEV_INT_iuser41)
       
set_task(0.01"//commands..")
        {
        else 
        }
            
set_task(0.01"//commands2..")
    
        
}

public 
//commands..(id)
{

//commands..
    
}

public 
//commands2..(id)
{

//commands..


and also if player does not have that weapon the commands2 will run only on that player but if it has,. the commands.. will run on that player..hope you guys understand. i'm really hoping that this will work

and the errors are:
Code:
invalid declaration or something
unmatched closing brace
__________________


Last edited by razieljohn619; 06-18-2011 at 22:34.
razieljohn619 is offline
Send a message via Yahoo to razieljohn619
 


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


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