code:
PHP Code:
int entity = CreateEntityByName("prop_dynamic_override");
if( entity < 1 || !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(entity, Prop_Send, "m_nSolidType", 6, 1);
SetEntProp(entity, Prop_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(currentpos, targetpos, vel);
PrintToServer("Vel %.0f, %.0f, %.0f", vel[0],vel[1],vel[2]);
TeleportEntity(g_pipebomb[client], NULL_VECTOR, targetang, vel);
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?