|
Author
|
Message
|
|
Senior Member
Join Date: May 2011
Location: Philippines
|

06-19-2011
, 07:15
Re: detect weapon and run commands
|
#1
|
should it look like this now??
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(PLUGIN, VERSION, AUTHOR) RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawnPost", 1 ); }
public hasWeapon(id, weapid){ new weapons[32], wnum get_user_weapons(id, weapons, wnum) for(new i = 0; i < wnum; i++){ if(weapons[i] == weapid) return 1 } return 0 }
public FwdPlayerSpawnPost( iPlayer ) { if( is_user_alive( iPlayer ) ) { if( user_has_weapon( iPlayer, CSW_M249 ) ) { 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 look like this now, because i'm having many errors on that part of
PHP Code:
RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawnPost", 1 );
can you help me..pls..thanks 
EDIT:
it now works because i included hamsandwich..thanks Exolent 
i dont know if it's working or not..and how about detecting if player has shield and runs commands if has shield or not, just like here
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(PLUGIN, VERSION, AUTHOR) RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawnPost", 1 ); }
public hasWeapon(id, weapid){ new weapons[32], wnum get_user_weapons(id, weapons, wnum) for(new i = 0; i < wnum; i++){ if(weapons[i] == weapid) return 1 } return 0 }
public FwdPlayerSpawnPost( iPlayer ) { if( is_user_alive( iPlayer ) ) { if( user_has_weapon( iPlayer, CSW_M249 ) ) { 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 }
but only detect if has shield..thanks 
__________________
Last edited by razieljohn619; 06-19-2011 at 07:34.
|
|
|
|