下面是引用 lydjjlyd 于 2014-01-22 20:52 发表的 :
那怎么开局只有刀,枪每次重买。
#include <fakemeta>
//每回合移除所有武器,给予小刀...
public plugin_init()
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
public event_round_start() {
for (new id; id<33; id++) {
if(is_user_alive(id)) {
fm_strip_user_weapons(id)
fm_give_item(id, "weapon_knife")
}
}
}
stock fm_strip_user_weapons(id)
{
static ent
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))
if (!pev_valid(ent)) return;
dllfunc(DLLFunc_Spawn, ent)
dllfunc(DLLFunc_Use, ent, id)
if (pev_valid(ent)) engfunc(EngFunc_RemoveEntity, ent)
}
stock fm_give_item(id, const item[])
{
static ent
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
if (!pev_valid(ent)) return;
static Float:originF[3]
pev(id, pev_origin, originF)
set_pev(ent, pev_origin, originF)
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
dllfunc(DLLFunc_Spawn, ent)
static save
save = pev(ent, pev_solid)
dllfunc(DLLFunc_Touch, ent, id)
if (pev(ent, pev_solid) != save)
return;
engfunc(EngFunc_RemoveEntity, ent)
}