|
楼主 |
发表于 2009-3-1 04:11:55
|
显示全部楼层
来自 日本–东京都–千代田区
后续代码为
public eventDeathMsg()
{
new killer = read_data(1)
new victim = read_data(2)
if(killer == 0 && get_user_team(victim) == 1)
{
new lucky = GetRandomCT();
cs_set_user_team(lucky, 1)
client_print(lucky, print_chat, "[HNS] An idiot jumped off and you were lucky and got transfered to Terrorist.")
cs_set_user_team(victim, 2);
GiveItems(lucky)
SetStealth(lucky)
}
else if(killer == victim)
{
set_task(get_pcvar_float(g_CvarRespawnDelay), "RespawnPlayer", victim)
return PLUGIN_HANDLED;
}
else if(get_user_team(killer) == 2)
{
cs_set_user_team(killer, 1);
cs_set_user_team(victim, 2);
GiveItems(killer)
SetStealth(killer)
}
set_task(get_pcvar_float(g_CvarRespawnDelay), "RespawnPlayer", victim)
return PLUGIN_CONTINUE;
}
public eventPlayerSpawn(id)
{
if(is_user_alive(id)) GiveItems(id);
}
public RespawnPlayer(id)
{
if(!is_user_alive(id)) ExecuteHam(Ham_CS_RoundRespawn, id);
}
public fwdCmdStart(id, handle, seed)
{
if(!get_pcvar_num(g_CvarStabOnly) || !is_user_alive(id) || get_user_team(id) != 2) return FMRES_IGNORED;
static clip, ammo;
if(get_user_weapon(id, clip, ammo) != CSW_KNIFE) return FMRES_IGNORED;
static button;
button = get_uc(handle, UC_Buttons);
if(button & IN_ATTACK) button = (button & ~IN_ATTACK) | IN_ATTACK2;
set_uc(handle, UC_Buttons, button);
return FMRES_SUPERCEDE;
}
public fwdPlayerPostThink(id)
{
if(!g_Joined[id])
{
if(0 < get_user_team(id) < 3 && !is_user_alive(id))
{
set_task(1.0, "RespawnPlayer", id)
g_Joined[id] = true;
}
}
}
public fwdClientKill(id) return FMRES_SUPERCEDE;
public fwdSpawn(ent)
{
if(!pev_valid(ent)) return FMRES_IGNORED;
new class[32];
pev(ent, pev_classname, class, 31);
for(new i = 0; i < sizeof(g_EntityClassNames); i++)
{
if(equal(class, g_EntityClassNames))
{
engfunc(EngFunc_RemoveEntity, ent);
return FMRES_SUPERCEDE;
}
}
return FMRES_IGNORED;
}
public fwdGetGameDescription()
{
new gamename[32];
get_pcvar_string(g_CvarGameName, gamename, 31)
forward_return(FMV_STRING, gamename)
return FMRES_SUPERCEDE;
}
public msgScreenFade(msgid, dest, id)
{
if(is_user_alive(id) && get_pcvar_num(g_CvarNoFlash) == get_user_team(id))
{
static data[4];
data[0] = get_msg_arg_int(4);
data[1] = get_msg_arg_int(5)
data[2] = get_msg_arg_int(6);
data[3] = get_msg_arg_int(7)
if(data[0] == 255 && data[1] == 255 && data[2] == 255 && data[3] > 199) return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public client_command(id)
{
new sArg[13];
if(read_argv(0, sArg, 12) > 11) return PLUGIN_CONTINUE;
for(new i = 0; i < sizeof(g_BuyCommands); i++)
{
if(equali(g_BuyCommands, sArg, 0)) return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public HandleBlock(id) return PLUGIN_HANDLED;
public UnsetStealth(id) fm_set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 255);
SetStealth(id)
{
if(get_user_health(id) != 100)
fm_set_user_health(id, 100)
fm_set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransColor, 0);
set_task(get_pcvar_float(g_CvarProtectionTime), "UnsetStealth", id)
}
GiveItems(id)
{
cs_reset_user_model(id)
fm_strip_user_weapons(id)
switch(get_user_team(id))
{
case 1:
{
if(get_pcvar_num(g_CvarHidersFlashbangs))
{
fm_give_item(id, "weapon_flashbang")
cs_set_user_bpammo(id, CSW_FLASHBANG, get_pcvar_num(g_CvarHidersFlashbangs))
}
if(get_pcvar_num(g_CvarHidersSmokegrenade))
fm_give_item(id, "weapon_smokegrenade")
if(get_pcvar_num(g_CvarHidersHegrenade))
fm_give_item(id, "weapon_hegrenade")
}
case 2:
{
fm_give_item(id, "weapon_knife")
if(get_pcvar_num(g_CvarSeekersFlashbangs))
{
fm_give_item(id, "weapon_flashbang")
cs_set_user_bpammo(id, CSW_FLASHBANG, get_pcvar_num(g_CvarSeekersFlashbangs))
}
if(get_pcvar_num(g_CvarSeekersSmokegrenade))
fm_give_item(id, "weapon_smokegrenade")
if(get_pcvar_num(g_CvarSeekersHegrenade))
fm_give_item(id, "weapon_hegrenade")
}
}
}
GetRandomCT()
{
static iPlayers[32], iCT_num;
get_players(iPlayers, iCT_num, "ae", "CT");
if(!iCT_num)
return 0;
return iCT_num > 1 ? iPlayers[random(iCT_num)] : iPlayers[iCT_num - 1];
}
stock fm_set_user_godmode(index, godmode = 0)
{
set_pev(index, pev_takedamage, godmode == 1 ? DAMAGE_NO : DAMAGE_AIM)
return 1
}
stock fm_set_user_rendering(index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
{
return fm_set_rendering(index, fx, r, g, b, render, amount)
}
stock fm_strip_user_weapons(index)
{
new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))
if (!pev_valid(ent))
return 0
dllfunc(DLLFunc_Spawn, ent)
dllfunc(DLLFunc_Use, ent, index)
engfunc(EngFunc_RemoveEntity, ent)
return 1
}
stock fm_give_item(index, const item[])
{
if (!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
return 0
new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item))
if (!pev_valid(ent))
return 0
new Float:origin[3]
pev(index, pev_origin, origin)
set_pev(ent, pev_origin, origin)
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN)
dllfunc(DLLFunc_Spawn, ent)
new save = pev(ent, pev_solid)
dllfunc(DLLFunc_Touch, ent, index)
if (pev(ent, pev_solid) != save)
return ent
engfunc(EngFunc_RemoveEntity, ent)
return -1
}
stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
{
new Float:RenderColor[3]
RenderColor[0] = float(r)
RenderColor[1] = float(g)
RenderColor[2] = float(b)
set_pev(entity, pev_renderfx, fx)
set_pev(entity, pev_rendercolor, RenderColor)
set_pev(entity, pev_rendermode, render)
set_pev(entity, pev_renderamt, float(amount))
return 1
}
stock fm_set_user_health(index, health)
{
health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index)
return 1
} |
|