View Single Post
Author Message
LinLinLin
Senior Member
Join Date: Sep 2021
Old 12-08-2023 , 22:06   [L4D2] prop_dynamic_override couldn't teleport with velocity
Reply With Quote #1

code:
PHP Code:
    int entity CreateEntityByName("prop_dynamic_override");
    if( 
entity || !IsValidEntity(entity) )
        return 
Plugin_Handled;
    
    
DispatchKeyValue(entity"model"PIPEBOMB);
    
DispatchKeyValue(entity"spawnflags""256");
    
DispatchKeyValue(entity"disablereceiveshadows""1");
    
DispatchKeyValue(entity"disableshadows""1");
    
DispatchKeyValue(entity"solid""0");
    
SetEntProp(entityProp_Send"m_nSolidType"61);
    
SetEntProp(entityProp_Send"m_CollisionGroup"2);
    
DispatchSpawn(entity);
    
g_pipebomb[client] = entity;
    
PrintToChat(client"Create pipebomb for client %N"client); 
teleport code in SDKHook_PostThink callback for client.
PHP Code:
    GetEntPropVector(g_pipebomb[client], Prop_Data"m_vecAbsOrigin"currentpos);
    
GetEntPropVector(g_pipebomb[client], Prop_Data"m_angAbsRotation"currentang);
    
PrintToServer("Entity(%d) pos %.1f,%.1f,%.1f ang %.1f,%.1f,%.1f"g_pipebomb[client],
    
currentpos[0],currentpos[1],currentpos[2],
    
currentang[0],currentang[1],currentang[2]);
    
PrintToServer("Target(%d) pos %.1f,%.1f,%.1f ang %.1f,%.1f,%.1f"target,
    
targetpos[0],targetpos[1],targetpos[2],
    
targetang[0],targetang[1],targetang[2]);

    
MakeVectorFromPoints(currentpostargetposvel);
    
PrintToServer("Vel %.0f, %.0f, %.0f"vel[0],vel[1],vel[2]);
    
TeleportEntity(g_pipebomb[client], NULL_VECTORtargetangvel); 
teleport not work for velocity, but ang are changed successfully.
pos and vel num are correct base on the print infomation.
does something wrong with the code?

Last edited by LinLinLin; 12-08-2023 at 22:08.
LinLinLin is offline