DamageProxy: Add _hammmerid->Team to assign teams to generic entities
This commit is contained in:
parent
512cc7dbe2
commit
a4a35856c0
@ -14,7 +14,7 @@ public Plugin myinfo =
|
||||
name = "DamageProxy",
|
||||
author = "BotoX",
|
||||
description = "",
|
||||
version = "0.0",
|
||||
version = "0.2",
|
||||
url = ""
|
||||
};
|
||||
|
||||
@ -117,6 +117,14 @@ public void OnMapStart()
|
||||
if(iKnife > 0)
|
||||
OnWeaponEquipped(client, iKnife);
|
||||
}
|
||||
|
||||
int entity = INVALID_ENT_REFERENCE;
|
||||
while((entity = FindEntityByClassname(entity, "*")) != INVALID_ENT_REFERENCE)
|
||||
{
|
||||
char sClassname[64];
|
||||
if(GetEntityClassname(entity, sClassname, sizeof(sClassname)))
|
||||
OnEntitySpawned(entity, sClassname);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClientPutInServer(int client)
|
||||
@ -195,6 +203,36 @@ public void OnWeaponDropped(int client, int entity)
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEntitySpawned(int entity, const char[] classname)
|
||||
{
|
||||
if(!g_Config)
|
||||
return;
|
||||
|
||||
if(entity < 0 || entity >= sizeof(g_iPhysboxToClient))
|
||||
return;
|
||||
|
||||
if(!IsValidEntity(entity))
|
||||
return;
|
||||
|
||||
int iHammerID = GetEntProp(entity, Prop_Data, "m_iHammerID");
|
||||
if(!iHammerID)
|
||||
return;
|
||||
|
||||
char sHammerID[16] = "_";
|
||||
IntToString(iHammerID, sHammerID[1], sizeof(sHammerID) - 1);
|
||||
|
||||
g_Config.Rewind();
|
||||
if(!g_Config.JumpToKey(sHammerID))
|
||||
return;
|
||||
|
||||
int iTeam = g_Config.GetNum("Team", 0);
|
||||
|
||||
if(iTeam >= 1 && iTeam <= 3)
|
||||
{
|
||||
g_iPhysboxToClient[entity] = -iTeam;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEntityDestroyed(int entity)
|
||||
{
|
||||
if(entity >= 0 && entity < sizeof(g_iPhysboxToClient))
|
||||
|
Loading…
Reference in New Issue
Block a user