View Single Post
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 04-26-2019 , 01:43   Re: Property not found
Reply With Quote #2

It literally tells you why...

Spoiler


EDIT:

Ok ill be abit more helpful
You are passing an entity index into a timer, never do that Pass an entity reference instead.

https://sm.alliedmods.net/new-api/ha...tIndexToEntRef
https://sm.alliedmods.net/new-api/ha...tRefToEntIndex

PHP Code:
public void OnEntityCreated(int entity, const char[] classname)
{
    if (
StrEqual(classname"healthkit"))
    {
        
Handle hDatapack;
        
CreateDataTimer(Healthkit_Timer_TickrateHealthkithDatapackTIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);// you really sure you want it to be a repeat timer?
        
WritePackCell(hDatapackEntIndexToEntRef(entity));
        
WritePackFloat(hDatapackGetGameTime()+Healthkit_Timer_Timeout);
        
g_fLastHeight[entity] = -9999.0;
        
g_iTimeCheckHeight[entity] = -9999.0;
        
SDKHook(entitySDKHook_VPhysicsUpdateHealthkitGroundCheck);
        
CreateTimer(0.1HealthkitGroundCheckTimerEntIndexToEntRef(entity), TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);// you really sure you want it to be a repeat timer?
    
}
}

// return Plugin_Stop = stop timer, return Plugin_Continue = continue repeat the timer with repeat flag.
public Action HealthkitGroundCheckTimer(Handle timerany entref)
{
    
int entity EntRefToEntIndex(entref));// converts an entity reference back to an ent index will be -1(0xFFFFFFFF)(INVALID_ENT_REFERENCE ) if invalid
    
if(entref == INVALID_ENT_REFERENCE || !IsValidEntity(entref))
        return 
Plugin_Stop;// CLOSE TIMERS don't leave them running if you don't need them.
    
    
float fGameTime GetGameTime();
    if (
fGameTime-g_fTimeCheck[entity] >= 1.0)
    {
        
float fOrigin[3];
        
GetEntPropVector(entityProp_Send"m_vecOrigin"fOrigin);
        
//int iRoundHeight = RoundFloat(fOrigin[2]);
        
int iRoundHeight RoundFloat(fOrigin[2]);
        if (
iRoundHeight == g_iTimeCheckHeight[entity])
        {
            
g_fTimeCheck[entity] = GetGameTime();
            
SDKUnhook(entitySDKHook_VPhysicsUpdateHealthkitGroundCheck);
            
SDKHook(entitySDKHook_VPhysicsUpdateOnEntityPhysicsUpdate);
        }
    }
    return 
Plugin_Continue;// because you put timer repeat flag i'm going to assume you want it to repeat i don't really want to dig into 6k lines sorry
}

public 
Action Healthkit(Handle timerHandle hDatapack)
{
    
ResetPack(hDatapack);
    
int entity EntRefToEntIndex(ReadPackCell(hDatapack));//converting an entref back to an index, if it's -1 means that exact entity nolonger exists.
    
float fEndTime ReadPackFloat(hDatapack);
    
float fGameTime GetGameTime();
    
    if (
entity != INVALID_ENT_REFERENCE && IsValidEntity(entity) && fGameTime <= fEndTime)
    {
        
float fOrigin[3];
        
GetEntPropVector(entityProp_Send"m_vecOrigin"fOrigin);
        if (
g_fLastHeight[entity] == -9999.0)
        {
            
g_fLastHeight[entity] = 0.0;
            
EmitSoundToAll("Lua_sounds/healthkit_healing.wav"entitySNDCHAN_STATIC__0.7);
        }
        
//fOrigin[2] += 16.0;
        
fOrigin[2] += 1.0;
        
//TE_SetupBeamRingPoint(beamPos, 1.0, Revive_Indicator_Radius, g_iBeaconBeam, g_iBeaconHalo, 0, 15, 5.0, 3.0, 5.0, {255, 0, 0, 255}, 1, (FBEAM_FADEIN, FBEAM_FADEOUT));
        
TE_SetupBeamRingPoint(fOrigin15.0Healthkit_Radius*0.55g_iBeaconBeamg_iBeaconHalo051.01.02.0, {0204100255},1,0);
        
// // //TE_SetupBeamRingPoint(fOrigin, 5.0, Healthkit_Radius*1.95, g_iBeaconBeam, g_iBeaconHalo, 0, 30, 5.0, 3.0, 5.0, {0, 255, 0, 255}, 1, (FBEAM_FADEOUT));
        //TE_SetupBeamRingPoint(fOrigin, 10.0, Healthkit_Radius*1.95, g_iBeaconBeam, g_iBeaconHalo, 0, 30, 0.6, 3.0, 0.0, {0, 204, 102, 255}, 3, 0);
        
TE_SendToAll();
        
fOrigin[2] -= 16.0;
        if (
fOrigin[2] != g_fLastHeight[entity])
        {
            
g_fLastHeight[entity] = fOrigin[2];
        }
        else
        {
            
float fAng[3];
            
GetEntPropVector(entityProp_Send"m_angRotation"fAng);
            if (
fAng[1] > 89.0 || fAng[1] < -89.0)
                
fAng[1] = 90.0;
            if (
fAng[2] > 89.0 || fAng[2] < -89.0)
            {
                
fAng[2] = 0.0;
                
fOrigin[2] -= 6.0;
                
TeleportEntity(entityfOriginfAngview_as<float>({0.00.00.0}));
                
fOrigin[2] += 6.0;
                
EmitSoundToAll("ui/sfx/cl_click.wav"entitySNDCHAN_STATIC__1.0);
            }
        }
        for (
int iPlayer 1;iPlayer <= MaxClients;iPlayer++)
        {
            if (
IsClientInGame(iPlayer) && IsPlayerAlive(iPlayer) && GetClientTeam(iPlayer) == 2)
            {
                
float fPlayerOrigin[3];
                
GetClientEyePosition(iPlayerfPlayerOrigin);
                if (
GetVectorDistance(fPlayerOriginfOrigin) <= Healthkit_Radius)
                {
                    
DataPack hData CreateDataPack();
                    
WritePackCell(hDataentity);
                    
WritePackCell(hDataiPlayer);
                    
fOrigin[2] += 32.0;
                    
Handle trace TR_TraceRayFilterEx(fPlayerOriginfOriginMASK_SOLIDRayType_EndPointFilter_ClientSelfhData);
                    
delete hData;
                    if (!
TR_DidHit(trace))
                    {
                        
int iMaxHealth GetEntProp(iPlayerProp_Data"m_iMaxHealth");
                        
int iHealth GetEntProp(iPlayerProp_Data"m_iHealth");
                        if (
iMaxHealth iHealth)
                        {
                            
iHealth += GetRandomInt(Healthkit_Healing_Per_Tick_MinHealthkit_Healing_Per_Tick_Max);
                            if (
iHealth >= iMaxHealth)
                            {
                                
EmitSoundToAll("Lua_sounds/healthkit_complete.wav"iPlayerSNDCHAN_STATIC__1.0);
                                
iHealth iMaxHealth;
                                
//PrintToChat(iPlayer, "\x05竊긌ua \x01@ \x03You are completely healed!");
                                
PrintCenterText(iPlayer"Healed !\n\n \n %d %%\n \n \n \n \n \n \n \n"iMaxHealth);
                            }
                            else 
PrintCenterText(iPlayer"Healing...\n\n \n   %d %%\n \n \n \n \n \n \n \n"iHealth);
                            
SetEntProp(iPlayerProp_Data"m_iHealth"iHealth);
                        }
                    }
                }
            }
        }
    }
    else
    {
        return 
Plugin_Stop;// You are leaking handles and you are using a repeat time while passing an entindex to a timer don't pass the entindex use a reference.
    
}
    return 
Plugin_Continue;// because you are using a repeat timer flag i'm going to assume you want it to repeat.

I have no idea what else is wrong with this code, i did not look too much into it i'm assuming you want it to be a repeat timer because you are passing a repeat flag into both of them, if you don't want it to be repeat a repeat timer don't pass the repeat flag.
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D

Last edited by Lux; 04-26-2019 at 03:21. Reason: Being more helpful
Lux is offline