Raised This Month: $ Target: $400
 0% 

[CSGO] Setting animation on prop_physics_override


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Razmo51
Senior Member
Join Date: Aug 2011
Location: Event "player_death
Old 05-14-2015 , 18:35   [CSGO] Setting animation on prop_physics_override
Reply With Quote #1

Hello,


I'm trying to create an entity and throw it at his spawn, I had it working with a prop_physics_override, but now I want to animate it, si I used the 'SetAnimation' input, but it didn't work ...

I tried with the prop_dynamic_override and then the Animation worked, but I can't throw the prop anymore

Here's my code:


Code:

stock Throw(client)
{
    new Float:pos[3];
    GetClientAbsOrigin(client, pos);
    new entity = CreateEntityByName("prop_dynamic_override");
    // new entity = CreateEntityByName("prop_physics_override");
    if (IsValidEdict(entity))
    {
        SetEntityModel(entity, MODEL);
        SetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity", client);
        
        SDKHook(entity, SDKHook_Spawn, SDKHook_OnEntitySpawned);
        
        SetEntPropFloat(entity, Prop_Send, "m_flElasticity", 0.0);
        SetEntityGravity(entity, 0.01);
        
        DispatchSpawn(entity);
        
        new Float:angles[3] = {0.0, 0.0, 0.0};
        TeleportEntity(entity, pos, angles, NULL_VECTOR);
        
        // Works with prop_dynamic_override but not with prop_physics_override
        SetAnim(entity, "Fly01");

        return entity;
    }
    return -1;
}

SetAnim(ent, const String:anim[])
{
    SetVariantString(anim);
    AcceptEntityInput(ent, "SetAnimation");
}


public SDKHook_OnEntitySpawned(entity)
{
    CreateTimer(0.1, Throw, entity);
}

// Works with prop_physics_override, but not with prop_dynamic_override
public Action:Throw(Handle:Timer, any:ent)
{
    if(IsValidEdict(ent))
    {
        new client = GetEntPropEnt(ent, Prop_Send, "m_hOwnerEntity");

        if(IsPlayerAlive(client))
        {
        
            new Float:fPos[3], Float:fVec[3], Float:fFw[3], Float:fUp[3];
            GetClientEyeAngles(client, fVec);
            GetClientEyePosition(client, fPos);    
            
            fPos[0]+=fFw[0]*45.0;
            fPos[1]+=fFw[1]*45.0;
            fPos[2]+=fFw[2]*45.0;
            
            fPos[2] -= 30.0;
            
            GetAngleVectors(fVec, fFw, NULL_VECTOR, fUp);
            ScaleVector(fFw, 3000.0);
            AddVectors(fFw, fUp, fVec);
            
            TeleportEntity(ent, fPos, NULL_VECTOR, fVec);
        }
        else
        {
            AcceptEntityInput(ent, "Kill");
        }
    }
    return Plugin_Stop;
}
Could you please help me ? ;(


Thanks in advance.
__________________
Sorry for my bad English, I'm Belgian

Last edited by Razmo51; 05-14-2015 at 18:36.
Razmo51 is offline
 



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 12:05.


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