攪店了
抄番之前寫過D CODE- -
複製內容到剪貼板
代碼:
#include <sourcemod>
#include <sdktools>
public OnPluginStart()
{
HookEvent("round_start", Event_RoundStart);
}
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
Spawnpills()
}
Spawnpills()
{
new EntCount = GetEntityCount();
new String:EdictName[128];
for (new i = 0; i<=EntCount; i++)
{
if (IsValidEntity(i))
{
GetEdictClassname(i,EdictName,128);
if(StrContains(EdictName, "weapon_pipe_bomb", false) != -1||StrContains(EdictName, "weapon_molotov", false) != -1 ||StrContains(EdictName, "weapon_vomitjar", false) != -1 ||StrContains(EdictName, "weapon_first_aid_kit", false) != -1 ||StrContains(EdictName, "weapon_defibrillator", false) != -1||(StrContains(EdictName, "weapon_upgradepack_explosive", false) != -1) || (StrContains(EdictName, "weapon_upgradepack_incendiary", false) != -1))
{
if(StrContains(EdictName, "weapon_first_aid_kit", false) != -1)
{
new index = CreateEntityByName("weapon_pain_pills_spawn");
new Float:Location[3];
GetEntPropVector(i, Prop_Send, "m_vecOrigin", Location);
if(index != -1)
{
new Float:Angle[3];
GetEntPropVector(i, Prop_Send, "m_angRotation", Angle);
TeleportEntity(index, Location, Angle, NULL_VECTOR);
DispatchSpawn(index);
}
}
if(GetRandomInt(1,2)==1)
{
new index = CreateEntityByName("weapon_pain_pills_spawn");
new Float:Location[3];
GetEntPropVector(i, Prop_Send, "m_vecOrigin", Location);
if(index != -1)
{
new Float:Angle[3];
GetEntPropVector(i, Prop_Send, "m_angRotation", Angle);
TeleportEntity(index, Location, Angle, NULL_VECTOR);
DispatchSpawn(index);
}
}
AcceptEntityInput(i, "Kill");
continue;
}
}
}
}