yesterday00
|
分享:
▲
#include <amxmodx> #include <cstrike> #include <fakemeta> #include <hamsandwich> new g_maxplayers new cvar_botquota
public plugin_init() { RegisterHam(Ham_AddPlayerItem, "player", "fw_AddPlayerItem") RegisterHam(Ham_Touch, "weaponbox", "fw_Touch"); register_forward(FM_SetModel, "fw_SetModel") cvar_botquota = get_cvar_pointer("bot_quota") g_maxplayers = get_maxplayers() }
public client_putinserver(id) { if (is_user_bot(id)) { if (cvar_botquota) set_task(0.1, "register_ham_czbots", id) } }
public fw_AddPlayerItem(id, iWeapon) { if(cs_get_user_team(id) == 1) { new Slot = ExecuteHam(Ham_Item_ItemSlot, iWeapon) if( Slot == 1 || Slot == 2) // 1=主武器, 2= 次武器, 3=刀, 4= 雷, 5= C4 { return HAM_SUPERCEDE } } return HAM_IGNORED }
public fw_Touch(iEnt, id) { if( id < 1 || id > g_maxplayers || !(pev(iEnt, pev_flags) & FL_ONGROUND) || !is_user_alive(id)) return HAM_IGNORED if(cs_get_user_team(id) == 1) return HAM_SUPERCEDE return HAM_IGNORED }
public fw_SetModel(entity, const model[]) { // We don't care if (strlen(model) < 8) return; // Get entity's classname static class[10] pev(entity, pev_classname, class, charsmax(class)) // Check if it's a weapon box if (equal(class, "weaponbox")) { // They get automatically removed when thinking set_pev(entity, pev_nextthink, get_gametime() + 0.01) return; } }
public register_ham_czbots(id) { if(!is_user_connected(id) || !get_pcvar_num(cvar_botquota)) return; RegisterHamFromEntity(Ham_AddPlayerItem, id, "fw_AddPlayerItem") RegisterHamFromEntity(Ham_Touch, id, "fw_Touch") }
//复制到txt,改后缀为sma,另存为UTF-8
[ 此文章被yesterday00在2011-04-03 13:52重新編輯 ]
|