ishitnumber = {} numbervalue = {} state = {} newy = {} old_hp = {} new_delay = {} placed = {} forwardoffset = 29 --how far in front (or behind) the hit character the numbers (first) appear sideoffset = 25 --gap between numbers (negative will make numbers on left side i believe) float_height = 60 --how far up numbers float float_speed = 60 --how fast the numbers move upwards delay = 400 --delay before numbers disappear (after reaching float height) newsideoffset = {} function number_control_init(e) end function number_control_main(e) for a,_ in pairs (ai_bot_state) do if old_hp[a] == nil then old_hp[a] = g_Entity[a]['health'] --PromptDuration(old_hp[a],20000) end end for a,_ in pairs (ishitnumber) do if newy[a] ~= nil then --PromptLocal(a,GetEntityPositionY(a).." "..newy[a]) end if state[a] == "unused" then Hide(a) elseif state[a] == "used" then Show(a) if newsideoffset[a] ~= nil then new_y = math.rad(AngleToPoint(a,g_PlayerPosX,g_PlayerPosZ)-90) newx = GetEntityPositionX(a) + (math.sin(new_y) * newsideoffset[a]) newz = GetEntityPositionZ(a) + (math.cos(new_y) * newsideoffset[a]) SetPosition(a,newx,GetEntityPositionY(a),newz) ResetPosition(a,newx,GetEntityPositionY(a),newz) newsideoffset[a] = nil end if GetEntityPositionY(a) < newy[a] then SetRotation(a,g_Entity[a]['anglex'],AngleToPoint(a,g_PlayerPosX,g_PlayerPosZ)+180,g_Entity[a]['anglez']) MoveUp(a,float_speed) new_delay[a] = g_Time+delay else if g_Time > new_delay[a] then state[a] = "unused" end end end end for a,_ in pairs (ai_bot_state) do ehp = g_Entity[a]['health'] if ehp < old_hp[a] then temphp = old_hp[a]-ehp tempstring = tostring(temphp) templen = string.len(tempstring) --PromptDuration("-"..tempstring.."!",500) newsideoffset[a] = sideoffset*(templen/2) for b = templen , 1 , -1 do templetter = string.sub(tempstring,b,b) for c = 0 , 9 do if tonumber(templetter) == c then for d,_ in pairs (ishitnumber) do if numbervalue[d] == c then if state[d] == "unused" then new_y = math.rad(AngleToPoint(a,g_PlayerPosX,g_PlayerPosZ)) newx = GetEntityPositionX(a) + (math.sin(new_y) * forwardoffset) newz = GetEntityPositionZ(a) + (math.cos(new_y) * forwardoffset) SetPosition(d,newx,GetEntityPositionY(a),newz) ResetPosition(d,newx,GetEntityPositionY(a),newz) newsideoffset[d] = newsideoffset[a] newy[d] = GetEntityPositionY(a)+float_height Show(d) state[d] = "used" newsideoffset[a] = newsideoffset[a]-sideoffset placed[d] = 1 break end end end end end end old_hp[a] = ehp end end end function AngleToPoint(e,x,z) if g_Entity[e] ~= nil and x > 0 and z > 0 then local destx = x - g_Entity[e]['x'] local destz = z - g_Entity[e]['z'] local angle = math.atan2(destx,destz) angle = angle * (180.0 / math.pi) if angle < 0 then angle = 360 + angle elseif angle > 360 then angle = angle - 360 end --SetRotation(e,0,angle,0) return angle end end