i was trying to make some kind fo civillian that walk around the map and when you touch then they talk to you but when i spawn the simple_bot entity the game just crashes i use this
PHP Code:
public SpawnCivillian(client)
{
new Float:pos[3];
new Float:ang[3];
GetClientEyeAngles(client, ang);
GetClientEyePosition(client, pos);
new civ = CreateEntityByName("simple_bot");
if(civ != -1)
{
DispatchSpawn(civ);
ActivateEntity(civ);
TeleportEntity(civ, pos, ang, NULL_VECTOR);
SDKHook(civ, SDKHook_Touch, OnTouch);
}
}
public Action:OnTouch(entity, other)
{
if(IsValidClient(other))
{
new Float:pos[3];
GetClientAbsOrigin(other, pos);
SetEntityMoveType(entity, MOVETYPE_NONE);
TeleportEntity(entity, NULL_VECTOR, pos, NULL_VECTOR);
}
}