PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
new g_iHealBox[MAXPLAYERS+1], g_OnSoldHeal[MAXPLAYERS+1];
public OnPluginStart()
{
RegAdminCmd("sm_propdyn", propdyn, 0);
}
public Action:propdyn(client, args)
{
new heal = CreateEntityByName("prop_dynamic");
new Float:pos[3];
GetClientAbsOrigin(client, pos);
//SetEntProp(heal, Prop_Data, "m_iCollisionGroup", 2);
SetEntPropEnt(heal, Prop_Send, "m_hOwnerEntity", client);
DispatchKeyValue(heal, "modelscale", "1.5");
SetEntityModel(heal, "models/weapons/shells/shell_shotgun.mdl");
DispatchSpawn(heal);
TeleportEntity(heal, pos, NULL_VECTOR, NULL_VECTOR);
g_iHealBox[client] = EntIndexToEntRef(heal);
CreateTimer(5.5, Soldier_Heal, heal);
g_OnSoldHeal[client] = true;
}
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
if(g_OnSoldHeal[client])
{
new Float:HealPos[3], soheal, Float:TraceHealPos[3];
soheal = EntRefToEntIndex(g_iHealBox[client]);
if(soheal != -1)
{
GetEntPropVector(soheal, Prop_Data, "m_vecOrigin", HealPos);
new clienthealth = GetClientHealth(client);
if(clienthealth < (GetEntProp(client, Prop_Data, "m_iMaxHealth")))
{
clienthealth += 3;
SetEntProp(client, Prop_Data, "m_iHealth", clienthealth);
}
for(new i=1; i<=MaxClients; i++)
{
if(PlayerCheck(i) && GetClientTeam(client) == GetClientTeam(i) && GetClientTeam(i) != 1 && SetHitBoxAndTest(HealPos, i, 120.0), i != client)
{
new ihealth = GetEntProp(i, Prop_Data, "m_iHealth"); // Line 17
new imaxhealth = GetEntProp(i, Prop_Data, "m_iMaxHealth");
if(ihealth < imaxhealth)
{
ihealth += 2;
SetEntProp(i, Prop_Data, "m_iHealth", ihealth);
}
}
}
TraceHealPos[0] = HealPos[0];
TraceHealPos[1] = HealPos[1];
TraceHealPos[2] = 9500.0;
//Trace
new Float:ccpos[3];
GetClientAbsOrigin(client, ccpos);
new Float:prepos[3];
new Float:nexpos[3];
new Float:i[1];
i[0] = -179.9;
while(i[0]<= 179.9)
{
nexpos[0] = Cosine(DegToRad(i[0]));
nexpos[1] = Sine(DegToRad(i[0]));
nexpos[2] = ccpos[2];
if(nexpos[0] != prepos[0] && nexpos[1] != prepos[1])
{
//Trace
}
prepos[0] = nexpos[0];
prepos[1] = nexpos[1];
prepos[2] = ccpos[2];
i[0] += 0.1;
}
}
}
}
public Action:Soldier_Heal(Handle:timer, any:entity)
{
new client;
if(IsValidEntity(entity))
{
GetEntPropEnt(entity, Prop_Data, "m_hOwnerEntity");
AcceptEntityInput(entity, "Kill");
}
g_OnSoldHeal[client] = false;
return Plugin_Continue;
}
stock bool:SetHitBoxAndTest(Float:pos[3], int iclient, float num = 1.0)
{
new Float:ipos[3];
GetClientAbsOrigin(iclient, ipos);
if(pos[0] + num > ipos[0] && pos[0] - num < ipos[0] && pos[1] + num > ipos[1] && pos[1] - num < ipos[1] && pos[2] + num > ipos[2] && pos[2] - num < ipos[2])
{
return true;
} else {
return false;
}
}
stock bool:PlayerCheck(Client){
if(Client > 0 && Client <= MaxClients){
if(IsClientConnected(Client) == true){
if(IsClientInGame(Client) == true){
return true;
}
}
}
return false;
}
Error log
L 01/12/2017 - 08:22:22: [SM] Exception reported: Property "m_iCollisionGroup" not found (entity 219/prop_dynamic)
L 01/12/2017 - 08:22:22: [SM] Blaming: 솔져 힐팩 테스트.smx()
L 01/12/2017 - 08:22:22: [SM] Call stack trace:
L 01/12/2017 - 08:22:22: [SM] [0] SetEntProp
L 01/12/2017 - 08:22:22: [SM] [1] Line 17, C:\Users\Allotroprism\Desktop\플러그인 만들기\솔져 힐팩 테스트.sp::propdyn()
What is the problem and how to fix it?