Raised This Month: $12 Target: $400
 3% 

Entity (2) is invalid


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
NC.svtrade
Senior Member
Join Date: Nov 2015
Old 01-11-2017 , 19:59   Entity (2) is invalid
Reply With Quote #1

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

new g_iHealBox[MAXPLAYERS+1], g_OnSoldHeal[MAXPLAYERS+1];

public 
OnPluginStart()
{
    
RegAdminCmd("sm_propdyn"propdyn0);
}

public 
Action:propdyn(clientargs)
{
    new 
heal CreateEntityByName("prop_dynamic");
    new 
Float:pos[3];
    
GetClientAbsOrigin(clientpos);
    
//SetEntProp(heal, Prop_Data, "m_iCollisionGroup", 2);
    
SetEntPropEnt(healProp_Send"m_hOwnerEntity"client);
    
DispatchKeyValue(heal"modelscale""1.5");
    
SetEntityModel(heal"models/weapons/shells/shell_shotgun.mdl");
    
DispatchSpawn(heal);
    
TeleportEntity(healposNULL_VECTORNULL_VECTOR);
    
g_iHealBox[client] = EntIndexToEntRef(heal);
    
CreateTimer(5.5Soldier_Healheal);
    
g_OnSoldHeal[client] = true;
}

public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if(
g_OnSoldHeal[client])
    {
        new 
Float:HealPos[3], sohealFloat:TraceHealPos[3];
        
soheal EntRefToEntIndex(g_iHealBox[client]);
        if(
soheal != -1)
        {
            
GetEntPropVector(sohealProp_Data"m_vecOrigin"HealPos);
            new 
clienthealth GetClientHealth(client);
            if(
clienthealth < (GetEntProp(clientProp_Data"m_iMaxHealth")))
            {
                
clienthealth += 3;
                
SetEntProp(clientProp_Data"m_iHealth"clienthealth);
            }
            for(new 
i=1i<=MaxClientsi++)
            {
                if(
PlayerCheck(i) && GetClientTeam(client) == GetClientTeam(i) && GetClientTeam(i) != && SetHitBoxAndTest(HealPosi120.0), != client)
                {
                    new 
ihealth GetEntProp(iProp_Data"m_iHealth"); // Line 17
                    
new imaxhealth GetEntProp(iProp_Data"m_iMaxHealth");
                    if(
ihealth imaxhealth)
                    {
                        
ihealth += 2;
                        
SetEntProp(iProp_Data"m_iHealth"ihealth);
                    }
                }
            }
            
TraceHealPos[0] = HealPos[0];
            
TraceHealPos[1] = HealPos[1];
            
TraceHealPos[2] = 9500.0;
            
//Trace
            
new Float:ccpos[3];
            
GetClientAbsOrigin(clientccpos);
            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:timerany:entity)
{
    new 
client;
    if(
IsValidEntity(entity))
    {
        
GetEntPropEnt(entityProp_Data"m_hOwnerEntity");
        
AcceptEntityInput(entity"Kill");
    }
    
g_OnSoldHeal[client] = false;
    return 
Plugin_Continue;
}

stock bool:SetHitBoxAndTest(Float:pos[3], int iclientfloat num 1.0)
{
    new 
Float:ipos[3];
    
GetClientAbsOrigin(iclientipos);
    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 && 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?
NC.svtrade is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode