Alright, so first of all, this is my first time doin' much with entities, so I apologize if I do anything facepalmingly stupid.
Firstly, the code I'm trying
Code:
#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "1.0"
public OnPluginStart(){
HookEvent("round_start", Event_RoundStarted, EventHookMode_PostNoCopy);
//HookEvent("player_builtobject", Event_NewBuilding);
}
public Action:Event_RoundStarted(Handle:Event, const String:name[], bool:broadcast){
new entity = -1;
while ((entity = FindEntityByClassname(entity, "bot_hint_sentrygun")) != INVALID_ENT_REFERENCE) {
PrintToChatAll("%i", entity);
AcceptEntityInput(entity, "Kill");
}
new sentrypos = CreateEntityByName("bot_hint_sentrygun");
PrintToChatAll("New Entity ID is %i", sentrypos);
if (DispatchKeyValue(sentrypos, "TeamNum", "2"))
PrintToChatAll("TeamNum set successfully");
else
PrintToChatAll("Error setting TeamNum");
if (DispatchKeyValue(sentrypos, "angles", "0 130 0"))
PrintToChatAll("angles set successfully");
else
PrintToChatAll("Error setting angles");
if(DispatchSpawn(sentrypos))
PrintToChatAll("Entity spawned successfully");
else
PrintToChatAll("Error spawning entity");
new Float:origin[3] = {2193.2, 1566.7, 64.96};
new Float:angle[3] = {0.0, 130.0, 0.0};
TeleportEntity(sentrypos, origin, angle, NULL_VECTOR);
}
All the tests show success:
Code:
removed all sentries
New Entity ID is 402
TeamNum set successfully
angles set successfully
Entity spawned successfully
However, bots don't seem to want to build at the position I teleport it to, which may be because it's not properly teleporting, but there's no return value for TeleportEntity.
What's the best way to test that it teleported correctly?