#include <amxmodx> #include <amxmisc> #define PLUGIN "CheckHaveAK47" #define VERSION "1.0" #define AUTHOR "SONIC" public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd( "ishaveak","IsHaveAk"); } public IsHaveAk(id) { if(user_has_weapon(id, CSW_AK47)) { // 有的话显示"I have AK47 :D <图右> client_print(id, print_chat, "I have AK47 :D"); } else { // 没有的话显示"I haven't AK47 :( <图左> client_print(id, print_chat, "I haven't AK47 :("); } }
if (pev(id, pev_weapons) & PRIMARY_WEAPONS_BIT_SUM)
for (new i = 1; i <= CSW_P90; i++) if (1<<i & PRIMARY_WEAPONS_BIT_SUM) { if (user_has_weapon(id, i)) { ...... } }